-
Notifications
You must be signed in to change notification settings - Fork 12
197 lines (189 loc) · 6.71 KB
/
publish.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: publish
on:
push:
tags:
- "v*"
jobs:
tests:
uses: ./.github/workflows/test.yml
build-installer:
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-gnu, file_suffix: amd64-linux, os: ubuntu-latest}
- { target: x86_64-apple-darwin, file_suffix: macos, os: macos-latest}
- { target: x86_64-pc-windows-gnu, file_suffix: windows.exe, os: windows-latest}
runs-on: ${{ matrix.job.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout main branch code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.75.0
override: true
target: ${{ matrix.job.target }}
default: true
- name: Install x86_64 linux dependencies
if: ${{ matrix.job.os == 'ubuntu-latest' }}
run: |
sudo apt-get install libudev-dev pkg-config libssl-dev
- name: Install MacOS dependencies
if: ${{ matrix.job.os == 'macos-latest' }}
run: |
brew install coreutils
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
- name: Build installer binary
run: |
cargo build -p micro-rdk-installer --release --target ${{ matrix.job.target }} --locked
- name: Rename result
if: ${{ matrix.job.os != 'windows-latest' }}
run: |
cp target/${{ matrix.job.target }}/release/micro-rdk-installer micro-rdk-installer-${{ matrix.job.file_suffix }}
- name: Rename result (Windows)
if: ${{ matrix.job.os == 'windows-latest' }}
run: |
cp target/${{ matrix.job.target }}/release/micro-rdk-installer.exe micro-rdk-installer-${{ matrix.job.file_suffix }}
- name: Check release type
id: check-tag
run: |
if echo ${{ github.event.ref }} | grep -Eq '^refs/tags/v.*rc[0-9]{1}$'; then
echo "is_rc_release=true" >> $GITHUB_OUTPUT
else
echo "is_rc_release=false" >> $GITHUB_OUTPUT
fi
- name: Upload release
uses: actions/upload-artifact@v4
with:
name: micro-rdk-installer-${{ matrix.job.file_suffix }}
path: micro-rdk-installer-${{ matrix.job.file_suffix }}
# github-actions does not have a runner that supports arm64 linux and cross-compilation does not seem to work for the ring crate
build-installer-arm64-linux:
runs-on: [buildjet-8vcpu-ubuntu-2204-arm]
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:arm64
needs: tests
defaults:
run:
shell: bash
steps:
- name: Checkout main branch code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.75.0
override: true
target: aarch64-unknown-linux-gnu
default: true
- name: Build installer binary
run: |
cargo build -p micro-rdk-installer --release --locked --target aarch64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/release/micro-rdk-installer micro-rdk-installer-arm64-linux
- name: Upload release
uses: actions/upload-artifact@v4
with:
name: micro-rdk-installer-arm64-linux
path: micro-rdk-installer-arm64-linux
build-micro-RDK:
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
needs: tests
steps:
- name : Checkout main branch code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Build esp32 binary
run: |
bash -c 'git config --global --add safe.directory "$ESP_ROOT"/esp-idf && . "$IDF_PATH"/export.sh && . "$ESP_ROOT"/export-esp.sh && make build-esp32-bin && cargo +esp build -p micro-rdk-ffi --target=xtensa-esp32-espidf -Zbuild-std=std,panic_abort --locked --release'
cp target/xtensa-esp32-espidf/micro-rdk-server-esp32.bin micro-rdk-server-esp32.bin
cp target/xtensa-esp32-espidf/release/libmicrordk.a libmicrordk.a
cp micro-rdk-ffi/include/micrordk.h micrordk.h
- name: Upload release Lib
uses: actions/upload-artifact@v4
with:
name: micro-rdk
path: |
libmicrordk.a
micrordk.h
micro-rdk-server-esp32.bin
publish-release:
needs: [build-installer, build-installer-arm64-linux, build-micro-RDK]
runs-on: ubuntu-latest
steps:
- name: Check release type
id: check-tag
run: |
if echo ${{ github.event.ref }} | grep -Eq '^refs/tags/v.*rc[0-9]{1}$'; then
echo "match=true" >> $GITHUB_OUTPUT
else
echo "match=false" >> $GITHUB_OUTPUT
fi
- name: Download arm64-linux installer
uses: actions/download-artifact@v4
with:
name: micro-rdk-installer-arm64-linux
- name: Download amd64-linux installer
uses: actions/download-artifact@v4
with:
name: micro-rdk-installer-amd64-linux
- name: Download macos installer
uses: actions/download-artifact@v4
with:
name: micro-rdk-installer-macos
- name: Download windows installer
uses: actions/download-artifact@v4
with:
name: micro-rdk-installer-windows.exe
- name: Download Micro-RDK
uses: actions/download-artifact@v4
with:
name: micro-rdk
- name: Zip FFI assets
run: |
zip micro-rdk-lib.zip libmicrordk.a micrordk.h
- name: Compute checksums
run: |
sha256sum micro-rdk-installer-arm64-linux >> sha256sums.txt
sha256sum micro-rdk-installer-amd64-linux >> sha256sums.txt
sha256sum micro-rdk-installer-macos >> sha256sums.txt
sha256sum micro-rdk-server-esp32.bin >> sha256sums.txt
sha256sum micro-rdk-installer-windows.exe >> sha256sums.txt
sha256sum micro-rdk-lib.zip >> sha256sums.txt
- name: Update CHANGELOG
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
ignorePreReleases: "false"
fetchViaCommits: "true"
- name: Publish release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
micro-rdk-installer-arm64-linux
micro-rdk-installer-amd64-linux
micro-rdk-installer-macos
micro-rdk-server-esp32.bin
micro-rdk-lib.zip
sha256sums.txt
micro-rdk-installer-windows.exe
prerelease: ${{ steps.check-tag.outputs.match }}
replacesArtifacts: true
allowUpdates: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changelog }}