-
Notifications
You must be signed in to change notification settings - Fork 7
174 lines (148 loc) · 4.62 KB
/
Copy pathbuild-pipeline.yml
File metadata and controls
174 lines (148 loc) · 4.62 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Build and test
on:
push:
branches: [main]
pull_request:
branches: [main]
# Allows us to run the workflow manually from the Actions tab
workflow_dispatch:
jobs:
compile:
name: Compile for ${{ matrix.name }}
runs-on: ubuntu-latest
container: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
strategy:
matrix:
include:
- name: Nano S
device: nanos
sdk_var: $NANOS_SDK
app_dir: "."
artifact_name: nanos
output_name: concordium_nanos.elf
output_path: ./concordium_nanos.elf
- name: Nano S Plus
device: nanosplus
sdk_var: $NANOSP_SDK
app_dir: "."
artifact_name: nanosplus
output_name: concordium_nanosplus.elf
output_path: ./concordium_nanosplus.elf
- name: Nano X
device: nanox
sdk_var: $NANOX_SDK
app_dir: "."
artifact_name: nanox
output_name: concordium_nanox.elf
output_path: ./concordium_nanox.elf
- name: Governance Nano S
device: governance-nanos
sdk_var: $NANOS_SDK
app_dir: governance-app
artifact_name: governance-nanos
output_name: ccdGovernance_nanos.elf
output_path: ./governance-app/ccdGovernance_nanos.elf
- name: Governance Nano S Plus
device: governance-nanosplus
sdk_var: $NANOSP_SDK
app_dir: governance-app
artifact_name: governance-nanosplus
output_name: ccdGovernance_nanosplus.elf
output_path: ./governance-app/ccdGovernance_nanosplus.elf
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Build
run: |
cd ${{ matrix.app_dir }}
make clean
BOLOS_SDK=${{ matrix.sdk_var }} make
mv bin/app.elf ${{ matrix.output_name }}
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.output_path }}
scan-build:
name: Run Clang Static Analyzer
runs-on: ubuntu-latest
container: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Clang Static Analyzer
run: |
make clean
scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Lint
uses: DoozyX/clang-format-lint-action@v0.15
with:
source: './src ./unit_tests'
extensions: 'c,h'
clangFormatVersion: 15
style: file
inplace: false
e2e-tests:
name: End to end tests
needs: [compile]
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
steps:
- uses: actions/checkout@v5
with:
submodules: 'recursive'
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: Setup dependencies
run: yarn install --immutable
- name: Create directory for binaries
run: mkdir bin
- name: Download binaries
uses: actions/download-artifact@v5
with:
path: tests/bin
- name: Run tests
run: yarn test
run_unit_test:
name: Unit test
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v5
- name: Build unit tests
run: |
cd unit_tests/
cmake -Bbuild -H. && make -C build
- name: Run unit tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd unit_tests/
make -C build test
# The point of this job is to make it easy to add protection rules that require all status checks to pass.
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Workflow result
needs: [compile, scan-build, run_unit_test, lint, e2e-tests]
steps:
- run: exit 1
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}