-
Notifications
You must be signed in to change notification settings - Fork 13
127 lines (101 loc) · 4.23 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Test
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: depot-ubuntu-22.04-16
# Use cheaper machines for dependabot if we're low on namespace credits
# runs-on: ${{ github.actor == 'dependabot[bot]' && 'namespace-profile-frontend-light' || 'namespace-profile-frontend' }}
permissions: write-all
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci --prefer-offline --ignore-scripts --no-audit --no-fund
- run: git fetch origin ${{ github.event.pull_request.head.sha }}
- id: get_head_commit_message
run: echo "MESSAGE=$(git show -s --format=%s ${{github.event.pull_request.head.sha}})" >> "$GITHUB_OUTPUT"
- id: compute_percy_enable_for_branch
run: echo "::set-output name=percy_enable::true"
if: "github.event_name == 'schedule' && github.ref == 'refs/heads/main'"
- id: compute_percy_enable_for_commit
run: echo "::set-output name=percy_enable::true"
if: "contains(steps.get_head_commit_message.outputs.MESSAGE, '[percy]')"
- id: compute_percy_enable
run: echo "::set-output name=percy_enable::true"
if: steps.compute_percy_enable_for_branch.outputs.percy_enable == 'true' || steps.compute_percy_enable_for_commit.outputs.percy_enable == 'true'
- run: npx ember --version
- run: npx percy --version
- run: npm run tailwind:build
- run: npx percy exec --quiet -- npx ember exam --silent --reporter=xunit --parallel=16 --load-balance --preserve-test-name | tee test-results.xml
env:
COVERAGE: true
PERCY_ENABLE: ${{steps.compute_percy_enable.outputs.percy_enable || '0'}}
PERCY_TOKEN: ${{secrets.PERCY_TOKEN}}
STRIPE_PUBLISHABLE_KEY: "dummy"
- run: cat test-results.xml
if: always()
- name: 'Upload coverage to Codecov'
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: test-results.xml
- name: Remove percy logs
run: sed -i '/^\[percy\]/d' test-results.xml
- name: Remove sentry-webpack-plugin logs
run: sed -i '/^\[sentry-webpack-plugin\]/d' test-results.xml
- run: cat test-results.xml
- name: Publish Buildkite analytics
continue-on-error: true
run: |-
curl -XPOST --fail \
-H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \
-F "[email protected]" \
-F "format=junit" \
-F "run_env[CI]=github_actions" \
-F "run_env[key]=$GITHUB_ACTION-$GITHUB_RUN_NUMBER-$GITHUB_RUN_ATTEMPT" \
-F "run_env[number]=$GITHUB_RUN_NUMBER" \
-F "run_env[branch]=$GITHUB_REF" \
-F "run_env[commit_sha]=$GITHUB_SHA" \
-F "run_env[url]=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
https://analytics-api.buildkite.com/v1/uploads
if: always()
env:
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-results.xml
seconds_between_github_writes: 0.01
seconds_between_github_reads: 0.01
lint:
runs-on: depot-ubuntu-22.04-16
# Use cheaper machines for dependabot if we're low on namespace credits
# runs-on: ${{ github.actor == 'dependabot[bot]' && 'namespace-profile-frontend-light' || 'namespace-profile-frontend' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci --prefer-offline --ignore-scripts --no-audit --no-fund
- run: npm run tailwind:build
- run: npm run lint