Speed up test setup #482
Workflow file for this run
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' | |
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: | |
frontend | |
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: flutter pub get | |
- name: Generate code | |
run: flutter pub run build_runner build | |
- name: Analyze | |
run: flutter analyze | |
flutter-format: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: | |
frontend | |
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: flutter pub get | |
- name: Format | |
run: dart format -o none --set-exit-if-changed lib test | |
flutter-test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: | |
frontend | |
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: flutter pub get | |
- name: Generate code | |
run: flutter pub run build_runner build | |
- name: Test | |
run: flutter test --coverage --exclude-tags=api | |
- name: Coverage clean-up | |
run: > | |
flutter pub run | |
remove_from_coverage --remove="\.g\.dart$" | |
--file=coverage/lcov.info | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
path-to-lcov: frontend/coverage/lcov.info | |
base-path: frontend | |
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/skywalking-eyes@v0.2.0 |