Make compile-sketch great again #2099
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
name: Compile Sketch | |
on: | |
push: | |
branches: [dev, release/stm32-blackpill, fix/*] | |
pull_request: | |
branches: [dev, release/stm32-blackpill, fix/*] | |
# Manual trigger | |
workflow_dispatch: | |
env: | |
BUILD_CACHE: build-cache | |
jobs: | |
coding-style: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Install eclint | |
run: | | |
npm install -g eclint | |
- name: Check coding style | |
run: | | |
eclint check $(sh .eclint-files.sh) | |
compile: | |
name: Compilation | |
runs-on: ubuntu-latest | |
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: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Cache build | |
uses: actions/cache@v3 | |
with: | |
path: .pio/build/${{ matrix.environment.command }} | |
key: ${{ env.BUILD_CACHE }}-${{ matrix.environment.command }} | |
- name: Run compilation for ${{ matrix.environment.name }} | |
run: | | |
pio run -e ${{ matrix.environment.command }} | |
env: | |
PLATFORMIO_BUILD_SRC_FLAGS: -Wdouble-promotion -Wall -Werror | |
sonar-scanner: | |
name: Sonar-Scanner | |
runs-on: ubuntu-latest | |
needs: [compile] | |
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.command }} | |
key: ${{ env.BUILD_CACHE }}-${{ matrix.environment.command }} | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner --define sonar.cfamily.build-wrapper-output=".pio/build/${{ matrix.environment.command }}" | |
unit-tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Run tests | |
run: | | |
pio test -e test | |
static-analysis: | |
name: Static Analysis | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
environment: | |
- "lego-stlink" | |
- "all-pcb-stlink" | |
- "scales-calibration-stlink" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Run static analysis on ${{ matrix.environment }} | |
run: | | |
pio check -e ${{ matrix.environment }} --fail-on-defect medium --fail-on-defect high | |
web-build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
cache-dependency-path: webserver/web-interface/package-lock.json | |
- run: npm ci | |
working-directory: webserver/web-interface/ | |
- run: npm run build --if-present | |
working-directory: webserver/web-interface/ | |
- run: npm run lint | |
working-directory: webserver/web-interface/ | |
env: | |
CI: true |