Skip to content

Commit ad27a17

Browse files
authored
Merge branch 'master' into sdmmc_raw
2 parents 83ff659 + e3fedc5 commit ad27a17

File tree

12 files changed

+359
-65
lines changed

12 files changed

+359
-65
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-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,24 @@ jobs:
4747
4848
echo "enabled=$enabled" >> $GITHUB_OUTPUT
4949
50-
- name: Checkout Repository
51-
uses: actions/checkout@v4
50+
- name: Checkout user repository
5251
if: ${{ steps.check-build.outputs.enabled == 'true' }}
52+
uses: actions/checkout@v4
5353
with:
5454
ref: ${{ github.event.pull_request.head.sha || github.sha }}
55+
persist-credentials: false
56+
sparse-checkout-cone-mode: false
57+
sparse-checkout: |
58+
/*
59+
!.github
60+
61+
# To avoid giving unknown scripts elevated permissions, download them from the master branch
62+
- name: Get CI scripts from master
63+
if: ${{ steps.check-build.outputs.enabled == 'true' }}
64+
run: |
65+
mkdir -p .github
66+
cd .github
67+
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
5568
5669
- name: Get libs cache
5770
uses: actions/cache@v4

Diff for: .github/workflows/hw.yml

+21-7
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,32 @@ jobs:
4949
5050
echo "enabled=$enabled" >> $GITHUB_OUTPUT
5151
52-
- name: Checkout repository
52+
- name: Checkout user repository
5353
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5454
uses: actions/checkout@v4
5555
with:
5656
ref: ${{ github.event.pull_request.head.sha || github.sha }}
57+
persist-credentials: false
58+
sparse-checkout-cone-mode: false
59+
sparse-checkout: |
60+
/*
61+
!.github
5762
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'
63+
# To avoid giving unknown scripts elevated permissions, download them from the master branch
64+
- name: Get CI scripts from master
65+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
66+
run: |
67+
mkdir -p .github
68+
cd .github
69+
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
70+
71+
# setup-python currently only works on ubuntu images
72+
# - uses: actions/setup-python@v5
73+
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}
74+
# with:
75+
# cache-dependency-path: tests/requirements.txt
76+
# cache: 'pip'
77+
# python-version: '3.10.1'
6478

6579
- name: Install dependencies
6680
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

+8-4
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,6 +163,7 @@ 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
@@ -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:
@@ -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-10
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,48 @@ jobs:
4545
4646
echo "enabled=$enabled" >> $GITHUB_OUTPUT
4747
48-
- name: Checkout repository
48+
- name: Checkout user repository
49+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
4950
uses: actions/checkout@v4
50-
if: steps.check-tests.outputs.enabled == 'true'
5151
with:
5252
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
5366
5467
- uses: actions/setup-python@v5
55-
if: steps.check-tests.outputs.enabled == 'true'
68+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5669
with:
5770
cache-dependency-path: tests/requirements.txt
5871
cache: 'pip'
5972
python-version: '3.x'
6073

6174
- name: Install Python dependencies
62-
if: steps.check-tests.outputs.enabled == 'true'
75+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
6376
run: |
6477
pip install -U pip
6578
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
6679
6780
- name: Install APT dependencies
6881
uses: awalsh128/[email protected]
69-
if: steps.check-tests.outputs.enabled == 'true'
82+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
7083
with:
7184
packages: libpixman-1-0 libnuma1 libglib2.0-0 libslirp0 libsdl2-2.0-0
7285
version: 1.0
7386

7487
- name: Get QEMU version
7588
uses: pozetroninc/[email protected]
76-
if: steps.check-tests.outputs.enabled == 'true'
89+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
7790
id: get-qemu-version
7891
with:
7992
token: ${{secrets.GITHUB_TOKEN}}
@@ -84,14 +97,14 @@ jobs:
8497
- name: Cache QEMU
8598
id: cache-qemu
8699
uses: actions/cache@v4
87-
if: steps.check-tests.outputs.enabled == 'true'
100+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
88101
with:
89102
path: |
90103
~/qemu
91104
key: qemu-${{ steps.get-qemu-version.outputs.release }}-${{ hashFiles('.github/workflows/qemu.yml') }}
92105

93106
- name: Download QEMU
94-
if: steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true'
107+
if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true' }}
95108
run: |
96109
cd ${{ env.QEMU_INSTALL_PATH }}
97110
underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g')
@@ -103,7 +116,7 @@ jobs:
103116
echo "QEMU_PATH=${{ env.QEMU_INSTALL_PATH }}/qemu" >> $GITHUB_ENV
104117
105118
- name: Get binaries
106-
if: steps.check-tests.outputs.enabled == 'true'
119+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
107120
id: cache-build-binaries
108121
uses: actions/cache/restore@v4
109122
with:
@@ -115,7 +128,7 @@ jobs:
115128
~/.arduino/tests/**/build*.tmp/*.json
116129
117130
- name: Run Tests
118-
if: steps.check-tests.outputs.enabled == 'true'
131+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
119132
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
120133

121134
- 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)