-
Notifications
You must be signed in to change notification settings - Fork 12
176 lines (169 loc) · 6.02 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
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:
working-directory: ./micro-rdk-installer
shell: bash
steps:
- name: Checkout main branch code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.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 --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@v2
with:
name: micro-rdk-installer-${{ matrix.job.file_suffix }}
path: micro-rdk-installer/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:
working-directory: ./micro-rdk-installer
shell: bash
steps:
- name: Checkout main branch code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
override: true
target: aarch64-unknown-linux-gnu
default: true
- name: Build installer binary
run: |
cargo build --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@v2
with:
name: micro-rdk-installer-arm64-linux
path: micro-rdk-installer/micro-rdk-installer-arm64-linux
build-micro-RDK:
runs-on: [x64, qemu-host]
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 && export MICRO_RDK_USE_NVS=true && . "$IDF_PATH"/export.sh && . "$ESP_ROOT"/export-esp.sh && make build-esp32-with-cred-bin'
cp examples/target/esp32-server-with-cred.bin micro-rdk-esp32-server.bin
- name: Upload release
uses: actions/upload-artifact@v2
with:
name: micro-rdk-esp32-server.bin
path: micro-rdk-esp32-server.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@v3
with:
name: micro-rdk-installer-arm64-linux
- name: Download amd64-linux installer
uses: actions/download-artifact@v3
with:
name: micro-rdk-installer-amd64-linux
- name: Download macos installer
uses: actions/download-artifact@v3
with:
name: micro-rdk-installer-macos
- name: Download windows installer
uses: actions/download-artifact@v3
with:
name: micro-rdk-installer-windows.exe
- name: Download micro-RDK binary
uses: actions/download-artifact@v3
with:
name: micro-rdk-esp32-server.bin
- 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-installer-windows.exe >> sha256sums.txt
sha256sum micro-rdk-esp32-server.bin >> sha256sums.txt
- name: Publish release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: |
micro-rdk-installer-arm64-linux
micro-rdk-installer-amd64-linux
micro-rdk-installer-macos
micro-rdk-installer-windows.exe
micro-rdk-esp32-server.bin
sha256sums.txt
prerelease: ${{ steps.check-tag.outputs.match }}