-
Notifications
You must be signed in to change notification settings - Fork 69
129 lines (112 loc) · 4.73 KB
/
chip-tool-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
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
128
129
# This workflow executed the chip tool tests against matter.js
name: Chip Tool tests
on:
schedule:
- cron: 0 2 * * * # Every day at 02:00
workflow_dispatch: # Manually on demand
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
merge_group:
# Cancel previous PR/branch runs when a new commit is pushed
concurrency:
group: ${{ github.ref }}-chip-tool-tests
cancel-in-progress: true
jobs:
# Find out what is needed to be done by this test workflow
chip-tests-needed:
runs-on: ubuntu-latest
outputs:
chip-changes: ${{ steps.changes.outputs.src }}
chip-tests-required: ${{ steps.check-trigger.outputs.chip-tests-required || steps.check-rebuild.outputs.chip-tests-required || steps.check-long-tests.outputs.chip-tests-required }}
chip-tool-rebuild: ${{ steps.check-rebuild.outputs.chip-tool-rebuild }}
chip-long-tests-required: ${{ steps.check-long-tests.outputs.chip-long-tests-required }}
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- "chip-testing/**"
- "packages/matter.js/src/**"
- "packages/matter-node.js/src/**"
- ".github/workflows/chip-tool-tests.yml"
- "package.json"
- "packages/**/package.json"
- uses: dorny/paths-filter@v2
id: changes-long-tests
with:
filters: |
src:
- "chip-testing/src/suites-long/**"
- if: ${{ github.event_name == 'schedule' || ((github.event_name == 'push' || github.event_name == 'pull_request') && steps.changes.outputs.src == 'true') || github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[execute-chiptests]') == true }}
name: Chip Tool tests required to run?
id: check-trigger
run: echo "chip-tests-required=true" >> $GITHUB_OUTPUT
- if: ${{ contains(github.event.head_commit.message, '[rebuild-chip]') == true }}
name: Chip Tool rebuild required?
id: check-rebuild
run: |
echo "chip-tests-required=true" >> $GITHUB_OUTPUT
echo "chip-tool-rebuild=true" >> $GITHUB_OUTPUT
- name: Get Day of the week
run: |
echo "DOW=$(date +%u)" >> $GITHUB_ENV
- if: ${{ (env.DOW == 6 && github.event_name == 'schedule') || steps.changes-long-tests.outputs.src == 'true' }}
name: Enable Long tests if needed
id: check-long-tests
run: |
echo "chip-tests-required=true" >> $GITHUB_OUTPUT
echo "chip-long-tests-required=true" >> $GITHUB_OUTPUT
# If we need to do anything make sure that chip binaries are build and environment can be set up
prepare-chip-build:
needs: [chip-tests-needed]
if: ${{ needs.chip-tests-needed.outputs.chip-tool-rebuild == 'true' || needs.chip-tests-needed.outputs.chip-tests-required == 'true' || needs.chip-tests-needed.outputs.chip-changes == 'true' || needs.chip-tests-needed.outputs.chip-long-tests-required == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- name: Prepare chip tests and rebuild chip-tool if needed
uses: ./.github/actions/prepare-chip-testing
with:
rebuild-chip-tool: ${{ needs.chip-tests-needed.outputs.chip-tool-rebuild }}
build-matter-js: "false"
# Execute the normal tests
chip-tests:
needs: [prepare-chip-build]
if: ${{ needs.chip-tests-needed.outputs.chip-tool-rebuild == 'true' || needs.chip-tests-needed.outputs.chip-tests-required == 'true' || needs.chip-tests-needed.outputs.chip-changes == 'true' || needs.chip-tests-needed.outputs.chip-long-tests-required == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- name: Initialize chip tests
uses: ./.github/actions/prepare-chip-testing
with:
rebuild-chip-tool: "false"
- name: Test execution
id: test-execution
shell: bash
run: |
cd chip-testing
npm run test-chip
# Execute the long running tests (if needed)
chip-tests-long:
needs: [prepare-chip-build]
if: ${{ needs.chip-tests-needed.outputs.chip-long-tests-required == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- name: Initialize chip tests
uses: ./.github/actions/prepare-chip-testing
with:
rebuild-chip-tool: 'false'
- name: Long Test execution
id: test-execution-long
shell: bash
run: |
cd chip-testing
LONG_TESTS_ONLY=1 npm run test-chip