-
Notifications
You must be signed in to change notification settings - Fork 267
129 lines (118 loc) · 3.8 KB
/
compile-sketch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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 # Directory where build-wrapper output will be placed
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
- 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: |
~/.platformio/penv/bin/platformio 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]
env:
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
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output=".pio/build/${{ matrix.environment.name }}"
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Install Platformio
run: |
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- name: Run tests
run: |
~/.platformio/penv/bin/platformio 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
- name: Install Platformio
run: |
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- name: Run static analysis on ${{ matrix.environment }}
run: |
~/.platformio/penv/bin/platformio check -e ${{ matrix.environment }} --fail-on-defect medium --fail-on-defect high