-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (131 loc) · 4.58 KB
/
github-actions.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CANDrive CI
on: [push, pull_request]
jobs:
test-and-build-app:
runs-on: ubuntu-20.04
env:
SONAR_RUNNER_HOME: /usr/lib/sonar-scanner
steps:
- name: Install cantools
run: sudo python3 -m pip install cantools
- name: Install build tools
run: sudo apt-get update -y && sudo apt-get install -y gcc-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi valgrind gcovr
- name: Install SCons
run: sudo python3 -m pip install scons
- name: Check out repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install cmocka
working-directory: ${{ github.workspace }}
run: sudo scripts/install_cmocka.sh
- name: Install SonarScanner and buildwrapper
working-directory: ${{ github.workspace }}
run: sudo scripts/install_sonarscanner_build_wrapper.sh
- name: Build LibOpenCM3
run: |
scons -C ${{ github.workspace }}/firmware build-opencm3 -j2
- name: Build and run tests
run: |
scons -C ${{ github.workspace }}/firmware test -j2
- name: Process code coverage results
working-directory: ${{ github.workspace }}/firmware
run: |
gcovr -k
pwd
ls
- name: Build with buildwrapper
run: |
build-wrapper-linux-x86-64 --out-dir bw-output scons -C ${{ github.workspace }}/firmware build -j2
- name: Run SonarScanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner
- name: Build application
run: |
scons -C ${{ github.workspace }}/firmware release SOFTWARE_VERSION=$GITHUB_REF_NAME -j2
- name: Archive application
uses: actions/upload-artifact@v3
with:
name: candrive-fw-app
path: firmware/build/app/app/application.*
build-boot:
runs-on: ubuntu-20.04
steps:
- name: Install build tools
run: sudo apt-get update -y && sudo apt-get install -y gcc-arm-none-eabi libnewlib-arm-none-eabi libnewlib-nano-arm-none-eabi
- name: Install SCons
run: sudo python3 -m pip install scons
- name: Check out repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build LibOpenCM3
run: |
scons -C ${{ github.workspace }}/firmware build-opencm3 -j2
- name: Build bootloader
run: |
scons -C ${{ github.workspace }}/firmware release-boot -j2
- name: Archive bootloader
uses: actions/upload-artifact@v3
with:
name: candrive-fw-boot
path: firmware/build/bootloader/bootloader/bootloader.*
deploy:
needs: [test-and-build-app, build-boot]
name: Deploy
runs-on: ubuntu-20.04
if: github.ref_type == 'tag'
steps:
- uses: actions/download-artifact@v3
with:
name: candrive-fw-app
path: artifacts
- uses: actions/download-artifact@v3
with:
name: candrive-fw-boot
path: artifacts
- name: Install Memfault CLI
run: |
sudo apt-get install -y virtualenv
python3 -m virtualenv memfault_env
source memfault_env/bin/activate
sudo pip3 install memfault-cli
- name: Upload application symbols
env:
MEMFAULT_AUTH_TOKEN: ${{ secrets.MEMFAULT_AUTH_TOKEN }}
run: |
memfault --org-token $MEMFAULT_AUTH_TOKEN \
--org dahlberg-technologies \
--project candrive \
upload-mcu-symbols \
--software-type appfw \
--software-version $GITHUB_REF_NAME \
--revision $GITHUB_SHA \
artifacts/application.elf
- name: Upload application
env:
MEMFAULT_AUTH_TOKEN: ${{ secrets.MEMFAULT_AUTH_TOKEN }}
run: |
memfault --org-token $MEMFAULT_AUTH_TOKEN \
--org dahlberg-technologies \
--project candrive \
upload-ota-payload \
--hardware-version rev1 \
--software-type appfw \
--software-version $GITHUB_REF_NAME \
--revision $GITHUB_SHA \
artifacts/application.hex
- name: Upload Bootloader symbols
env:
MEMFAULT_AUTH_TOKEN: ${{ secrets.MEMFAULT_AUTH_TOKEN }}
run: |
memfault --org-token $MEMFAULT_AUTH_TOKEN \
--org dahlberg-technologies \
--project candrive \
upload-mcu-symbols \
--software-type bootfw \
--software-version $GITHUB_REF_NAME \
--revision $GITHUB_SHA \
artifacts/bootloader.elf