-
Notifications
You must be signed in to change notification settings - Fork 9
153 lines (150 loc) · 6.21 KB
/
c-cpp.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
name: Build GNSSPeriph
on:
push:
pull_request:
workflow_dispatch:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-20.04
container: ardupilot/ardupilot-dev-chibios:latest
env:
HERE3_CUBEID_TAG: v1.9
HERE4_CUBEID_TAG: v1.9
steps:
- name: Install dependencies
run: |
sudo apt update
type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh jq -y
pip install intelhex
- uses: actions/checkout@v3
with:
submodules: recursive
- run: git config --system --add safe.directory /__w/GNSSPeriph-release/GNSSPeriph-release
- name: Download CubeID firmware for Here3+
run: |
export HERE3_ASSET_ID=$(gh api \
-H "Accept: application/vnd.github.v3.raw" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
"repos/cubepilot/cubeid/releases" | jq -r '.[] | select(.tag_name==env.HERE3_CUBEID_TAG) | .assets[] | select(.name=="serial_fw_update.bin") | .id')
echo "HERE3_ASSET_ID=$HERE3_ASSET_ID"
gh api \
-H "Accept: application/octet-stream" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
"repos/cubepilot/cubeid/releases/assets/$HERE3_ASSET_ID" > fw_update.bin
ls -al fw_update.bin
mkdir -p ardupilot/ROMFS_custom/
mv fw_update.bin ardupilot/ROMFS_custom/CubeID_fw.bin
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
NOW=$(date -u +"%F-%T")
echo "::set-output name=timestamp::${NOW}"
- name: ccache cache files
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
. .github/workflows/ccache.env
- name: configure
run: ./waf configure --board Here3+ -g
- name: build
run: ./waf clean && ./waf AP_Periph
- name: configure bootloader
run: ./waf configure --board Here3+ --bootloader
- name: build
run: ./waf bootloader
- name: copy Here3+ files to release
run: |
mkdir -p release/
cp build/Here3+/bin/AP_Periph.bin release/Here3Plus_FW.bin
cp build/Here3+/bin/AP_Periph_with_bl.hex release/Here3Plus_FW_with_bl.hex
cp build/Here3+/bin/AP_Periph release/Here3Plus_FW.elf
cp build/Here3+/bin/AP_Periph.apj release/Here3+_FW.apj
- name: Download CubeID firmware for Here4
run: |
export HERE4_ASSET_ID=$(gh api \
-H "Accept: application/vnd.github.v3.raw" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
"repos/cubepilot/cubeid/releases" | jq -r '.[] | select(.tag_name==env.HERE4_CUBEID_TAG) | .assets[] | select(.name=="fem_fw_update.bin") | .id')
echo "HERE4_ASSET_ID=$HERE4_ASSET_ID"
gh api \
-H "Accept: application/octet-stream" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
"repos/cubepilot/cubeid/releases/assets/$HERE4_ASSET_ID" > fw_update.bin
ls -al fw_update.bin
mkdir -p ardupilot/ROMFS_custom/
mv fw_update.bin ardupilot/ROMFS_custom/CubeID_fw.bin
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: configure
run: ./waf configure --board Here4 -g
- name: build
run: ./waf clean && ./waf AP_Periph
- name: configure bootloader
run: ./waf configure --board Here4 --bootloader
- name: build
run: ./waf bootloader
- name: copy Here4 files to release
run: |
cp build/Here4/bin/AP_Periph.bin release/Here4_FW.bin
cp build/Here4/bin/AP_Periph_with_bl.hex release/Here4_FW_with_bl.hex
cp build/Here4/bin/AP_Periph release/Here4_FW.elf
cp build/Here4/bin/AP_Periph.apj release/Here4_FW.apj
- name: configure
run: ./waf configure --board HerePro -g
- name: build
run: ./waf clean && ./waf AP_Periph
- name: configure bootloader
run: ./waf configure --board HerePro --bootloader
- name: build
run: ./waf bootloader
- name: copy HerePro files to release
run: |
cp build/HerePro/bin/AP_Periph.bin release/HerePro_FW.bin
cp build/HerePro/bin/AP_Periph_with_bl.hex release/HerePro_FW_with_bl.hex
cp build/HerePro/bin/AP_Periph release/HerePro_FW.elf
cp build/HerePro/bin/AP_Periph.apj release/HerePro_FW.apj
- name: configure
run: ./waf configure --board HereProAlpha -g
- name: build
run: ./waf clean && ./waf AP_Periph
- name: copy HereProAlpha files to release
run: |
cp build/HereProAlpha/bin/AP_Periph.bin release/HereProAlpha_FW.bin
cp build/HereProAlpha/bin/AP_Periph release/HereProAlpha_FW.elf
cp build/HereProAlpha/bin/AP_Periph.apj release/HereProAlpha_FW.apj
- name: package release
run: |
cd release
zip -r ../GNSSPeriph.zip .
cd ..
- name: Upload Build Artifacts
uses: actions/[email protected]
with:
# Artifact name
name: GNSSPeriph
# A file, directory or wildcard pattern that describes what to upload
path: release/
# upload to github releases
- name: Upload Release Assets
uses: actions/upload-release-asset@latest
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: GNSSPeriph.zip
asset_path: GNSSPeriph.zip
asset_content_type: application/zip