Skip to content

Commit 66c0409

Browse files
committed
Merge branch 'master' into ci/tests_refactor
2 parents b6d83ab + 674a17d commit 66c0409

File tree

2 files changed

+68
-36
lines changed

2 files changed

+68
-36
lines changed

.github/workflows/qemu.yml

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,54 @@ on:
99
type:
1010
required: true
1111
type: string
12-
ref:
13-
required: true
14-
type: string
1512

1613
concurrency:
17-
group: qemu-${{ inputs.ref }}-${{ inputs.chip }}-${{ inputs.type }}
14+
group: qemu-${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}
1815
cancel-in-progress: true
1916

2017
env:
2118
QEMU_INSTALL_PATH: "$HOME"
2219

2320
jobs:
2421
qemu-test:
25-
name: ${{ inputs.chip }} - QEMU ${{ inputs.type }} tests
22+
name: QEMU ${{ inputs.chip }} ${{ inputs.type }} tests
23+
env:
24+
id: ${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}-${{ github.event.pull_request.head.sha || github.sha }}
2625
runs-on: ubuntu-latest
2726
steps:
27+
- name: Check if already run
28+
if: ${{ github.event.pull_request.number != null }}
29+
id: get-cache-results
30+
uses: actions/cache/restore@v4
31+
with:
32+
lookup-only: true
33+
key: tests-qemu-${{ env.id }}
34+
path: |
35+
tests/**/*.xml
36+
tests/**/result_*.json
37+
38+
- name: Evaluate if tests should be run
39+
id: check-tests
40+
run: |
41+
cache_exists=${{ steps.get-cache-results.outputs.cache-hit == 'true' || false }}
42+
enabled=true
43+
44+
if [[ $cache_exists == 'true' ]]; then
45+
echo "Already ran, skipping"
46+
enabled=false
47+
fi
48+
49+
echo "enabled=$enabled" >> $GITHUB_OUTPUT
50+
2851
- name: Checkout repository
2952
uses: actions/checkout@v4
53+
if: steps.check-tests.outputs.enabled == 'true'
54+
with:
55+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3056

3157
- name: Get QEMU version
3258
uses: pozetroninc/[email protected]
59+
if: steps.check-tests.outputs.enabled == 'true'
3360
id: get-qemu-version
3461
with:
3562
token: ${{secrets.GITHUB_TOKEN}}
@@ -40,6 +67,7 @@ jobs:
4067
- name: Cache tools
4168
id: cache-linux
4269
uses: actions/cache@v4
70+
if: steps.check-tests.outputs.enabled == 'true'
4371
with:
4472
path: |
4573
~/qemu
@@ -49,13 +77,14 @@ jobs:
4977
'.github/workflows/tests.yml') }}
5078

5179
- name: Install dependencies
80+
if: steps.check-tests.outputs.enabled == 'true'
5281
run: |
5382
pip install -U pip
5483
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
5584
sudo apt update && sudo apt install libpixman-1-0 libnuma1 libglib2.0-0 libslirp0 libsdl2-2.0-0
5685
5786
- name: Download QEMU
58-
if: steps.cache-linux.outputs.cache-hit != 'true'
87+
if: steps.cache-linux.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true'
5988
run: |
6089
cd ${{ env.QEMU_INSTALL_PATH }}
6190
underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g')
@@ -66,22 +95,27 @@ jobs:
6695
rm qemu-*
6796
echo "QEMU_PATH=${{ env.QEMU_INSTALL_PATH }}/qemu" >> $GITHUB_ENV
6897
69-
- name: Download ${{inputs.chip}}-${{inputs.type}} artifacts
70-
uses: actions/download-artifact@v4
98+
- name: Get binaries
99+
if: steps.check-tests.outputs.enabled == 'true'
100+
id: cache-build-binaries
101+
uses: actions/cache/restore@v4
71102
with:
72-
name: ${{inputs.chip}}-${{inputs.type}}.artifacts
73-
path: ~/
103+
fail-on-cache-miss: true
104+
key: tests-bin-${{ env.id }}
105+
path: |
106+
~/.arduino/tests/**/build*.tmp/*.bin
107+
~/.arduino/tests/**/build*.tmp/*.elf
108+
~/.arduino/tests/**/build*.tmp/*.json
74109
75110
- name: Run Tests
76-
run: QEMU_PATH="${{env.QEMU_PATH}}" bash .github/scripts/tests_run.sh -c -type ${{inputs.type}} -t ${{inputs.chip}} -Q
77-
111+
if: steps.check-tests.outputs.enabled == 'true'
112+
run: QEMU_PATH="${{ env.QEMU_INSTALL_PATH }}" bash .github/scripts/tests_run.sh -c -type ${{inputs.type}} -t ${{inputs.chip}} -i 0 -m 1 -Q
78113

79-
- name: Upload test result artifacts
80-
uses: actions/upload-artifact@v4
81-
if: ${{ always() }}
114+
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} QEMU results as cache
115+
uses: actions/cache/save@v4
116+
if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
82117
with:
83-
name: qemu_results-${{inputs.chip}}-${{inputs.type}}}
84-
if-no-files-found: error
118+
key: tests-qemu-${{ env.id }}
85119
path: |
86120
tests/**/*.xml
87121
tests/**/result_*.json

.github/workflows/tests.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ jobs:
5151
name: Build tests
5252
uses: ./.github/workflows/build_tests.yml
5353
needs: gen-matrix
54-
#if: github.event.action != 'closed'
55-
if: false
54+
if: github.event.action != 'closed'
5655
strategy:
5756
matrix:
5857
type: ${{ fromJson(needs.gen-matrix.outputs.build-types) }}
@@ -65,8 +64,7 @@ jobs:
6564
name: Run tests on hardware
6665
uses: ./.github/workflows/hw.yml
6766
needs: [gen-matrix, call-build-tests]
68-
#if: ${{ github.event_name != 'pull_request_target' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
69-
if: false
67+
if: ${{ github.event_name != 'pull_request_target' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
7068
strategy:
7169
fail-fast: false
7270
matrix:
@@ -80,8 +78,7 @@ jobs:
8078
name: Run tests on Wokwi
8179
uses: ./.github/workflows/wokwi.yml
8280
needs: [gen-matrix, call-build-tests]
83-
#if: github.event.action != 'closed'
84-
if: false
81+
if: github.event.action != 'closed'
8582
strategy:
8683
fail-fast: false
8784
matrix:
@@ -93,22 +90,23 @@ jobs:
9390
type: ${{ matrix.type }}
9491
chip: ${{ matrix.chip }}
9592

96-
# call-qemu-tests:
97-
# uses: ./.github/workflows/qemu.yml@master
98-
# needs: [gen-matrix, call-build-tests]
99-
# if: false
100-
# strategy:
101-
# fail-fast: false
102-
# matrix:
103-
# type: ${{ fromJson(needs.gen-matrix.outputs.qemu-types) }}
104-
# chip: ['esp32', 'esp32c3']
105-
# with:
106-
# type: ${{ matrix.type }}
107-
# chip: ${{ matrix.chip }}
93+
# This job is disabled for now
94+
call-qemu-tests:
95+
uses: ./.github/workflows/qemu.yml
96+
needs: [gen-matrix, call-build-tests]
97+
if: false
98+
strategy:
99+
fail-fast: false
100+
matrix:
101+
type: ${{ fromJson(needs.gen-matrix.outputs.qemu-types) }}
102+
chip: ['esp32', 'esp32c3']
103+
with:
104+
type: ${{ matrix.type }}
105+
chip: ${{ matrix.chip }}
108106

109107
clean:
110108
name: Clean objects
111-
needs: [call-hardware-tests, call-wokwi-tests]
109+
needs: [call-hardware-tests, call-wokwi-tests, call-qemu-tests]
112110
if: always()
113111
permissions:
114112
actions: write

0 commit comments

Comments
 (0)