Skip to content

Commit 709bd35

Browse files
committed
test
1 parent e1aaa10 commit 709bd35

File tree

3 files changed

+82
-54
lines changed

3 files changed

+82
-54
lines changed

.github/workflows/build_tests.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,62 @@
1+
name: Build tests
2+
13
on:
24
workflow_call:
3-
inputs:
4-
type:
5-
required: true
6-
type: string
75

86
concurrency:
9-
group: tests-build-${{ inputs.type }}-${{ github.event.pull_request.number || github.ref }}
7+
group: tests-build-${{ github.event.pull_request.number || github.ref }}
108
cancel-in-progress: true
119

1210
jobs:
1311
build-tests:
14-
name: Build ${{ inputs.type }} tests for ${{ matrix.chip }}
12+
name: Build ${{ matrix.type }} tests for ${{ matrix.chip }}
1513
runs-on: ubuntu-latest
1614
strategy:
1715
matrix:
16+
type: ['validation', 'performance']
1817
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
1918
steps:
19+
- name: Check if already built
20+
id: artifact-exists
21+
uses: LIT-Protocol/artifact-exists-action@v0
22+
with:
23+
name: ${{ matrix.chip }}-${{ matrix.type }}.artifacts
24+
25+
- name: Evaluate if tests should be built
26+
id: check-build
27+
run: |
28+
artifact_exists=${{ steps.artifact-exists.outputs.exists }}
29+
is_pr=${{ github.event_name == 'pull_request' }}
30+
is_performance_test=${{ matrix.type == 'performance' }}
31+
is_performance_enabled=${{ contains(github.event.pull_request.labels.*.name, 'perf_test') }}
32+
33+
if [[ $artifact_exists == 'true' ]]; then
34+
echo "Already built, skipping"
35+
exit 0
36+
elif [[ $is_pr != 'true' ]]; then
37+
echo "Not a PR, building"
38+
elif [[ $is_performance_test == 'true' ]]; then
39+
if [[ $is_performance_enabled == 'true' ]]; then
40+
echo "Performance test enabled, building"
41+
else
42+
echo "Performance test disabled, skipping"
43+
exit 0
44+
fi
45+
else
46+
echo "Validation test, building"
47+
fi
48+
2049
- name: Checkout Repository
2150
uses: actions/checkout@v4
2251

2352
- name: Build sketches
2453
run: |
25-
bash .github/scripts/tests_build.sh -c -type ${{ inputs.type }} -t ${{ matrix.chip }}
54+
bash .github/scripts/tests_build.sh -c -type ${{ matrix.type }} -t ${{ matrix.chip }}
2655
27-
- name: Upload ${{ matrix.chip }}-${{ inputs.type }} artifacts
56+
- name: Upload ${{ matrix.chip }}-${{ matrix.type }} artifacts
2857
uses: actions/upload-artifact@v4
2958
with:
30-
name: ${{ matrix.chip }}-${{ inputs.type }}.artifacts
59+
name: ${{ matrix.chip }}-${{ matrix.type }}.artifacts
3160
if-no-files-found: error
3261
path: |
3362
~/.arduino/tests/**/build*.tmp/*.bin

.github/workflows/hw.yml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,71 @@ name: Hardware tests
22

33
on:
44
workflow_call:
5-
inputs:
6-
chip:
7-
required: true
8-
type: string
9-
type:
10-
required: true
11-
type: string
12-
ref:
13-
required: true
14-
type: string
155

166
concurrency:
17-
group: hw-${{ inputs.ref }}-${{ inputs.chip }}-${{ inputs.type }}
7+
group: tests-hw-${{ github.event.pull_request.number || github.ref }}
188
cancel-in-progress: true
199

2010
jobs:
2111
hardware-test:
22-
name: ${{ inputs.chip }} - Hardware ${{ inputs.type }} tests
23-
runs-on: [arduino, "${{inputs.chip}}"]
12+
name: Hardware ${{ matrix.chip }} ${{ matrix.type }} tests
13+
runs-on: [arduino, "${{ matrix.chip }}"]
14+
strategy:
15+
matrix:
16+
type: ['validation', 'performance']
17+
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
2418
container:
2519
image: python:3.10.1-bullseye
2620
options: --privileged
27-
2821
steps:
22+
- name: Evaluate if tests should be run
23+
id: check-tests
24+
run: |
25+
is_pr=${{ github.event_name == 'pull_request' }}
26+
is_performance_test=${{ matrix.type == 'performance' }}
27+
is_performance_enabled=${{ contains(github.event.pull_request.labels.*.name, 'perf_test') }}
28+
29+
if [[ $is_pr != 'true' ]]; then
30+
echo "Not a PR, running"
31+
elif [[ $is_performance_test == 'true' ]]; then
32+
if [[ $is_performance_enabled == 'true' ]]; then
33+
echo "Performance test enabled, running"
34+
else
35+
echo "Performance test disabled, skipping"
36+
exit 0
37+
fi
38+
else
39+
echo "Validation test, running"
40+
fi
41+
42+
- uses: actions/setup-python@v5
43+
with:
44+
cache: 'pip'
45+
python-version: '3.10'
46+
2947
- name: Checkout repository
3048
uses: actions/checkout@v4
3149

32-
- name: Download ${{inputs.chip}}-${{inputs.type}} artifacts
50+
- name: Download ${{ matrix.chip }}-${{ matrix.type }} artifacts
3351
uses: actions/download-artifact@v4
3452
with:
35-
name: ${{ inputs.chip }}-${{ inputs.type }}.artifacts
36-
path: ~/
53+
name: ${{ matrix.chip }}-${{ matrix.type }}.artifacts
54+
path: ~/.arduino/tests
3755

3856
- name: Install dependencies
3957
run: |
4058
pip install -U pip
4159
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
42-
apt update && apt install -y -qq jq
4360
4461
- name: Run Tests
4562
run: |
46-
bash .github/scripts/tests_run.sh -type ${{ inputs.type }} -t ${{ inputs.chip }} -e
63+
bash .github/scripts/tests_run.sh -type ${{ matrix.type }} -t ${{ matrix.chip }} -e
4764
4865
- name: Upload test result artifacts
4966
uses: actions/upload-artifact@v4
5067
if: ${{ always() }}
5168
with:
52-
name: hw_results-${{inputs.chip}}-${{inputs.type}}}
69+
name: hw_results-${{ matrix.chip }}-${{ matrix.type }}}
5370
if-no-files-found: error
5471
path: |
5572
tests/**/*.xml

.github/workflows/tests.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
1-
name: Run tests
1+
name: Tests
22

33
on:
4+
workflow_dispatch:
45
pull_request_target:
56
types: [opened, reopened, synchronize, labeled, unlabeled]
67
schedule:
7-
- cron: '0 2 * * *'
8+
- cron: '0 3 * * *'
89

910
concurrency:
1011
group: tests-${{ github.event.pull_request.number || github.ref }}
1112
cancel-in-progress: true
1213

1314
jobs:
14-
call-build-validation-tests:
15-
name: Build validation tests
15+
call-build-tests:
16+
name: Build tests
1617
uses: ./.github/workflows/build_tests.yml
1718
permissions:
1819
contents: read
19-
with:
20-
type: "validation"
21-
22-
call-build-performance-tests:
23-
name: Build performance tests
24-
uses: ./.github/workflows/build_tests.yml
25-
if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'perf_test') }}
26-
permissions:
27-
contents: read
28-
with:
29-
type: "performance"
3020

3121
call-hardware-tests:
32-
name: Run ${{ matrix.type }} hardware tests for ${{ matrix.chip }}
22+
name: Run tests on hardware
3323
uses: ./.github/workflows/hw.yml
34-
needs: [call-build-validation-tests, call-build-performance-tests]
24+
needs: call-build-tests
3525
if: ${{ github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'hil_test') }}
3626
permissions:
3727
contents: read
38-
strategy:
39-
matrix:
40-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
41-
type: ['validation', 'performance']
42-
with:
43-
chip: ${{matrix.chip}}
44-
type: ${{matrix.type}}
45-
ref: ${{ github.event.pull_request.number || github.ref }}
4628

4729
# call-wokwi-tests:
4830
# uses: espressif/arduino-esp32/.github/workflows/wokwi.yml@master

0 commit comments

Comments
 (0)