diff --git a/.github/workflows/compile-sketch.yml b/.github/workflows/compile-sketch.yml index cfee147e..28a9fcf2 100644 --- a/.github/workflows/compile-sketch.yml +++ b/.github/workflows/compile-sketch.yml @@ -7,6 +7,9 @@ on: branches: [dev, release/stm32-blackpill, fix/*] # Manual trigger workflow_dispatch: + +env: + BUILD_CACHE: build_cache # Directory where build-wrapper output will be placed jobs: coding-style: @@ -52,9 +55,14 @@ jobs: - name: Install Platformio run: | python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" + - name: Cache build + uses: actions/cache@v3 + with: + path: .pio/build/${{ matrix.environment.name }} + key: ${{ env.BUILD_CACHE }}_${{ matrix.environment.name }} - name: Run build-wrapper on ${{ matrix.environment.name }} run: | - build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ~/.platformio/penv/bin/platformio run -e ${{ matrix.environment.command }} + ~/.platformio/penv/bin/platformio run -e ${{ matrix.environment.command }} env: PLATFORMIO_BUILD_SRC_FLAGS: -Wdouble-promotion -Wall -Werror @@ -63,16 +71,30 @@ jobs: runs-on: ubuntu-latest needs: [compile] env: - BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + environment: + - name: Main (Lego) + command: "lego-stlink" + - name: Main (PCB) + command: "all-pcb-stlink" + - name: Scales + command: "scales-calibration-stlink" steps: - name: Install sonar-scanner uses: SonarSource/sonarcloud-github-c-cpp@v1 + - uses: actions/cache@v3 + with: + path: | + .pio/build/${{ matrix.environment.name }} + key: ${{ env.BUILD_CACHE }}_${{ matrix.environment.name }} - name: Run sonar-scanner - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" + sonar-scanner --define sonar.cfamily.build-wrapper-output=".pio/build/${{ matrix.environment.name }}" unit-tests: name: Unit Tests