-
Notifications
You must be signed in to change notification settings - Fork 2.1k
125 lines (119 loc) · 4.21 KB
/
test-ui.yml
File metadata and controls
125 lines (119 loc) · 4.21 KB
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
name: test-ui
on:
pull_request:
paths:
- "ui/**"
push:
branches:
- main
- release/**
- test-ui
paths:
- "ui/**"
jobs:
pre-test:
runs-on: ubuntu-22.04
timeout-minutes: 30
defaults:
run:
working-directory: ui
outputs:
nonce: ${{ steps.nonce.outputs.nonce }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-js
- name: lint:js
run: pnpm lint:js
- name: lint:hbs
run: pnpm lint:hbs
- id: nonce
name: nonce
run: echo "nonce=${{ github.run_id }}-$(date +%s)" >> "$GITHUB_OUTPUT"
tests:
needs:
- pre-test
runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux", "type=m7a.2xlarge;m6a.2xlarge"]') || 'custom-ubuntu-22.04-medium' }}
timeout-minutes: 30
defaults:
run:
working-directory: ui
strategy:
fail-fast: false
matrix:
partition: [1, 2, 3, 4]
split: [4]
# Note: If we ever change the number of partitions, we'll need to update the
# finalize.combine step to match
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-js
- uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1
- name: ember exam
id: ember_exam
run: |
pnpm exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }} --json-report=test-results/test-results.json
continue-on-error: true
- name: Express failure
if: steps.ember_exam.outcome == 'failure'
run: |
echo "Tests failed in ember-exam for partition ${{ matrix.partition }}"
echo "Failed tests:"
node -e "
const results = JSON.parse(require('fs').readFileSync('test-results/test-results.json'));
results.tests.filter(t => !t.passed).forEach(test => {
console.error('\n❌ ' + test.name);
if (test.error) console.error(test.error);
});
"
exit 1
- name: Upload partition test results
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: test-results-${{ matrix.partition }}
path: ui/test-results/test-results.json
retention-days: 90
finalize:
needs:
- pre-test
- tests
runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux", "type=m7a.2xlarge;m6a.2xlarge"]') || 'ubuntu-22.04' }}
timeout-minutes: 30
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-js
- name: Download all test results
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: test-results-*
path: test-results
- name: Combine test results for comparison
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: node ../scripts/combine-ui-test-results.js
- name: Upload combined results for comparison
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: test-results-${{ github.sha }}
path: ui/combined-test-results.json
retention-days: 90
handle-failure:
needs:
- pre-test
- tests
- finalize
if: always() && github.event_name == 'push' && contains(needs.*.result, 'failure')
uses: ./.github/workflows/test-failure-notification.yml
secrets: inherit
with:
actor: ${{ github.triggering_actor }}
git-branch: ${{ github.ref_name }}
workflow-run-id: ${{ github.run_id }}
workflow-name: ${{ github.workflow }}
permissions:
contents: read
id-token: write