Skip to content

Commit 138d5ec

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 138d5ec

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

+7816
-3600
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 45 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,95 @@ 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
92-
run: |
93-
./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} arm-unknown-linux-gnueabihf
94-
95-
- name: Upload artifact
96-
uses: actions/upload-artifact@v3
110+
- uses: taiki-e/install-action@v2
97111
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
112+
tool: cargo-edit,cargo-dev
105113

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
114+
- name: Build binary
115+
run: |
116+
cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}"
117+
# Compilation does not work with current release
118+
cargo install cross --git https://github.com/cross-rs/cross
119+
cross build --target "${{ matrix.target }}" --release ${{ matrix.build_flags }}
115120
116-
- name: Build
121+
- name: Bundle deb
122+
if: matrix.build_deb == true
117123
run: |
118-
./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} aarch64-unknown-linux-gnu
124+
cp -a "target/${{ matrix.target }}/release/bloop-box" target/bloop-box
125+
cargo-deb -v --no-build --target "${{ matrix.target }}" --no-strip
126+
127+
# This is workaround for https://github.com/kornelski/cargo-deb/issues/47
128+
# Patch the generated DEB to have ./ paths compatible with `unattended-upgrade`:
129+
pushd "target/${{ matrix.target }}/debian"
130+
DEB_FILE_NAME=$(ls -1 *.deb | head -n 1)
131+
DATA_ARCHIVE=$(ar t "${DEB_FILE_NAME}"| grep -E '^data\.tar')
132+
ar x "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
133+
tar tf "${DATA_ARCHIVE}"
134+
135+
if [[ "${DATA_ARCHIVE}" == *.xz ]]; then
136+
# Install XZ support that will be needed by TAR
137+
sudo apt-get -y install xz-utils
138+
EXTRA_TAR_ARGS=J
139+
fi
140+
141+
rm -rf tar-hack
142+
mkdir tar-hack
143+
tar -C tar-hack -xf "${DATA_ARCHIVE}"
144+
pushd tar-hack
145+
tar c${EXTRA_TAR_ARGS}f "../${DATA_ARCHIVE}" --owner=0 --group=0 ./*
146+
popd
147+
tar tf "${DATA_ARCHIVE}"
148+
ar r "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
149+
popd
119150

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

126157
release:
127-
needs: [test-for-release, build-armhf, build-arm64]
158+
needs: [test-for-release, build]
128159
name: Semantic Release
129160
runs-on: ubuntu-latest
130161
if: needs.test-for-release.outputs.new_release_published == 'true'
@@ -137,14 +168,18 @@ jobs:
137168
persist-credentials: false
138169

139170
- name: Download Build Artifacts
140-
uses: actions/download-artifact@v3
171+
uses: actions/download-artifact@v4
141172

142173
- name: Install Rust Stable
143174
uses: dtolnay/rust-toolchain@stable
144175

176+
- uses: taiki-e/install-action@v2
177+
with:
178+
tool: cargo-edit
179+
145180
- name: Update version
146181
run: |
147-
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ needs.test-for-release.outputs.new_release_version }}"'"/' Cargo.toml
182+
cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}"
148183
cargo update --package bloop-box
149184
150185
- 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+
label: "Debian package for Raspberry Zero 2 (64 bit)"
12+
- path: deb-armhf/*.deb
13+
label: "Debian package for Raspberry Zero 1 (32 bit)"
14+
- path: emulation-windows-x64/bloop-box.exe
15+
label: "Desktop emulation for Windows (64 bit)"
16+
- path: emulation-linux-x64/bloop-box
17+
label: "Desktop emulation for Linux (64 bit)"
1118
- - '@semantic-release/git'
1219
- assets:
1320
- CHANGELOG.md

0 commit comments

Comments
 (0)