Skip to content

Commit 2a8d07b

Browse files
committed
Add an integration test CI workflow
This provides some checks on how the entire action works with GitHub Actions, which can catch issues the unit/functional tests of the Python code will miss.
1 parent 4e4af45 commit 2a8d07b

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed
+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Run integration tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/test-integration.yml'
7+
- '.github/workflows/testdata'
8+
- 'action.yml'
9+
- 'compilesketches/**'
10+
11+
push:
12+
paths:
13+
- '.github/workflows/test-integration.yml'
14+
- '.github/workflows/testdata'
15+
- 'action.yml'
16+
- 'compilesketches/**'
17+
18+
env:
19+
SKETCHES_REPORTS_PATH: sketches-reports
20+
TESTDATA_SKETCHES_PATH: .github/workflows/testdata/sketches
21+
22+
jobs:
23+
default-inputs:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout Servo library
28+
uses: actions/checkout@v2
29+
with:
30+
repository: arduino-libraries/servo
31+
ref: 1.1.7
32+
33+
- name: Checkout local repo
34+
uses: actions/checkout@v2
35+
with:
36+
# Must be checked out to a subfolder to not interfere with the checked out library under test
37+
path: extras/compile-sketches
38+
39+
- name: Run action with default input values
40+
# Use action from local path
41+
uses: ./extras/compile-sketches
42+
43+
44+
all-inputs:
45+
runs-on: ubuntu-latest
46+
47+
strategy:
48+
fail-fast: false
49+
50+
matrix:
51+
board:
52+
- fqbn: arduino:avr:uno
53+
platforms: |
54+
- name: arduino:avr
55+
version: 1.8.3
56+
libraries: |
57+
- name: Servo
58+
version: 1.1.7
59+
# Board that requires Boards Manager URL
60+
- fqbn: esp8266:esp8266:huzzah
61+
platforms: |
62+
- name: esp8266:esp8266
63+
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
64+
version: 2.7.4
65+
libraries: |
66+
# The official Servo library is not compatible with ESP8266, but that platform has a bundled Servo lib
67+
# so there are no library dependencies
68+
-
69+
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v2
73+
74+
- name: Run action
75+
# Use action from local path
76+
uses: ./
77+
with:
78+
cli-version: 0.13.0
79+
platforms: ${{ matrix.board.platforms }}
80+
fqbn: ${{ matrix.board.fqbn }}
81+
libraries: ${{ matrix.board.libraries }}
82+
sketch-paths: |
83+
- ${{ env.TESTDATA_SKETCHES_PATH }}/BareMinimum
84+
- ${{ env.TESTDATA_SKETCHES_PATH }}/ServoLibrary
85+
enable-deltas-report: true
86+
enable-warnings-report: true
87+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
88+
verbose: true
89+
90+
91+
expected-failed-compilation:
92+
runs-on: ubuntu-latest
93+
94+
steps:
95+
- name: Checkout local repo
96+
uses: actions/checkout@v2
97+
98+
- name: Compile sketch that is expected to error
99+
id: compile-sketches
100+
continue-on-error: true
101+
uses: ./
102+
with:
103+
fqbn: arduino:avr:uno
104+
libraries: |
105+
-
106+
sketch-paths: |
107+
- ${{ env.TESTDATA_SKETCHES_PATH }}/Error
108+
109+
- name: Fail the job if the action run succeeded
110+
if: steps.compile-sketches.outcome == 'success'
111+
run: |
112+
echo "::error::The action run was expected to fail, but passed!"
113+
exit 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
void setup() {}
2+
void loop() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#error
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <Servo.h>
2+
void setup() {}
3+
void loop() {}

0 commit comments

Comments
 (0)