Test tools #490
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
push: | |
branches: [ master ] | |
defaults: | |
run: | |
shell: bash | |
env: | |
# disable esp-idf checking dependencies from the web, breaking the build | |
IDF_PYTHON_CHECK_CONSTRAINTS: 0 | |
NODE_COVERALLS_DEBUG: 0 # verbose logging for coveralls steps | |
CMAKE_C_COMPILER_LAUNCHER: ccache | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
CCACHE_DIR: /ccache | |
FLUTTER_VERSION: '3.16.9' | |
FLUTTER_CHANNEL: 'stable' | |
MELOS_VERSION: '^6.1.0' | |
COVERDE_VERSION: '^0.2.0+2' | |
COVERAGE_VERSION: '^1.8.0' | |
jobs: | |
build-firmware: | |
runs-on: ubuntu-latest | |
container: barabas5532/shrapnel:8 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ github.job }}-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ github.job }}- | |
- name: ccache reset statistics | |
run: ccache --zero-stats | |
# This could be two different steps, but we need to preserve the | |
# environment that is set up by export.sh | |
- name: Setup ESP-IDF and build | |
run: | | |
. $IDF_PATH/export.sh | |
python3 -m pip install -r thirdparty/esp-idf-components/nanopb/nanopb/requirements.txt | |
idf.py -C firmware build | |
- name: ccache statistics | |
run: ccache --show-stats | |
build-plugins: | |
runs-on: ubuntu-latest | |
container: barabas5532/shrapnel:8 | |
strategy: | |
matrix: | |
plugin: ["shrapnel"] | |
build_type: ["Release", "Debug"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ github.job }}-${{ matrix.plugin }}-${{ matrix.build_type }}-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ github.job }}-${{ matrix.plugin }}-${{ matrix.build_type }}- | |
- name: ccache reset statistics | |
run: ccache --zero-stats | |
- name: Install python dependencies | |
run: python3 -m pip install -r thirdparty/esp-idf-components/nanopb/nanopb/requirements.txt | |
- name: Configure CMake | |
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} plugins/${{matrix.plugin}} | |
- name: Build | |
run: cmake --build build --config ${{matrix.build_type}} | |
- name: ccache statistics | |
run: ccache --show-stats | |
ctest: | |
runs-on: ubuntu-latest | |
container: barabas5532/shrapnel:8 | |
strategy: | |
matrix: | |
build_type: ["Release", "Debug"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ github.job }}-${{ matrix.build_type }}-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ github.job }}-${{ matrix.build_type }}- | |
- name: ccache reset statistics | |
run: ccache --zero-stats | |
- name: Install python dependencies | |
run: python3 -m pip install -r thirdparty/esp-idf-components/nanopb/nanopb/requirements.txt | |
- name: Configure CMake | |
env: | |
CXXFLAGS: "-fprofile-arcs -ftest-coverage" | |
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} test | |
- name: Build | |
run: cmake --build build --config ${{matrix.build_type}} | |
- name: Test | |
working-directory: /__w/ShrapnelMonorepo/ShrapnelMonorepo/build | |
run: ctest -C ${{matrix.build_type}} | |
- name: ccache statistics | |
run: ccache --show-stats | |
- name: Coverage | |
if: matrix.build_type == 'Debug' | |
run: > | |
lcov --capture --directory build | |
--exclude '*google*' | |
--exclude '/usr/*' | |
--exclude '*/thirdparty/*' | |
--exclude '*/test/*' | |
-o lcov.info | |
- name: Debug print lcov | |
if: env.NODE_COVERALLS_DEBUG != 0 | |
run: cat lcov.info | |
- name: Coveralls | |
if: matrix.build_type == 'Debug' | |
uses: coverallsapp/github-action@master | |
with: | |
path-to-lcov: lcov.info | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel: true | |
flag-name: "ctest" | |
ctest-sanitize: | |
runs-on: ubuntu-latest | |
container: barabas5532/shrapnel:8 | |
strategy: | |
matrix: | |
build_type: ["Release", "Debug"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ github.job }}-${{ matrix.build_type }}-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ github.job }}-${{ matrix.build_type }}- | |
- name: ccache reset statistics | |
run: ccache --zero-stats | |
- name: Install python dependencies | |
run: python3 -m pip install -r thirdparty/esp-idf-components/nanopb/nanopb/requirements.txt | |
- name: Configure CMake | |
env: | |
CXXFLAGS: "-fsanitize=address,undefined -fno-sanitize-recover=all" | |
run: cmake -B build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} test | |
- name: Build | |
run: cmake --build build --config ${{matrix.build_type}} | |
- name: Test | |
working-directory: /__w/ShrapnelMonorepo/ShrapnelMonorepo/build | |
run: ctest -C ${{matrix.build_type}} | |
- name: ccache statistics | |
run: ccache --show-stats | |
flutter-analyze: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: | |
dart | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
cache: true | |
- run: dart pub global activate melos ${{ env.MELOS_VERSION }} | |
- run: dart run melos bootstrap | |
- name: Generate code | |
run: dart run melos run generate_code | |
- name: Analyze | |
run: flutter analyze | |
flutter-format: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: | |
dart | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
cache: true | |
- run: dart pub global activate melos ${{ env.MELOS_VERSION }} | |
- run: dart run melos bootstrap | |
- name: Format | |
run: dart format -o none --set-exit-if-changed . | |
flutter-test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: | |
dart | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
cache: true | |
- run: dart pub global activate melos ${{ env.MELOS_VERSION }} | |
- run: dart pub global activate coverde ${{ env.COVERDE_VERSION }} | |
- run: dart pub global activate coverage ${{ env.COVERAGE_VERSION }} | |
- run: melos bootstrap | |
- name: Generate code | |
run: melos run generate_code | |
- name: Test | |
run: | | |
dart run melos run test | |
dart run melos run test-dart | |
- name: Coverage clean-up | |
run: dart run melos run coverage | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
path-to-lcov: dart/coverage/filtered.lcov.info | |
base-path: dart | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel: true | |
flag-name: "flutter" | |
coveralls-finish: | |
needs: [flutter-test, ctest] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true | |
license-headers: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Check License Header | |
uses: apache/[email protected] |