Skip to content

Commit 12afe13

Browse files
committed
test
1 parent ca8f1ff commit 12afe13

File tree

5 files changed

+46
-29
lines changed

5 files changed

+46
-29
lines changed

.github/workflows/build_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
type: ['validation', 'performance']
1717
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
1818
env:
19-
build-cache-key: tests-bin-${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
19+
id: ${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
2020
steps:
2121
- name: Check if already built
2222
if: ${{ github.event.pull_request.number != null }}
2323
id: cache-build-binaries
2424
uses: actions/cache/restore@v4
2525
with:
2626
lookup-only: true
27-
key: ${{ env.build-cache-key }}
27+
key: tests-bin-${{ env.id }}
2828
path: |
2929
~/.arduino/tests/**/build*.tmp/*.bin
3030
~/.arduino/tests/**/build*.tmp/*.elf
@@ -72,7 +72,7 @@ jobs:
7272
uses: actions/cache/save@v4
7373
if: ${{ steps.check-build.outputs.enabled == 'true' }}
7474
with:
75-
key: ${{ env.build-cache-key }}
75+
key: tests-bin-${{ env.id }}
7676
path: |
7777
~/.arduino/tests/**/build*.tmp/*.bin
7878
~/.arduino/tests/**/build*.tmp/*.elf

.github/workflows/clean.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ jobs:
1313
with:
1414
script: |
1515
const ref = "${{ github.event.pull_request.number || github.ref }}";
16-
const cacheKeysPattern = `tests-${ref}-*`;
16+
const cacheKeysPattern = `tests-bin-${ref}-*`;
17+
18+
console.log(`Deleting caches matching pattern: ${cacheKeysPattern}`);
1719
1820
const { listForRepo } = require("@octokit/plugin-paginate-rest");
1921
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
@@ -26,7 +28,7 @@ jobs:
2628
2729
// Filter caches matching the specified pattern
2830
const matchingCaches = caches.data.actions_caches.filter(cache =>
29-
cache.key.startsWith(`tests-${ref}-`)
31+
cache.key.startsWith(cacheKeysPattern)
3032
);
3133
3234
// Delete matching caches

.github/workflows/hw.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
type: ['validation', 'performance']
1818
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
1919
env:
20-
cache-binaries-key: tests-bin-${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
21-
cache-results-key: tests-hw-${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
20+
id: ${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
2221
container:
2322
image: python:3.10.1-bullseye
2423
options: --privileged
@@ -29,7 +28,7 @@ jobs:
2928
uses: actions/cache/restore@v4
3029
with:
3130
lookup-only: true
32-
key: ${{ env.cache-results-key }}
31+
key: tests-hw-${{ env.id}}
3332
path: |
3433
tests/**/*.xml
3534
tests/**/result_*.json
@@ -67,7 +66,7 @@ jobs:
6766
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
6867
with:
6968
fail-on-cache-miss: true
70-
key: ${{ env.cache-binaries-key }}
69+
key: tests-bin-${{ env.id }}
7170
path: |
7271
~/.arduino/tests/**/build*.tmp/*.bin
7372
~/.arduino/tests/**/build*.tmp/*.elf
@@ -100,7 +99,7 @@ jobs:
10099
uses: actions/cache/save@v4
101100
if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
102101
with:
103-
key: ${{ env.cache-results-key }}
102+
key: tests-hw-${{ env.id }}
104103
path: |
105104
tests/**/*.xml
106105
tests/**/result_*.json

.github/workflows/tests.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ jobs:
2222
name: Run tests on hardware
2323
uses: ./.github/workflows/hw.yml
2424
needs: call-build-tests
25-
if: false
26-
#if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
25+
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
2726

28-
# call-wokwi-tests:
29-
# uses: ./.github/workflows/wokwi.yml
30-
# needs: call-build-tests
31-
# secrets:
32-
# WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
27+
call-wokwi-tests:
28+
uses: ./.github/workflows/wokwi.yml
29+
needs: call-build-tests
30+
secrets:
31+
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
3332

3433
# call-qemu-tests:
3534
# uses: espressif/arduino-esp32/.github/workflows/qemu.yml@master
@@ -46,8 +45,8 @@ jobs:
4645

4746
call-clean:
4847
name: Clean objects
49-
needs: [call-hardware-tests]
48+
needs: [call-build-tests, call-hardware-tests, call-wokwi-tests]
5049
uses: ./.github/workflows/clean.yml
51-
if: github.event_name != 'pull_request' || github.event.action == 'closed'
50+
if: always() && (github.event_name != 'pull_request' || github.event.action == 'closed')
5251
permissions:
5352
actions: write

.github/workflows/wokwi.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,68 @@ jobs:
1919
matrix:
2020
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
2121
type: ['validation']
22+
env:
23+
id: ${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
2224
runs-on: ubuntu-latest
2325
steps:
2426
- name: Check if already run
2527
if: ${{ github.event.pull_request.number != null }}
26-
id: cache-results
28+
id: get-cache-results
2729
uses: actions/cache/restore@v4
2830
with:
2931
lookup-only: true
30-
key: wokwi_results-${{ github.event.pull_request.number }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha }}
32+
key: tests-wokwi-${{ env.id }}
3133
path: tests/**/*.xml
3234

35+
- name: Evaluate if tests should be run
36+
id: check-tests
37+
run: |
38+
cache_exists=${{ steps.get-cache-results.outputs.cache-hit == 'true' || false }}
39+
enabled=true
40+
41+
if [[ $cache_exists == 'true' ]]; then
42+
echo "Already ran, skipping"
43+
enabled=false
44+
fi
45+
46+
echo "enabled=$enabled" >> $GITHUB_OUTPUT
47+
3348
- name: Get binaries
49+
if: steps.check-tests.outputs.enabled == 'true'
3450
id: cache-build-binaries
3551
uses: actions/cache/restore@v4
3652
with:
3753
fail-on-cache-miss: true
38-
key: tests-${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
54+
key: tests-bin-${{ env.id }}
3955
path: |
4056
~/.arduino/tests/**/build*.tmp/*.bin
4157
~/.arduino/tests/**/build*.tmp/*.elf
4258
~/.arduino/tests/**/build*.tmp/*.json
4359
4460
- uses: actions/setup-python@v5
61+
if: steps.check-tests.outputs.enabled == 'true'
4562
with:
4663
cache: 'pip'
47-
python-version: '3.10'
64+
python-version: '3.x'
4865

4966
- name: Install Wokwi CLI
67+
if: steps.check-tests.outputs.enabled == 'true'
5068
run: curl -L https://wokwi.com/ci/install.sh | sh
5169

5270
- name: Install dependencies
71+
if: steps.check-tests.outputs.enabled == 'true'
5372
run: |
5473
pip install -U pip
5574
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
5675
5776
- name: Run Tests
77+
if: steps.check-tests.outputs.enabled == 'true'
5878
run: |
5979
bash .github/scripts/tests_run.sh -c -t ${{matrix.chip}} -i 0 -m 1 -W ${{env.WOKWI_TIMEOUT}}
6080
6181
- name: Upload ${{ matrix.chip }}-${{ matrix.type }} binaries as cache
82+
if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
6283
uses: actions/cache/save@v4
63-
if: ${{ steps.check-build.outputs.enabled == 'true' }}
6484
with:
65-
key: tests-${{ github.event.pull_request.number || github.ref }}-${{ matrix.chip }}-${{ matrix.type }}-${{ github.event.pull_request.head.sha || github.sha }}
66-
path: |
67-
~/.arduino/tests/**/build*.tmp/*.bin
68-
~/.arduino/tests/**/build*.tmp/*.elf
69-
~/.arduino/tests/**/build*.tmp/*.json
85+
key: ${{ env.id }}
86+
path: tests/**/*.xml

0 commit comments

Comments
 (0)