Skip to content

Commit c2ba441

Browse files
committed
Merge branch 'ci/remove_target'
2 parents cbf1e94 + ec136e0 commit c2ba441

File tree

5 files changed

+173
-156
lines changed

5 files changed

+173
-156
lines changed

.github/workflows/build_tests.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,6 @@ jobs:
4646
- name: Checkout user repository
4747
if: ${{ steps.check-build.outputs.enabled == 'true' }}
4848
uses: actions/checkout@v4
49-
with:
50-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
51-
persist-credentials: false
52-
sparse-checkout-cone-mode: false
53-
sparse-checkout: |
54-
/*
55-
!.github
56-
57-
# To avoid giving unknown scripts elevated permissions, download them from the master branch
58-
- name: Get CI scripts from master
59-
if: ${{ steps.check-build.outputs.enabled == 'true' }}
60-
run: |
61-
mkdir -p .github
62-
cd .github
63-
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
6449

6550
- name: Get libs cache
6651
uses: actions/cache@v4

.github/workflows/hw.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,6 @@ jobs:
4848
- name: Checkout user repository
4949
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5050
uses: actions/checkout@v4
51-
with:
52-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
53-
persist-credentials: false
54-
sparse-checkout-cone-mode: false
55-
sparse-checkout: |
56-
/*
57-
!.github
58-
59-
# To avoid giving unknown scripts elevated permissions, download them from the master branch
60-
- name: Get CI scripts from master
61-
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
62-
run: |
63-
mkdir -p .github
64-
cd .github
65-
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
6651

6752
# setup-python currently only works on ubuntu images
6853
# - uses: actions/setup-python@v5

.github/workflows/tests.yml

Lines changed: 53 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Runtime Tests
22

33
on:
44
workflow_dispatch:
5-
pull_request_target:
6-
types: [opened, reopened, closed, synchronize, labeled, unlabeled]
5+
pull_request:
6+
types: [opened, reopened, synchronize, labeled, unlabeled]
77
paths:
88
- 'tests/**'
99
- 'cores/**'
@@ -19,14 +19,19 @@ concurrency:
1919
group: tests-${{ github.event.pull_request.number || github.ref }}
2020
cancel-in-progress: true
2121

22-
# To avoid giving elevated permissions to the entire workflow, specify default permissions at the top level
23-
# and then override them for specific jobs.
24-
permissions: { contents: read }
25-
2622
jobs:
23+
push-event-file:
24+
name: Push event file
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Upload
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: event_file
31+
path: ${{ github.event_path }}
32+
2733
gen-matrix:
2834
name: Generate matrix
29-
if: github.event.action != 'closed'
3035
runs-on: ubuntu-latest
3136
outputs:
3237
build-types: ${{ steps.set-matrix.outputs.build-types }}
@@ -59,9 +64,8 @@ jobs:
5964
6065
call-build-tests:
6166
name: Build
62-
uses: espressif/arduino-esp32/.github/workflows/build_tests.yml@master
67+
uses: ./.github/workflows/build_tests.yml
6368
needs: gen-matrix
64-
if: github.event.action != 'closed'
6569
strategy:
6670
matrix:
6771
type: ${{ fromJson(needs.gen-matrix.outputs.build-types) }}
@@ -72,11 +76,11 @@ jobs:
7276

7377
call-hardware-tests:
7478
name: Hardware
75-
uses: espressif/arduino-esp32/.github/workflows/hw.yml@master
79+
uses: ./.github/workflows/hw.yml
7680
needs: [gen-matrix, call-build-tests]
7781
if: |
7882
github.repository == 'espressif/arduino-esp32' &&
79-
(github.event_name != 'pull_request_target' ||
83+
(github.event_name != 'pull_request' ||
8084
contains(github.event.pull_request.labels.*.name, 'hil_test'))
8185
strategy:
8286
fail-fast: false
@@ -87,26 +91,12 @@ jobs:
8791
type: ${{ matrix.type }}
8892
chip: ${{ matrix.chip }}
8993

90-
call-wokwi-tests:
91-
name: Wokwi
92-
uses: espressif/arduino-esp32/.github/workflows/wokwi.yml@master
93-
needs: [gen-matrix, call-build-tests]
94-
if: github.event.action != 'closed'
95-
strategy:
96-
fail-fast: false
97-
matrix:
98-
type: ${{ fromJson(needs.gen-matrix.outputs.wokwi-types) }}
99-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
100-
secrets:
101-
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
102-
with:
103-
type: ${{ matrix.type }}
104-
chip: ${{ matrix.chip }}
94+
# Wokwi tests are run after this workflow as it needs access to secrets
10595

10696
# This job is disabled for now
10797
call-qemu-tests:
10898
name: QEMU
109-
uses: espressif/arduino-esp32/.github/workflows/qemu.yml@master
99+
uses: ./.github/workflows/qemu.yml
110100
needs: [gen-matrix, call-build-tests]
111101
if: false
112102
strategy:
@@ -118,78 +108,39 @@ jobs:
118108
type: ${{ matrix.type }}
119109
chip: ${{ matrix.chip }}
120110

121-
unit-test-results:
122-
name: Unit Test Results
123-
needs: [call-hardware-tests, call-wokwi-tests, call-qemu-tests]
124-
if: always() && github.event_name == 'pull_request_target'
125-
runs-on: ubuntu-latest
126-
permissions:
127-
checks: write
128-
pull-requests: write
129-
steps:
130-
- name: Download and Extract HW Artifacts
131-
uses: actions/download-artifact@v4
132-
continue-on-error: true
133-
with:
134-
merge-multiple: true
135-
pattern: tests-results-hw-*
136-
path: ./results/hw
137-
138-
- name: Download and Extract Wokwi Artifacts
139-
uses: actions/download-artifact@v4
140-
continue-on-error: true
141-
with:
142-
merge-multiple: true
143-
pattern: tests-results-wokwi-*
144-
path: ./results/wokwi
145-
146-
- name: Download and Extract QEMU Artifacts
147-
uses: actions/download-artifact@v4
148-
continue-on-error: true
149-
with:
150-
merge-multiple: true
151-
pattern: tests-results-qemu-*
152-
path: ./results/qemu
153-
154-
- name: Publish Unit Test Results
155-
uses: EnricoMi/publish-unit-test-result-action@v2
156-
with:
157-
commit: ${{ github.event.pull_request.head.sha || github.sha }}
158-
files: ./results/**/*.xml
159-
clean:
160-
name: Clean objects
161-
needs: unit-test-results
162-
if: always()
163-
permissions:
164-
actions: write
165-
runs-on: ubuntu-latest
166-
steps:
167-
- name: Clean up caches
168-
uses: actions/github-script@v7
169-
with:
170-
script: |
171-
const ref = '${{ github.event.pull_request.number || github.ref }}';
172-
const key_prefix = 'tests-' + ref + '-';
173-
174-
if ('${{ github.event_name }}' == 'pull_request_target' && '${{ github.event.action }}' != 'closed') {
175-
console.log('Skipping cache cleanup for open PR');
176-
return;
177-
}
178-
179-
await github.paginate(github.rest.actions.getActionsCacheList, {
180-
owner: context.repo.owner,
181-
repo: context.repo.repo,
182-
per_page: 100,
183-
key: key_prefix
184-
}).then(caches => {
185-
if (caches) {
186-
for (const cache of caches) {
187-
console.log(`Deleting cache: ${cache.key}`);
188-
github.rest.actions.deleteActionsCacheById({
189-
owner: context.repo.owner,
190-
repo: context.repo.repo,
191-
cache_id: cache.id
192-
});
193-
}
194-
}
195-
});
111+
# clean:
112+
# name: Clean objects
113+
# if: always()
114+
# permissions:
115+
# actions: write
116+
# runs-on: ubuntu-latest
117+
# steps:
118+
# - name: Clean up caches
119+
# uses: actions/github-script@v7
120+
# with:
121+
# script: |
122+
# const ref = '${{ github.event.pull_request.number || github.ref }}';
123+
# const key_prefix = 'tests-' + ref + '-';
124+
125+
# if ('${{ github.event_name }}' == 'pull_request_target' && '${{ github.event.action }}' != 'closed') {
126+
# console.log('Skipping cache cleanup for open PR');
127+
# return;
128+
# }
129+
130+
# await github.paginate(github.rest.actions.getActionsCacheList, {
131+
# owner: context.repo.owner,
132+
# repo: context.repo.repo,
133+
# per_page: 100,
134+
# key: key_prefix
135+
# }).then(caches => {
136+
# if (caches) {
137+
# for (const cache of caches) {
138+
# console.log(`Deleting cache: ${cache.key}`);
139+
# github.rest.actions.deleteActionsCacheById({
140+
# owner: context.repo.owner,
141+
# repo: context.repo.repo,
142+
# cache_id: cache.id
143+
# });
144+
# }
145+
# }
146+
# });

.github/workflows/tests_publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish test results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Wokwi tests"]
6+
types:
7+
- completed
8+
9+
# No permissions by default
10+
permissions: {}
11+
12+
jobs:
13+
unit-test-results:
14+
name: Unit Test Results
15+
if: github.event.workflow_run.conclusion != 'skipped'
16+
runs-on: ubuntu-latest
17+
permissions:
18+
actions: read
19+
checks: write
20+
pull-requests: write
21+
steps:
22+
- name: Print info
23+
run: |
24+
echo "Event: ${{ github.event.workflow_run.event }}"
25+
echo "Conclusion: ${{ github.event.workflow_run.conclusion }}"
26+
echo "Status: ${{ github.event.workflow_run.status }}"
27+
echo "Head SHA: ${{ github.event.workflow_run.head_sha }}"
28+
echo "Parent Run ID: ${{ github.event.workflow_run.id }}"
29+
echo "Run Number: ${{ github.run_number }}"
30+
echo "Run ID: ${{ github.run_id }}"
31+
echo "Ref: ${{ github.ref }}"
32+
33+
- name: Download and Extract Artifacts
34+
uses: dawidd6/action-download-artifact@v6
35+
with:
36+
workflow: tests.yml
37+
commit: ${{ github.event.workflow_run.head_sha }}
38+
path: ./artifacts
39+
40+
- name: Download and Extract Wokwi Results
41+
uses: dawidd6/action-download-artifact@v6
42+
with:
43+
run_id: ${{ github.event.workflow_run.id }}
44+
path: ./artifacts
45+
46+
- name: Publish Unit Test Results
47+
uses: EnricoMi/publish-unit-test-result-action@v2
48+
with:
49+
commit: ${{ github.event.workflow_run.head_sha }}
50+
event_file: ./artifacts/Event File/event.json
51+
event_name: ${{ github.event.workflow_run.event }}
52+
files: ./artifacts/**/*.xml

0 commit comments

Comments
 (0)