Skip to content

Commit fbf94b2

Browse files
committed
ci(tests): Run scripts only from master
1 parent 34f6b33 commit fbf94b2

File tree

5 files changed

+74
-30
lines changed

5 files changed

+74
-30
lines changed

.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

.github/workflows/hw.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,28 @@ 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
62+
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
5770
5871
# setup-python currently only works on ubuntu images
5972
# - uses: actions/setup-python@v5
60-
# if: steps.check-tests.outputs.enabled == 'true'
73+
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}
6174
# with:
6275
# cache-dependency-path: tests/requirements.txt
6376
# cache: 'pip'

.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

.github/workflows/tests.yml

-8
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

.github/workflows/wokwi.yml

+21-8
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,48 @@ jobs:
5353
5454
echo "enabled=$enabled" >> $GITHUB_OUTPUT
5555
56-
- name: Checkout Repository
56+
- name: Checkout user repository
57+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5758
uses: actions/checkout@v4
58-
if: steps.check-tests.outputs.enabled == 'true'
5959
with:
6060
ref: ${{ github.event.pull_request.head.sha || github.sha }}
61+
persist-credentials: false
62+
sparse-checkout-cone-mode: false
63+
sparse-checkout: |
64+
/*
65+
!.github
66+
67+
# To avoid giving unknown scripts elevated permissions, download them from the master branch
68+
- name: Get CI scripts from master
69+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
70+
run: |
71+
mkdir -p .github
72+
cd .github
73+
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
6174
6275
- uses: actions/setup-python@v5
63-
if: steps.check-tests.outputs.enabled == 'true'
76+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
6477
with:
6578
cache-dependency-path: tests/requirements.txt
6679
cache: 'pip'
6780
python-version: '3.x'
6881

6982
- name: Install dependencies
70-
if: steps.check-tests.outputs.enabled == 'true'
83+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
7184
run: |
7285
pip install -U pip
7386
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
7487
7588
- name: Install Wokwi CLI
76-
if: steps.check-tests.outputs.enabled == 'true'
89+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
7790
run: curl -L https://wokwi.com/ci/install.sh | sh
7891

7992
- name: Wokwi CI Server
80-
if: steps.check-tests.outputs.enabled == 'true'
93+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
8194
uses: wokwi/wokwi-ci-server-action@v1
8295

8396
- name: Get binaries
84-
if: steps.check-tests.outputs.enabled == 'true'
97+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
8598
id: cache-build-binaries
8699
uses: actions/cache/restore@v4
87100
with:
@@ -93,7 +106,7 @@ jobs:
93106
~/.arduino/tests/**/build*.tmp/*.json
94107
95108
- name: Run Tests
96-
if: steps.check-tests.outputs.enabled == 'true'
109+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
97110
env:
98111
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
99112
run: |

0 commit comments

Comments
 (0)