@@ -14,41 +14,128 @@ concurrency:
14
14
permissions : read-all
15
15
16
16
jobs :
17
+ gen-matrix :
18
+ name : Generate matrix
19
+ if : github.event.action != 'closed'
20
+ runs-on : ubuntu-latest
21
+ outputs :
22
+ build-types : ${{ steps.set-matrix.outputs.build-types }}
23
+ hw-types : ${{ steps.set-matrix.outputs.hw-types }}
24
+ wokwi-types : ${{ steps.set-matrix.outputs.wokwi-types }}
25
+ qemu-types : ${{ steps.set-matrix.outputs.qemu-types }}
26
+ steps :
27
+ - name : Set matrix
28
+ id : set-matrix
29
+ run : |
30
+ build_types=[\"validation\"
31
+ hw_types=[\"validation\"
32
+ wokwi_types=["validation\"
33
+ qemu_types=[\"validation\"
34
+
35
+ is_pr=${{ github.event.pull_request.number != null }}
36
+ is_performance_enabled=${{ contains(github.event.pull_request.labels.*.name, 'perf_test') }}
37
+
38
+ if [[ $is_pr != 'true' ]] || [[ $is_performance_enabled == 'true' ]]; then
39
+ build_types+=,\"performance\"
40
+ hw_types+=,\"performance\"
41
+ #wokwi_types+=,\"performance\"
42
+ #qemu_types+=,\"performance\"
43
+ fi
44
+
45
+ echo "build-types=$build_types]" >> $GITHUB_OUTPUT
46
+ echo "hw-types=$hw_types]" >> $GITHUB_OUTPUT
47
+ echo "wokwi-types=$wokwi_types]" >> $GITHUB_OUTPUT
48
+ echo "qemu-types=$qemu_types]" >> $GITHUB_OUTPUT
49
+
17
50
call-build-tests :
18
51
name : Build tests
19
- if : github.event.action != 'closed'
20
52
uses : ./.github/workflows/build_tests.yml
53
+ needs : gen-matrix
54
+ if : github.event.action != 'closed'
55
+ strategy :
56
+ matrix :
57
+ type : ${{ fromJson(needs.gen-matrix.outputs.build-types) }}
58
+ chip : ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
21
59
22
60
call-hardware-tests :
23
61
name : Run tests on hardware
24
62
uses : ./.github/workflows/hw.yml
25
- needs : call-build-tests
26
- # if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
27
- if : false
63
+ needs : [gen-matrix, call-build-tests]
64
+ if : ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
65
+ strategy :
66
+ fail-fast : false
67
+ matrix :
68
+ type : ${{ fromJson(needs.gen-matrix.outputs.hw-types) }}
69
+ chip : ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
28
70
29
71
call-wokwi-tests :
30
72
uses : ./.github/workflows/wokwi.yml
31
- needs : call-build-tests
73
+ needs : [gen-matrix, call-build-tests]
74
+ if : github.event.action != 'closed'
75
+ strategy :
76
+ fail-fast : false
77
+ matrix :
78
+ type : ${{ fromJson(needs.gen-matrix.outputs.wokwi-types) }}
79
+ chip : ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
32
80
secrets :
33
81
WOKWI_CLI_TOKEN : ${{ secrets.WOKWI_CLI_TOKEN }}
34
82
35
83
# call-qemu-tests:
36
- # uses: espressif/arduino-esp32/.github/workflows/qemu.yml@master
37
- # needs: [call-build-validation-tests]
38
- # permissions:
39
- # contents: read
40
- # strategy:
41
- # matrix:
42
- # chip: ['esp32', 'esp32c3']
43
- # with:
44
- # chip: ${{matrix.chip}}
45
- # type: "validation"
46
- # ref: ${{ github.event.pull_request.number || github.ref }}
47
-
48
- call-clean :
84
+ # uses: ./.github/workflows/qemu.yml@master
85
+ # needs: [gen-matrix, call-build-tests]
86
+ # strategy:
87
+ # matrix:
88
+ # type: ${{ fromJson(needs.gen-matrix.outputs.qemu-types) }}
89
+ # chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
90
+
91
+ clean :
49
92
name : Clean objects
50
- uses : ./.github/workflows/clean.yml
51
- needs : [call-build-tests, call-hardware-tests, call-wokwi-tests]
52
- if : always() && (github.event_name != 'pull_request' || github.event.action == 'closed')
93
+ needs : [call-hardware-tests, call-wokwi-tests]
94
+ if : always()
53
95
permissions :
54
96
actions : write
97
+ runs-on : ubuntu-latest
98
+ steps :
99
+ - name : Clean up caches
100
+ uses : actions/github-script@v7
101
+ with :
102
+ script : |
103
+ // Check if event is not a pull request or is a closed pull request
104
+ if (github.event_name === 'pull_request' && github.event.action !== 'closed') {
105
+ console.log('Skipping cache cleanup');
106
+ return;
107
+ }
108
+
109
+ const ref = "${{ github.event.pull_request.number || github.ref }}";
110
+ const cacheKeysPattern = `tests-bin-${ref}-*`;
111
+
112
+ console.log(`Deleting caches matching pattern: ${cacheKeysPattern}`);
113
+
114
+ // Fetch all cache entries for the repository
115
+ const caches = await github.rest.actions.getActionsCacheList({
116
+ owner: context.repo.owner,
117
+ repo: context.repo.repo,
118
+ });
119
+
120
+ if (caches.data) {
121
+ console.log(`Found ${caches.data.actions_caches.length} caches.`);
122
+ console.log(caches.data.actions_caches.map(cache => cache.key));
123
+ // Filter caches matching the specified pattern
124
+ const matchingCaches = caches.data.actions_caches.filter(cache =>
125
+ cache.key.startsWith(cacheKeysPattern)
126
+ );
127
+
128
+ // Delete matching caches
129
+ for (const cache of matchingCaches) {
130
+ /*
131
+ await github.rest.actions.deleteActionsCacheById({
132
+ owner: context.repo.owner,
133
+ repo: context.repo.repo,
134
+ cache_id: cache.id
135
+ });
136
+ */
137
+ console.log(`Deleted cache with key: ${cache.key}`);
138
+ }
139
+
140
+ console.log(`Deleted ${matchingCaches.length} caches.`);
141
+ }
0 commit comments