Skip to content

Commit 94c17e5

Browse files
authored
Merge branch 'master' into master
2 parents 5eda2d1 + e382746 commit 94c17e5

File tree

26 files changed

+308
-98
lines changed

26 files changed

+308
-98
lines changed

Diff for: .github/scripts/tests_run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function run_test() {
101101
fi
102102
fi
103103
done
104-
printf "\n"
104+
printf "Test return code: $error\n"
105105
return $error
106106
}
107107

@@ -250,6 +250,7 @@ else
250250

251251
exit_code=0
252252
run_test $target $sketch $options $erase || exit_code=$?
253+
echo "Sketch $sketch exit code: $exit_code"
253254
if [ $exit_code -ne 0 ]; then
254255
error=$exit_code
255256
fi

Diff for: .github/workflows/build_tests.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
description: 'Chip to build tests for'
1313
required: true
1414

15-
concurrency:
16-
group: tests-build-${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}
17-
cancel-in-progress: true
18-
1915
jobs:
2016
build-tests:
2117
name: Build ${{ inputs.type }} tests for ${{ inputs.chip }}
@@ -47,11 +43,24 @@ jobs:
4743
4844
echo "enabled=$enabled" >> $GITHUB_OUTPUT
4945
50-
- name: Checkout Repository
51-
uses: actions/checkout@v4
46+
- name: Checkout user repository
5247
if: ${{ steps.check-build.outputs.enabled == 'true' }}
48+
uses: actions/checkout@v4
5349
with:
5450
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
5564
5665
- name: Get libs cache
5766
uses: actions/cache@v4

Diff for: .github/workflows/hw.yml

+21-11
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
description: 'Chip to run tests for'
1313
required: true
1414

15-
concurrency:
16-
group: tests-hw-${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}
17-
cancel-in-progress: true
18-
1915
jobs:
2016
hardware-test:
2117
name: Hardware ${{ inputs.chip }} ${{ inputs.type }} tests
@@ -49,18 +45,32 @@ jobs:
4945
5046
echo "enabled=$enabled" >> $GITHUB_OUTPUT
5147
52-
- name: Checkout repository
48+
- name: Checkout user repository
5349
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5450
uses: actions/checkout@v4
5551
with:
5652
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
5758
58-
- uses: actions/setup-python@v5
59-
if: steps.check-tests.outputs.enabled == 'true'
60-
with:
61-
cache-dependency-path: tests/requirements.txt
62-
cache: 'pip'
63-
python-version: '3.10.1'
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
66+
67+
# setup-python currently only works on ubuntu images
68+
# - uses: actions/setup-python@v5
69+
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}
70+
# with:
71+
# cache-dependency-path: tests/requirements.txt
72+
# cache: 'pip'
73+
# python-version: '3.10.1'
6474

6575
- name: Install dependencies
6676
if: ${{ steps.check-tests.outputs.enabled == 'true' }}

Diff for: .github/workflows/pre-commit.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
- name: Set up Python 3
2929
uses: actions/setup-python@v5
3030
with:
31+
cache-dependency-path: tools/pre-commit/requirements.txt
32+
cache: 'pip'
3133
python-version: "3.x"
3234

3335
- name: Get Python version hash
@@ -41,11 +43,10 @@ jobs:
4143
with:
4244
path: |
4345
~/.cache/pre-commit
44-
~/.cache/pip
45-
key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
46+
key: pre-commit-${{ env.PY_HASH }}-${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml', 'tools/pre-commit/requirements.txt') }}
4647

4748
- name: Install python dependencies
48-
run: python -m pip install pre-commit docutils
49+
run: python -m pip install -r tools/pre-commit/requirements.txt
4950

5051
- name: Get changed files
5152
id: changed-files
@@ -61,7 +62,6 @@ jobs:
6162
with:
6263
path: |
6364
~/.cache/pre-commit
64-
~/.cache/pip
6565
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
6666

6767
- name: Push changes using pre-commit-ci-lite

Diff for: .github/workflows/push.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
runs-on: ubuntu-latest
4949
outputs:
5050
build_all: ${{ steps.set-chunks.outputs.build_all }}
51+
build_libraries: ${{ steps.set-chunks.outputs.build_libraries }}
5152
build_static_sketches: ${{ steps.set-chunks.outputs.build_static_sketches }}
5253
build_idf: ${{ steps.set-chunks.outputs.build_idf }}
5354
build_platformio: ${{ steps.set-chunks.outputs.build_platformio }}
@@ -103,6 +104,7 @@ jobs:
103104
104105
build_platformio=${{ steps.changed-files.outputs.platformio_any_changed == 'true' }}
105106
build_idf=${{ steps.changed-files.outputs.idf_any_changed == 'true' }}
107+
build_libraries=${{ steps.changed-files.outputs.libraries_any_changed == 'true' }}
106108
build_static_sketches=${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }}
107109
108110
core_changed=${{ steps.changed-files.outputs.core_any_changed == 'true' }}
@@ -136,9 +138,6 @@ jobs:
136138
fi
137139
echo ""
138140
done
139-
else
140-
echo "Unhandled change triggered the build. This should not happen."
141-
exit 1
142141
fi
143142
144143
if [[ -n $sketches ]]; then
@@ -164,14 +163,15 @@ jobs:
164163
chunks+="]"
165164
166165
echo "build_all=$build_all" >> $GITHUB_OUTPUT
166+
echo "build_libraries=$build_libraries" >> $GITHUB_OUTPUT
167167
echo "build_static_sketches=$build_static_sketches" >> $GITHUB_OUTPUT
168168
echo "build_idf=$build_idf" >> $GITHUB_OUTPUT
169169
echo "build_platformio=$build_platformio" >> $GITHUB_OUTPUT
170170
echo "chunk_count=$chunks_count" >> $GITHUB_OUTPUT
171171
echo "chunks=$chunks" >> $GITHUB_OUTPUT
172172
173173
- name: Upload sketches found
174-
if: ${{ steps.set-chunks.outputs.build_all == 'false' }}
174+
if: ${{ steps.set-chunks.outputs.build_all == 'false' && steps.set-chunks.outputs.build_libraries == 'true' }}
175175
uses: actions/upload-artifact@v4
176176
with:
177177
name: sketches_found
@@ -182,6 +182,7 @@ jobs:
182182
# Ubuntu
183183
build-arduino-linux:
184184
name: Arduino ${{ matrix.chunk }} on ubuntu-latest
185+
if: ${{ needs.gen-chunks.outputs.build_all == 'true' || needs.gen-chunks.outputs.build_libraries == 'true' }}
185186
needs: gen-chunks
186187
runs-on: ubuntu-latest
187188
strategy:
@@ -213,13 +214,13 @@ jobs:
213214
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} ${{ env.MAX_CHUNKS }} 1
214215

215216
- name: Download sketches found
216-
if: ${{ needs.gen-chunks.outputs.build_all == 'false' }}
217+
if: ${{ needs.gen-chunks.outputs.build_all == 'false' && needs.gen-chunks.outputs.build_libraries == 'true' }}
217218
uses: actions/download-artifact@v4
218219
with:
219220
name: sketches_found
220221

221222
- name: Build selected sketches
222-
if: ${{ needs.gen-chunks.outputs.build_all == 'false' }}
223+
if: ${{ needs.gen-chunks.outputs.build_all == 'false' && needs.gen-chunks.outputs.build_libraries == 'true' }}
223224
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} ${{ needs.gen-chunks.outputs.chunk_count }} 1 sketches_found.txt
224225

225226
#Upload cli compile json as artifact
@@ -274,7 +275,10 @@ jobs:
274275
build-esp-idf-component:
275276
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
276277
needs: gen-chunks
277-
if: ${{ needs.gen-chunks.outputs.build_all == 'true' || needs.gen-chunks.outputs.build_idf == 'true' }}
278+
if: |
279+
needs.gen-chunks.outputs.build_all == 'true' ||
280+
needs.gen-chunks.outputs.build_libraries == 'true' ||
281+
needs.gen-chunks.outputs.build_idf == 'true'
278282
runs-on: ubuntu-20.04
279283
strategy:
280284
fail-fast: false

Diff for: .github/workflows/qemu.yml

+23-14
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ on:
1010
required: true
1111
type: string
1212

13-
concurrency:
14-
group: qemu-${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}
15-
cancel-in-progress: true
16-
1713
jobs:
1814
qemu-test:
1915
name: QEMU ${{ inputs.chip }} ${{ inputs.type }} tests
@@ -45,35 +41,48 @@ jobs:
4541
4642
echo "enabled=$enabled" >> $GITHUB_OUTPUT
4743
48-
- name: Checkout repository
44+
- name: Checkout user repository
45+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
4946
uses: actions/checkout@v4
50-
if: steps.check-tests.outputs.enabled == 'true'
5147
with:
5248
ref: ${{ github.event.pull_request.head.sha || github.sha }}
49+
persist-credentials: false
50+
sparse-checkout-cone-mode: false
51+
sparse-checkout: |
52+
/*
53+
!.github
54+
55+
# To avoid giving unknown scripts elevated permissions, download them from the master branch
56+
- name: Get CI scripts from master
57+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
58+
run: |
59+
mkdir -p .github
60+
cd .github
61+
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
5362
5463
- uses: actions/setup-python@v5
55-
if: steps.check-tests.outputs.enabled == 'true'
64+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5665
with:
5766
cache-dependency-path: tests/requirements.txt
5867
cache: 'pip'
5968
python-version: '3.x'
6069

6170
- name: Install Python dependencies
62-
if: steps.check-tests.outputs.enabled == 'true'
71+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
6372
run: |
6473
pip install -U pip
6574
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
6675
6776
- name: Install APT dependencies
6877
uses: awalsh128/[email protected]
69-
if: steps.check-tests.outputs.enabled == 'true'
78+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
7079
with:
7180
packages: libpixman-1-0 libnuma1 libglib2.0-0 libslirp0 libsdl2-2.0-0
7281
version: 1.0
7382

7483
- name: Get QEMU version
7584
uses: pozetroninc/[email protected]
76-
if: steps.check-tests.outputs.enabled == 'true'
85+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
7786
id: get-qemu-version
7887
with:
7988
token: ${{secrets.GITHUB_TOKEN}}
@@ -84,14 +93,14 @@ jobs:
8493
- name: Cache QEMU
8594
id: cache-qemu
8695
uses: actions/cache@v4
87-
if: steps.check-tests.outputs.enabled == 'true'
96+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
8897
with:
8998
path: |
9099
~/qemu
91100
key: qemu-${{ steps.get-qemu-version.outputs.release }}-${{ hashFiles('.github/workflows/qemu.yml') }}
92101

93102
- name: Download QEMU
94-
if: steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true'
103+
if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true' }}
95104
run: |
96105
cd ${{ env.QEMU_INSTALL_PATH }}
97106
underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g')
@@ -103,7 +112,7 @@ jobs:
103112
echo "QEMU_PATH=${{ env.QEMU_INSTALL_PATH }}/qemu" >> $GITHUB_ENV
104113
105114
- name: Get binaries
106-
if: steps.check-tests.outputs.enabled == 'true'
115+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
107116
id: cache-build-binaries
108117
uses: actions/cache/restore@v4
109118
with:
@@ -115,7 +124,7 @@ jobs:
115124
~/.arduino/tests/**/build*.tmp/*.json
116125
117126
- name: Run Tests
118-
if: steps.check-tests.outputs.enabled == 'true'
127+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
119128
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
120129

121130
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} QEMU results as cache

Diff for: .github/workflows/tests.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ on:
1212
- '!libraries/**.txt'
1313
- '!libraries/**.properties'
1414
- 'package/**'
15-
- '.github/workflows/tests.yml'
16-
- '.github/workflows/build_tests.yml'
17-
- '.github/workflows/hw.yml'
18-
- '.github/workflows/wokwi.yml'
19-
- '.github/workflows/qemu.yml'
20-
- '.github/scripts/install-*.sh'
21-
- '.github/scripts/tests_*.sh'
22-
- '.github/scripts/sketch_utils.sh'
2315
schedule:
2416
- cron: '0 2 * * *'
2517

@@ -167,7 +159,7 @@ jobs:
167159
clean:
168160
name: Clean objects
169161
needs: unit-test-results
170-
if: always() && ${{ github.event_name }} == 'pull_request_target' && ${{ github.event.action }} != 'closed'
162+
if: always()
171163
permissions:
172164
actions: write
173165
runs-on: ubuntu-latest
@@ -179,6 +171,11 @@ jobs:
179171
const ref = '${{ github.event.pull_request.number || github.ref }}';
180172
const key_prefix = 'tests-' + ref + '-';
181173
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+
182179
await github.paginate(github.rest.actions.getActionsCacheList, {
183180
owner: context.repo.owner,
184181
repo: context.repo.repo,

0 commit comments

Comments
 (0)