-
Notifications
You must be signed in to change notification settings - Fork 2
125 lines (100 loc) · 3.25 KB
/
ci.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
#
# GitHub Actions Workflow
# reference: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
name: "Build and Test"
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: "Build (embedded)"
strategy:
fail-fast: false
matrix:
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
os: [ macos-latest ]
buildtype: [ Debug ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
# https://github.com/actions/checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
# Python currently not needed
# - name: Setup Python
# # https://github.com/actions/setup-python
# uses: actions/setup-python@v5
# with:
# python-version: '3.x'
# Rust and CMake are already installed in the macos-12 runner
# see https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
- name: Upgrade Bash on macOS
if: startsWith(matrix.os, 'macos')
run: brew install bash
- name: Install Arm GNU Toolchain using brew
if: startsWith(matrix.os, 'macos')
run: brew install --cask gcc-arm-embedded
- name: Add Rust thumbv7em-none-eabihf target
run: rustup target add thumbv7em-none-eabihf
- name: Build salty C API
working-directory: crypto/salty/c-api
run: make build
- name: Configue project
id: configure
run: cmake -DEMBEDDED_BUILD=ON -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -B build
- name: Build
id: build
run: cmake --build build
- name: Upload build outputs
if: always()
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: build-outputs-${{ matrix.os }}-${{ matrix.buildtype }}
path: |
build/fel-krp-project.bin
build/fel-krp-project.hex
build/fel-krp-project.elf
test:
name: "Unit tests on host"
strategy:
fail-fast: false
matrix:
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
os: [ macos-latest ]
buildtype: [ Debug ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
# https://github.com/actions/checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Upgrade Bash on macOS
if: startsWith(matrix.os, 'macos')
run: brew install bash
- name: Configue project
id: configure
run: cmake -DEMBEDDED_BUILD=OFF -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -B build
- name: Build
id: build
run: cmake --build build
- name: Create log dir for test outputs
id: test-dir
run: mkdir -p log
- name: Test
id: test
run: ctest --extra-verbose --test-dir build |& tee log/ctest-output.txt
- name: Upload test outputs
if: always()
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: test-outputs-${{ matrix.os }}-${{ matrix.buildtype }}
path: |
log/
build/