-
Notifications
You must be signed in to change notification settings - Fork 1.1k
178 lines (165 loc) · 5.1 KB
/
build.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Build
on:
workflow_dispatch:
push:
paths:
- 'src/**'
- 'examples/**'
- 'lib/**'
- 'hw/**'
- 'tools/get_deps.py'
- 'tools/build.py'
- '.github/actions/**'
- '.github/workflows/build.yml'
- '.github/workflows/build_util.yml'
- '.github/workflows/ci_set_matrix.py'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'examples/**'
- 'lib/**'
- 'hw/**'
- 'tools/get_deps.py'
- 'tools/build.py'
- '.github/actions/**'
- '.github/workflows/build.yml'
- '.github/workflows/build_util.yml'
- '.github/workflows/ci_set_matrix.py'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
json: ${{ steps.set-matrix-json.outputs.matrix }}
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Checkout TinyUSB
uses: actions/checkout@v4
- name: Generate matrix json
id: set-matrix-json
run: |
MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py)
echo "matrix=$MATRIX_JSON"
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
# ---------------------------------------
# Build CMake
# ---------------------------------------
cmake:
needs: set-matrix
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
toolchain:
- 'aarch64-gcc'
#- 'arm-clang'
#- 'arm-gcc'
- 'msp430-gcc'
- 'riscv-gcc'
# if: >-
# github.event_name == 'pull_request' ||
# (github.event_name == 'push' && github.ref == 'refs/heads/master')
with:
build-system: 'cmake'
toolchain: ${{ matrix.toolchain }}
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
# ---------------------------------------
# Build Make
# ---------------------------------------
make:
if: >-
github.event_name == 'pull_request' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master')
needs: set-matrix
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
toolchain:
- 'aarch64-gcc'
#- 'arm-clang'
- 'arm-gcc'
- 'msp430-gcc'
- 'riscv-gcc'
with:
build-system: 'make'
toolchain: ${{ matrix.toolchain }}
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
# ---------------------------------------
# Build Make on Windows/MacOS
# ---------------------------------------
make-os:
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
with:
os: ${{ matrix.os }}
build-system: 'make'
toolchain: 'arm-gcc'
build-args: '["-bstm32f411disco"]'
# ---------------------------------------
# Build Espressif
# ---------------------------------------
espressif:
uses: ./.github/workflows/build_util.yml
if: false
strategy:
fail-fast: false
matrix:
board:
# ESP32-S2
- 'espressif_kaluga_1'
# ESP32-S3 skip since devkitm is also compiled in hil-test workflow
#- 'espressif_s3_devkitm'
with:
build-system: 'cmake'
toolchain: 'esp-idf'
toolchain_url: 'v5.1.1'
build-args: '["-b${{ matrix.board }}"]'
# ---------------------------------------
# Build IAR on HFP self-hosted
# ---------------------------------------
arm-iar:
needs: set-matrix
if: github.repository_owner == 'hathach'
runs-on: [self-hosted, Linux, X64, hifiphile]
env:
BUILD_ARGS: ${{ fromJSON(needs.set-matrix.outputs.json)[arm-iar].family }}
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Checkout TinyUSB
uses: actions/checkout@v4
- run: |
echo "1"
BUILD_ARGS=$(echo ${{ fromJSON(needs.set-matrix.outputs.json).arm-iar.family }} | jq -R -s .)
echo $BUILD_ARGS
# echo "2"
# echo ${{ fromJSON(needs.set-matrix.outputs.json)['arm-iar'] }}
# echo "3"
# echo ${{ fromJSON(needs.set-matrix.outputs.json)['arm-iar'].family }}
# - name: Get Dependencies
# run: python3 tools/get_deps.py $BUILD_ARGS
#
# - name: Build
# run: python3 tools/build.py --toolchain iar $BUILD_ARGS
#
# - name: Test on actual hardware (hardware in the loop)
# if: >-
# github.event_name == 'pull_request' ||
# (github.event_name == 'push' && github.ref == 'refs/heads/master')
# run: |
# python3 test/hil/hil_test.py hfp.json