forked from betaflight/betaflight
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (88 loc) · 2.64 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
# Builds Betaflight Firmware.
#
name: CI
on:
workflow_call:
inputs:
release_build:
description: 'Specifies if it is a build that should include commit hash in hex file names or not'
default: false
required: false
type: boolean
jobs:
setup:
name: Setup
runs-on: ubuntu-22.04
outputs:
targets: ${{ steps.get-targets.outputs.targets }}
steps:
- uses: actions/checkout@v3
- name: Cache build toolchain
uses: actions/cache@v3
id: cache-toolchain
with:
path: tools
key: ${{ runner.os }}-${{ hashFiles('mk/tools.mk') }}
- name: Download and install toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: make arm_sdk_install
- name: Hydrate configuration
id: get-config
run: make configs
- name: Get all official build targets
id: get-targets
run: echo "targets=$(make targets-ci-print | jq -R -c 'split(" ")')" >> $GITHUB_OUTPUT
build:
name: Build
needs: setup
runs-on: ubuntu-22.04
strategy:
matrix:
target: ${{ fromJson(needs.setup.outputs.targets) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Fetch toolchain from cache
uses: actions/cache@v3
id: cache-toolchain
with:
path: tools
key: ${{ runner.os }}-${{ hashFiles('mk/tools.mk') }}
- name: Hydrate configuration
id: get-config
run: make configs
- name: Build target (without revision)
if: inputs.release_build == true
run: make EXTRA_FLAGS=-Werror ${{ matrix.target }}
- name: Build target (with revision)
if: inputs.release_build == false
run: make EXTRA_FLAGS=-Werror ${{ matrix.target }}_rev
- name: Publish build artifacts
uses: actions/upload-artifact@v3
with:
name: Assets
path: obj/*.hex
retention-days: 60
test:
name: Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get install -y libblocksruntime-dev clang-12
- name: Run sanity checks
run: make EXTRA_FLAGS=-Werror checks
- name: Run all unit tests
run: make EXTRA_FLAGS=-Werror test-all
result:
name: Complete
needs: [build, test]
if: ${{ always() }}
runs-on: ubuntu-22.04
steps:
- name: Check build matrix result
if: ${{ needs.build.result != 'success' }}
run: exit 1
- name: Check test result
if: ${{ needs.test.result != 'success' }}
run: exit 1