Skip to content

Commit bf80e99

Browse files
authored
chore: Move CI to GitHub Actions
- Build and run unit tests with CMake - Track code coverage with Coveralls - Build examples on officially supported boards - Removed TravisCI configuration Closes #233.
1 parent 2f03d9b commit bf80e99

File tree

4 files changed

+87
-111
lines changed

4 files changed

+87
-111
lines changed

.github/workflows/cmake.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ name: CMake
22

33
on:
44
push:
5-
branches: [ master ]
65
pull_request:
76
branches: [ master ]
87

98
env:
109
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11-
BUILD_TYPE: Release
10+
BUILD_TYPE: Debug
11+
GENERATE_COVERAGE: true
12+
LCOV_ROOT: ${{github.workspace}}/lcov
1213

1314
jobs:
1415
build:
@@ -22,17 +23,37 @@ jobs:
2223
- uses: actions/checkout@v2
2324
with:
2425
submodules: recursive
25-
26+
27+
- name: Install lcov
28+
run: |
29+
mkdir -p "$LCOV_ROOT"
30+
wget https://github.com/linux-test-project/lcov/releases/download/v1.15/lcov-1.15.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
31+
tar -xf "$LCOV_ROOT/lcov.tar.gz" --strip-components=1 -C "$LCOV_ROOT"
32+
echo "$LCOV_ROOT/bin" >> $GITHUB_PATH
33+
shell: bash
34+
2635
- name: Configure CMake
2736
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
2837
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
29-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
38+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILDER_ENABLE_PROFILING=true
3039

3140
- name: Build
3241
# Build your program with the given configuration
3342
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
3443

3544
- name: Run Unit Tests
3645
working-directory: ${{github.workspace}}/build
37-
run: ./test/unit-tests/unit-tests
38-
46+
run: ctest --verbose
47+
48+
- name: Generate code coverage report
49+
working-directory: ${{github.workspace}}/build
50+
run: |
51+
lcov --directory . --capture --output-file coverage.info
52+
lcov --remove coverage.info '/usr/*' "${{github.workspace}}/test/*" "${{github.workspace}}/external/*" --output-file coverage.info
53+
lcov --list coverage.info
54+
55+
- uses: coverallsapp/github-action@9ba913c152ae4be1327bfb9085dc806cedb44057
56+
name: Upload code coverage report to Coveralls
57+
with:
58+
path-to-lcov: ${{github.workspace}}/build/coverage.info
59+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/platformio.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: PlatformIO
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
platformio:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
example:
16+
- AltPinSerial
17+
- Basic_IO
18+
- Bench
19+
- Callbacks
20+
- DualMerger
21+
- ErrorCallback
22+
- Input
23+
- RPN_NRPN
24+
- SimpleSynth
25+
board:
26+
- uno
27+
- due
28+
- zero
29+
- leonardo
30+
- micro
31+
- nanoatmega328
32+
- megaatmega2560
33+
- teensy2
34+
- teensy30
35+
- teensy31
36+
- teensylc
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Cache pip
40+
uses: actions/cache@v2
41+
with:
42+
path: ~/.cache/pip
43+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
44+
restore-keys: ${{ runner.os }}-pip-
45+
- name: Cache PlatformIO
46+
uses: actions/cache@v2
47+
with:
48+
path: ~/.platformio
49+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
50+
- name: Set up Python
51+
uses: actions/setup-python@v2
52+
- name: Install PlatformIO
53+
run: |
54+
python -m pip install --upgrade pip
55+
pip install --upgrade platformio
56+
- name: Run PlatformIO
57+
run: pio ci --lib="." --board="${{matrix.board}}"
58+
env:
59+
PLATFORMIO_CI_SRC: examples/${{ matrix.example }}

.travis.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

examples/AltPinSerial/AltPinSerial.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Here, when receiving any message on channel 4, the Arduino
66
// will blink a led and play back a note for 1 second.
77

8-
#if defined(ARDUINO_SAM_DUE) || defined(SAMD_SERIES)
8+
#if defined(ARDUINO_SAM_DUE) || defined(SAMD_SERIES) || defined(_VARIANT_ARDUINO_ZERO_)
99
/* example not relevant for this hardware (SoftwareSerial not supported) */
1010
MIDI_CREATE_DEFAULT_INSTANCE();
1111
#else

0 commit comments

Comments
 (0)