Skip to content

Commit f8a65ba

Browse files
committed
feat: major rewrite and protocol v3 implementation
BREAKING CHANGE: Your server needs to support the Bloop v3 protocol. Additionally you need to update your bloop-box-data to conform to the new structure.
1 parent c9a777c commit f8a65ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+7811
-3601
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,23 @@ on:
55
branches:
66
- main
77

8-
env:
9-
RUST_BACKTRACE: 1
10-
118
jobs:
129
check:
1310
name: Check
1411
runs-on: ubuntu-latest
1512
steps:
16-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1714
- uses: dtolnay/rust-toolchain@stable
1815
- run: sudo apt-get install libasound2-dev
1916
- uses: Swatinem/rust-cache@v2
2017
- run: cargo check
18+
- run: cargo check --no-default-features --features hardware-emulation
2119

2220
fmt:
2321
name: Rustfmt
2422
runs-on: ubuntu-latest
2523
steps:
26-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2725
- uses: dtolnay/rust-toolchain@stable
2826
with:
2927
components: rustfmt
@@ -35,13 +33,14 @@ jobs:
3533
name: Clippy
3634
runs-on: ubuntu-latest
3735
steps:
38-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3937
- uses: dtolnay/rust-toolchain@stable
4038
with:
4139
components: clippy
4240
- run: sudo apt-get install libasound2-dev
4341
- uses: Swatinem/rust-cache@v2
4442
- run: cargo clippy -- -D warnings
43+
- run: cargo clippy --no-default-features --features hardware-emulation -- -D warnings
4544

4645
test-for-release:
4746
needs: [check, fmt, clippy]
@@ -55,7 +54,7 @@ jobs:
5554

5655
steps:
5756
- name: Checkout
58-
uses: actions/checkout@v3
57+
uses: actions/checkout@v4
5958
with:
6059
fetch-depth: 0
6160
persist-credentials: false
@@ -68,63 +67,92 @@ jobs:
6867
with:
6968
dry_run: true
7069

71-
- name: Update version
72-
if: steps.semantic.outputs.new_release_published == 'true'
73-
run: |
74-
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ steps.semantic.outputs.new_release_version }}"'"/' Cargo.toml
75-
76-
build-armhf:
70+
build:
7771
needs: [test-for-release]
7872
if: needs.test-for-release.outputs.new_release_published == 'true'
7973
runs-on: ubuntu-latest
8074

75+
strategy:
76+
matrix:
77+
include:
78+
- target: arm-unknown-linux-gnueabihf
79+
build_flags: "--features with-bindgen"
80+
name: deb-armhf
81+
path: target/arm-unknown-linux-gnueabihf/debian/bloop-box_*_armhf.deb
82+
build_deb: true
83+
- target: aarch64-unknown-linux-gnu
84+
build_flags: ""
85+
name: deb-arm64
86+
path: target/aarch64-unknown-linux-gnu/debian/bloop-box_*_arm64.deb
87+
build_deb: true
88+
- target: x86_64-unknown-linux-gnu
89+
build_flags: "--no-default-features --features hardware-emulation"
90+
features: "hardware-emulation"
91+
name: emulation-linux-x64
92+
path: target/x86_64-unknown-linux-gnu/release/bloop-box
93+
build_deb: false
94+
- target: x86_64-pc-windows-gnu
95+
build_flags: "--no-default-features --features hardware-emulation"
96+
name: emulation-windows-x64
97+
path: target/x86_64-pc-windows-gnu/release/bloop-box.exe
98+
build_deb: false
99+
81100
steps:
82101
- name: Checkout
83-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
84103
with:
85104
fetch-depth: 0
86105
persist-credentials: false
87106

88107
- name: Install Rust Stable
89108
uses: dtolnay/rust-toolchain@stable
90109

91-
- name: Build
110+
- name: Build binary
92111
run: |
93-
./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} arm-unknown-linux-gnueabihf
112+
cargo install cargo-edit
113+
cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}"
114+
cargo install cross --git https://github.com/cross-rs/cross
115+
cross build --target "${{ matrix.target }}" --release ${{ matrix.build_flags }}
94116
95-
- name: Upload artifact
96-
uses: actions/upload-artifact@v3
97-
with:
98-
name: deb-armhf
99-
path: target/arm-unknown-linux-gnueabihf/debian/bloop-box_*_armhf.deb
100-
101-
build-arm64:
102-
needs: [test-for-release]
103-
if: needs.test-for-release.outputs.new_release_published == 'true'
104-
runs-on: ubuntu-latest
105-
106-
steps:
107-
- name: Checkout
108-
uses: actions/checkout@v3
109-
with:
110-
fetch-depth: 0
111-
persist-credentials: false
112-
113-
- name: Install Rust Stable
114-
uses: dtolnay/rust-toolchain@stable
115-
116-
- name: Build
117+
- name: Bundle deb
118+
if: matrix.build_deb == true
117119
run: |
118-
./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} aarch64-unknown-linux-gnu
120+
cargo install cargo-deb
121+
cp -a "target/${{ matrix.target }}/release/bloop-box" target/bloop-box
122+
cargo-deb -v --no-build --target "${{ matrix.target }}" --no-strip
123+
124+
# This is workaround for https://github.com/kornelski/cargo-deb/issues/47
125+
# Patch the generated DEB to have ./ paths compatible with `unattended-upgrade`:
126+
pushd "target/${{ matrix.target }}/debian"
127+
DEB_FILE_NAME=$(ls -1 *.deb | head -n 1)
128+
DATA_ARCHIVE=$(ar t "${DEB_FILE_NAME}"| grep -E '^data\.tar')
129+
ar x "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
130+
tar tf "${DATA_ARCHIVE}"
131+
132+
if [[ "${DATA_ARCHIVE}" == *.xz ]]; then
133+
# Install XZ support that will be needed by TAR
134+
sudo apt-get -y install xz-utils
135+
EXTRA_TAR_ARGS=J
136+
fi
137+
138+
rm -rf tar-hack
139+
mkdir tar-hack
140+
tar -C tar-hack -xf "${DATA_ARCHIVE}"
141+
pushd tar-hack
142+
tar c${EXTRA_TAR_ARGS}f "../${DATA_ARCHIVE}" --owner=0 --group=0 ./*
143+
popd
144+
tar tf "${DATA_ARCHIVE}"
145+
ar r "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
146+
popd
119147

120-
- name: Upload Artifact
121-
uses: actions/upload-artifact@v3
148+
- name: Upload artifact
149+
uses: actions/upload-artifact@v4
122150
with:
123-
name: deb-arm64
124-
path: target/aarch64-unknown-linux-gnu/debian/bloop-box_*_arm64.deb
151+
name: ${{ matrix.name }}
152+
path: ${{ matrix.path }}
125153

126154
release:
127-
needs: [test-for-release, build-armhf, build-arm64]
155+
needs: [test-for-release, build]
128156
name: Semantic Release
129157
runs-on: ubuntu-latest
130158
if: needs.test-for-release.outputs.new_release_published == 'true'
@@ -137,14 +165,15 @@ jobs:
137165
persist-credentials: false
138166

139167
- name: Download Build Artifacts
140-
uses: actions/download-artifact@v3
168+
uses: actions/download-artifact@v4
141169

142170
- name: Install Rust Stable
143171
uses: dtolnay/rust-toolchain@stable
144172

145173
- name: Update version
146174
run: |
147-
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ needs.test-for-release.outputs.new_release_version }}"'"/' Cargo.toml
175+
cargo install cargo-edit
176+
cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}"
148177
cargo update --package bloop-box
149178
150179
- name: Semantic Release

.github/workflows/pull-request.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
workflow_dispatch:
55
pull_request:
66

7-
env:
8-
RUST_BACKTRACE: 1
9-
107
jobs:
118
check:
129
name: Check
@@ -17,6 +14,7 @@ jobs:
1714
- run: sudo apt-get install libasound2-dev
1815
- uses: Swatinem/rust-cache@v2
1916
- run: cargo check
17+
- run: cargo check --no-default-features --features hardware-emulation
2018

2119
fmt:
2220
name: Rustfmt
@@ -41,3 +39,4 @@ jobs:
4139
- run: sudo apt-get install libasound2-dev
4240
- uses: Swatinem/rust-cache@v2
4341
- run: cargo clippy -- -D warnings
42+
- run: cargo clippy --no-default-features --features hardware-emulation -- -D warnings

.releaserc.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ plugins:
77
- '@semantic-release/changelog'
88
- - '@semantic-release/github'
99
- assets:
10-
- deb-*/*.deb
10+
- path: deb-arm64/*.deb
11+
name: "Debian package for Raspberry Zero 2 (64 bit)"
12+
- path: deb-armhf/*.deb
13+
name: "Debian package for Raspberry Zero 1 (32 bit)"
14+
- path: emulation-windows-x64/bloop-box.exe
15+
name: "Desktop emulation for Windows (64 bit)"
16+
- path: emulation-linux-x64/bloop-box
17+
name: "Desktop emulation for Linux (64 bit)"
1118
- - '@semantic-release/git'
1219
- assets:
1320
- CHANGELOG.md

0 commit comments

Comments
 (0)