-
Notifications
You must be signed in to change notification settings - Fork 1
192 lines (154 loc) · 5.43 KB
/
release.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
name: Release
on:
push:
branches:
- main
tags: ['v*']
pull_request:
branches:
- main
paths:
- .github/workflows/release.yml
env:
# renovate: datasource=github-releases depName=EmbarkStudios/cargo-about
CARGO_ABOUT_VERSION: 0.6.4
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: true
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
steps:
- uses: actions/[email protected]
- name: install apt depenedencies
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: install aarch64 linker
if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Get Rust toolchain
id: toolchain
working-directory: .
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
targets: ${{ matrix.target }}
- uses: Swatinem/[email protected]
- name: install cargo-about
run: |
cargo install --locked cargo-about --version ${{ env.CARGO_ABOUT_VERSION }}
- name: Build
run: |
cargo build --target=${{ matrix.target }} --release --locked
- name: Rename binaries
run: |
mkdir bin
kble_bins=("kble" "kble-c2a" "kble-dump" "kble-eb90" "kble-serialport" "kble-tcp")
for b in "${kble_bins[@]}" ; do
cp "./target/${{ matrix.target }}/release/${b}" "./bin/${b}-${{ matrix.target }}"
done
ls -lh ./bin
- uses: actions/[email protected]
with:
name: release-executable-${{ matrix.target }}
if-no-files-found: error
path: ./bin/
build_kble_serialport_win:
name: build / kble-serialport.exe
# C2A Boom ecosystem does **NOT** support native Windows environment.
# However, WSL2 environment is supported and has many use cases in the real world.
# Here, there are difficulties in running kble-serialport inside WSL2,
# a component that interfaces with external hardware (USB-RS devices).
# Although it is possible to show a Windows host USB devices
# to a WSL2 Linux VM using the usbipd-win project, this is still a bit unstable.
# Also, kble-serialport is a very small component that does not need to be updated frequently for practical use.
# For these reasons, we currently choose to run only kble-serialport on Windows host.
runs-on: windows-2022
env:
TARGET: x86_64-pc-windows-msvc
steps:
- uses: actions/[email protected]
- name: Get Rust toolchain
id: toolchain
working-directory: .
shell: bash
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
targets: ${{ env.TARGET }}
- uses: Swatinem/[email protected]
- name: install cargo-about
run: |
cargo install --locked cargo-about --version ${{ env.CARGO_ABOUT_VERSION }}
- name: Build
run: |
cargo build --target=${{ env.TARGET }} -p kble-serialport --release --locked
- name: Rename binary
shell: bash
run: |
mkdir bin
cp "./target/${{ env.TARGET }}/release/kble-serialport.exe" "./bin/kble-serialport-${{ env.TARGET }}.exe"
ls -lh ./bin
- uses: actions/[email protected]
with:
name: release-executable-${{ env.TARGET }}
if-no-files-found: error
path: ./bin/
publish_dry_run:
name: publish (dry-run)
runs-on: ubuntu-24.04
steps:
- uses: actions/[email protected]
- name: Get Rust toolchain
id: toolchain
working-directory: .
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
- uses: Swatinem/[email protected]
- name: install cargo-about
run: |
cargo install --locked cargo-about --version ${{ env.CARGO_ABOUT_VERSION }}
- name: cargo publish (dry-run)
run: |
crates=("kble" "kble-socket" "kble-c2a" "kble-dump" "kble-eb90" "kble-serialport" "kble-tcp")
for c in "${crates[@]}" ; do
cargo publish --dry-run -p "${c}"
echo ""
# shellcheck disable=SC2086
ls -lh ./target/package/${c}-*/
done
ls -lh ./target/package
release:
name: Release
needs: [ build, build_kble_serialport_win, publish_dry_run ]
permissions:
contents: write
runs-on: ubuntu-24.04
steps:
- uses: actions/[email protected]
with:
pattern: release-executable-*
merge-multiple: true
- run: chmod +x kble-*
- run: ls -lh
- name: Release to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/[email protected]
with:
draft: true
fail_on_unmatched_files: true
generate_release_notes: true
files: |
kble*