Skip to content

Commit

Permalink
ci(tests): Run scripts only from master
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed Jun 7, 2024
1 parent 34f6b33 commit fbf94b2
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 30 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,24 @@ jobs:
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout user repository
if: ${{ steps.check-build.outputs.enabled == 'true' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/*
!.github
# To avoid giving unknown scripts elevated permissions, download them from the master branch
- name: Get CI scripts from master
if: ${{ steps.check-build.outputs.enabled == 'true' }}
run: |
mkdir -p .github
cd .github
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
- name: Get libs cache
uses: actions/cache@v4
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,28 @@ jobs:
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout repository
- name: Checkout user repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/*
!.github
# To avoid giving unknown scripts elevated permissions, download them from the master branch
- name: Get CI scripts from master
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
mkdir -p .github
cd .github
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
# setup-python currently only works on ubuntu images
# - uses: actions/setup-python@v5
# if: steps.check-tests.outputs.enabled == 'true'
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}
# with:
# cache-dependency-path: tests/requirements.txt
# cache: 'pip'
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,48 @@ jobs:
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout repository
- name: Checkout user repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@v4
if: steps.check-tests.outputs.enabled == 'true'
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/*
!.github
# To avoid giving unknown scripts elevated permissions, download them from the master branch
- name: Get CI scripts from master
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
mkdir -p .github
cd .github
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
- uses: actions/setup-python@v5
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
cache-dependency-path: tests/requirements.txt
cache: 'pip'
python-version: '3.x'

- name: Install Python dependencies
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
pip install -U pip
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
- name: Install APT dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
packages: libpixman-1-0 libnuma1 libglib2.0-0 libslirp0 libsdl2-2.0-0
version: 1.0

- name: Get QEMU version
uses: pozetroninc/github-action-get-latest-release@v0.7.0
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
id: get-qemu-version
with:
token: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -84,14 +97,14 @@ jobs:
- name: Cache QEMU
id: cache-qemu
uses: actions/cache@v4
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
path: |
~/qemu
key: qemu-${{ steps.get-qemu-version.outputs.release }}-${{ hashFiles('.github/workflows/qemu.yml') }}

- name: Download QEMU
if: steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' && steps.check-tests.outputs.enabled == 'true' }}
run: |
cd ${{ env.QEMU_INSTALL_PATH }}
underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g')
Expand All @@ -103,7 +116,7 @@ jobs:
echo "QEMU_PATH=${{ env.QEMU_INSTALL_PATH }}/qemu" >> $GITHUB_ENV
- name: Get binaries
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
id: cache-build-binaries
uses: actions/cache/restore@v4
with:
Expand All @@ -115,7 +128,7 @@ jobs:
~/.arduino/tests/**/build*.tmp/*.json
- name: Run Tests
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
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

- name: Upload ${{ inputs.chip }} ${{ inputs.type }} QEMU results as cache
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ on:
- '!libraries/**.txt'
- '!libraries/**.properties'
- 'package/**'
- '.github/workflows/tests.yml'
- '.github/workflows/build_tests.yml'
- '.github/workflows/hw.yml'
- '.github/workflows/wokwi.yml'
- '.github/workflows/qemu.yml'
- '.github/scripts/install-*.sh'
- '.github/scripts/tests_*.sh'
- '.github/scripts/sketch_utils.sh'
schedule:
- cron: '0 2 * * *'

Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/wokwi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,48 @@ jobs:
echo "enabled=$enabled" >> $GITHUB_OUTPUT
- name: Checkout Repository
- name: Checkout user repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@v4
if: steps.check-tests.outputs.enabled == 'true'
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/*
!.github
# To avoid giving unknown scripts elevated permissions, download them from the master branch
- name: Get CI scripts from master
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
mkdir -p .github
cd .github
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
- uses: actions/setup-python@v5
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
with:
cache-dependency-path: tests/requirements.txt
cache: 'pip'
python-version: '3.x'

- name: Install dependencies
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: |
pip install -U pip
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
- name: Install Wokwi CLI
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: curl -L https://wokwi.com/ci/install.sh | sh

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

- name: Get binaries
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
id: cache-build-binaries
uses: actions/cache/restore@v4
with:
Expand All @@ -93,7 +106,7 @@ jobs:
~/.arduino/tests/**/build*.tmp/*.json
- name: Run Tests
if: steps.check-tests.outputs.enabled == 'true'
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
env:
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
run: |
Expand Down

0 comments on commit fbf94b2

Please sign in to comment.