-
Notifications
You must be signed in to change notification settings - Fork 510
85 lines (82 loc) · 2.43 KB
/
run-tests.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
name: Run tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
generate-matrix-with-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
- id: generate-matrix
run: |
RESULT=$(node .github/workflows/scripts/get-all-packages-by-name.js)
echo "matrix=$RESULT" >> $GITHUB_OUTPUT
test:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: generate-matrix-with-packages
permissions:
contents: read
strategy:
matrix:
node-version: [20.x, 22.x]
package: ${{fromJson(needs.generate-matrix-with-packages.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build
- run: npm run test --workspace ${{ matrix.package }}
env:
FORCE_COLOR: 1
- name: Notify about failures
if: failure() && github.ref == 'refs/heads/main'
uses: 8398a7/[email protected]
with:
status: ${{ job.status }}
fields: repo,message,commit,author,eventName,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
test-windows:
timeout-minutes: 60
runs-on: windows-latest
needs: generate-matrix-with-packages
continue-on-error: true
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- run: npm install
- run: npm run build
- name: Run windows tests and capture exit code
continue-on-error: true
run: |
npm run test:windows --workspace artillery
echo "HAS_PASSED=$?" >> $env:GITHUB_ENV
env:
FORCE_COLOR: 1
- name: Notify about failures
if: env.HAS_PASSED == 'False'
uses: 8398a7/[email protected]
with:
status: failure
fields: repo,message,commit,author,eventName,job,took,pullRequest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}