Repository navigation
126 lines (111 loc) · 4.16 KB
/
Copy pathgithubci.yml
File metadata and controls
126 lines (111 loc) · 4.16 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
name: Build
on:
pull_request:
merge_group:
# push:
# repository_dispatch:
release:
types:
- created
# The repo's default is write (checked via `gh api .../actions/permissions/workflow`),
# so every job here would otherwise get a write-capable GITHUB_TOKEN even
# though only the release-asset upload needs one — and this workflow runs on
# every PR. Every job that runs PR-controlled code (make, the Python tools)
# is read-only and does not persist the checkout token; contents:write lives
# only in the `release` job, which runs on release events and only uploads
# what the build jobs already produced.
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set matrix
id: set-matrix
working-directory: src/boards
run: |
MATRIX_JSON=$(ls -d */ | sed 's/\/$//' | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=$MATRIX_JSON"
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
# The factory-erase UF2 is one file for every board, so it is checked in and
# attached once by the `release` job rather than by each per-board build
# job, which would race deleting and re-uploading the same asset name.
# Not a required status check on master unless a human adds it to branch
# protection.
factory-erase-uf2:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check the committed file matches the generator
run: |
python3 tools/make_factory_erase_uf2.py /tmp/meshtastic_factory_erase.uf2
cmp /tmp/meshtastic_factory_erase.uf2 tools/meshtastic_factory_erase.uf2
build:
needs: set-matrix
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
board: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: true
persist-credentials: false
- name: Install ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@49f4db4520f840e77ab1e99b24cfac2c540a21b1 # v1.14.1
with:
release: '12.3.Rel1'
- name: Install Tools
run: |
pip3 install adafruit-nrfutil uritemplate requests intelhex setuptools
- name: Build
run: |
make BOARD=${{ matrix.board }} all
make BOARD=${{ matrix.board }} copy-artifact
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ matrix.board }}
path: _bin/${{ matrix.board }}
retention-days: ${{ github.event_name == 'release' && 90 || 1 }}
# The only job with write access. It runs no repo code: it re-uploads the
# build jobs' artifacts and the checked-in factory-erase file.
release:
needs: [build, factory-erase-uf2]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Download build artifacts
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
path: _bin
- name: Upload Release Assets
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3
with:
files: |
_bin/*/*_bootloader-*.zip
_bin/*/*_bootloader-*.hex
_bin/*/update-*_bootloader-*.uf2
tools/meshtastic_factory_erase.uf2