mirror of
https://github.com/espressif/arduino-esp32
synced 2024-09-21 18:38:17 +00:00
a31a5fca17
* ci(tests): Swap cache to artifacts to avoid errors between OSes * ci(push): Fix chunk generation for compilation * ci(tests): Fix error code propagation * ci(push): Add shebang to new script * ci(push): Fix sizes upload if there is no changes * ci(bot): Fix GitHub actions bot commit info
114 lines
3.7 KiB
YAML
114 lines
3.7 KiB
YAML
name: Hardware tests
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
type:
|
|
type: string
|
|
description: 'Type of tests to run'
|
|
required: true
|
|
chip:
|
|
type: string
|
|
description: 'Chip to run tests for'
|
|
required: true
|
|
|
|
jobs:
|
|
hardware-test:
|
|
name: Hardware ${{ inputs.chip }} ${{ inputs.type }} tests
|
|
runs-on: [arduino, "${{ inputs.chip }}"]
|
|
env:
|
|
id: ${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }}-${{ inputs.chip }}-${{ inputs.type }}
|
|
container:
|
|
image: python:3.10.1-bullseye
|
|
options: --privileged
|
|
steps:
|
|
- name: Check if already built
|
|
if: ${{ github.event.pull_request.number != null }}
|
|
id: cache-results
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
key: tests-${{ env.id }}-results-hw
|
|
path: |
|
|
tests/**/*.xml
|
|
tests/**/result_*.json
|
|
|
|
- name: Evaluate if tests should be run
|
|
id: check-tests
|
|
run: |
|
|
cache_exists=${{ steps.cache-results.outputs.cache-hit == 'true' }}
|
|
enabled=true
|
|
|
|
if [[ $cache_exists == 'true' ]]; then
|
|
echo "Already ran, skipping"
|
|
enabled=false
|
|
fi
|
|
|
|
echo "enabled=$enabled" >> $GITHUB_OUTPUT
|
|
|
|
- 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' }}
|
|
# with:
|
|
# cache-dependency-path: tests/requirements.txt
|
|
# cache: 'pip'
|
|
# python-version: '3.10.1'
|
|
|
|
- name: Install dependencies
|
|
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
|
|
apt update
|
|
apt install -y jq
|
|
|
|
- name: Get binaries
|
|
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
|
|
path: |
|
|
~/.arduino/tests
|
|
|
|
- name: Run Tests
|
|
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
|
|
run: |
|
|
bash .github/scripts/tests_run.sh -c -type ${{ inputs.type }} -t ${{ inputs.chip }} -i 0 -m 1 -e
|
|
|
|
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} hardware results as cache
|
|
uses: actions/cache/save@v4
|
|
if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
|
|
with:
|
|
key: tests-${{ env.id }}-results-hw
|
|
path: |
|
|
tests/**/*.xml
|
|
tests/**/result_*.json
|
|
|
|
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} hardware results as artifacts
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: tests-results-hw-${{ inputs.chip }}-${{ inputs.type }}
|
|
overwrite: true
|
|
path: |
|
|
tests/**/*.xml
|
|
tests/**/result_*.json
|