55 branches :
66 - main
77
8- env :
9- RUST_BACKTRACE : 1
10-
118jobs :
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]
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,91 @@ 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+ cross build --target "${{ matrix.target }}" --release ${{ matrix.build_flags }}
94115
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
116+ - name : Bundle deb
117+ if : matrix.build_deb == true
117118 run : |
118- ./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} aarch64-unknown-linux-gnu
119+ cargo install cargo-deb
120+ cp -a "target/${{ matrix.target }}/release/bloop-box" target/bloop-box
121+ cargo-deb -v --no-build --target "${{ matrix.target }}" --no-strip
122+
123+ # This is workaround for https://github.com/kornelski/cargo-deb/issues/47
124+ # Patch the generated DEB to have ./ paths compatible with `unattended-upgrade`:
125+ pushd "target/$TARGET/debian"
126+ DEB_FILE_NAME=$(ls -1 *.deb | head -n 1)
127+ DATA_ARCHIVE=$(ar t "${DEB_FILE_NAME}"| grep -E '^data\.tar')
128+ ar x "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
129+ tar tf "${DATA_ARCHIVE}"
130+
131+ if [[ "${DATA_ARCHIVE}" == *.xz ]]; then
132+ # Install XZ support that will be needed by TAR
133+ apt-get -y install -y xz-utils
134+ EXTRA_TAR_ARGS=J
135+ fi
136+
137+ rm -rf tar-hack
138+ mkdir tar-hack
139+ tar -C tar-hack -xf "${DATA_ARCHIVE}"
140+ pushd tar-hack
141+ tar c${EXTRA_TAR_ARGS}f "../${DATA_ARCHIVE}" --owner=0 --group=0 ./*
142+ popd
143+ tar tf "${DATA_ARCHIVE}"
144+ ar r "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
145+ popd
119146
120- - name : Upload Artifact
121- uses : actions/upload-artifact@v3
147+ - name : Upload artifact
148+ uses : actions/upload-artifact@v4
122149 with :
123- name : deb-arm64
124- path : target/aarch64-unknown-linux-gnu/debian/bloop-box_*_arm64.deb
150+ name : ${{ matrix.name }}
151+ path : ${{ matrix.path }}
125152
126153 release :
127- needs : [test-for-release, build-armhf, build-arm64 ]
154+ needs : [test-for-release, build]
128155 name : Semantic Release
129156 runs-on : ubuntu-latest
130157 if : needs.test-for-release.outputs.new_release_published == 'true'
@@ -137,14 +164,15 @@ jobs:
137164 persist-credentials : false
138165
139166 - name : Download Build Artifacts
140- uses : actions/download-artifact@v3
167+ uses : actions/download-artifact@v4
141168
142169 - name : Install Rust Stable
143170 uses : dtolnay/rust-toolchain@stable
144171
145172 - name : Update version
146173 run : |
147- sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ needs.test-for-release.outputs.new_release_version }}"'"/' Cargo.toml
174+ cargo install cargo-edit
175+ cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}"
148176 cargo update --package bloop-box
149177
150178 - name : Semantic Release
0 commit comments