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,90 @@ 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 set-version "${{ needs.test-for-release.outputs.new_release_version }}"
113+ cross build --target "${{ matrix.target }}" --release ${{ matrix.build_flags }}
94114
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
115+ - name : Bundle deb
116+ if : matrix.build_deb == true
117117 run : |
118- ./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} aarch64-unknown-linux-gnu
118+ cargo install cargo-deb
119+ cp -a "target/${{ matrix.target }}/release/bloop-box" target/bloop-box
120+ cargo-deb -v --no-build --target "${{ matrix.target }}" --no-strip
121+
122+ # This is workaround for https://github.com/kornelski/cargo-deb/issues/47
123+ # Patch the generated DEB to have ./ paths compatible with `unattended-upgrade`:
124+ pushd "target/$TARGET/debian"
125+ DEB_FILE_NAME=$(ls -1 *.deb | head -n 1)
126+ DATA_ARCHIVE=$(ar t "${DEB_FILE_NAME}"| grep -E '^data\.tar')
127+ ar x "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
128+ tar tf "${DATA_ARCHIVE}"
129+
130+ if [[ "${DATA_ARCHIVE}" == *.xz ]]; then
131+ # Install XZ support that will be needed by TAR
132+ apt-get -y install -y xz-utils
133+ EXTRA_TAR_ARGS=J
134+ fi
135+
136+ rm -rf tar-hack
137+ mkdir tar-hack
138+ tar -C tar-hack -xf "${DATA_ARCHIVE}"
139+ pushd tar-hack
140+ tar c${EXTRA_TAR_ARGS}f "../${DATA_ARCHIVE}" --owner=0 --group=0 ./*
141+ popd
142+ tar tf "${DATA_ARCHIVE}"
143+ ar r "${DEB_FILE_NAME}" "${DATA_ARCHIVE}"
144+ popd
119145
120- - name : Upload Artifact
121- uses : actions/upload-artifact@v3
146+ - name : Upload artifact
147+ uses : actions/upload-artifact@v4
122148 with :
123- name : deb-arm64
124- path : target/aarch64-unknown-linux-gnu/debian/bloop-box_*_arm64.deb
149+ name : ${{ matrix.name }}
150+ path : ${{ matrix.path }}
125151
126152 release :
127- needs : [test-for-release, build-armhf, build-arm64 ]
153+ needs : [test-for-release, build]
128154 name : Semantic Release
129155 runs-on : ubuntu-latest
130156 if : needs.test-for-release.outputs.new_release_published == 'true'
@@ -137,14 +163,14 @@ jobs:
137163 persist-credentials : false
138164
139165 - name : Download Build Artifacts
140- uses : actions/download-artifact@v3
166+ uses : actions/download-artifact@v4
141167
142168 - name : Install Rust Stable
143169 uses : dtolnay/rust-toolchain@stable
144170
145171 - name : Update version
146172 run : |
147- sed -i '/\[package\]/,/^ version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"$ {{ needs.test-for-release.outputs.new_release_version }}"'"/' Cargo.toml
173+ cargo set- version "$ {{ needs.test-for-release.outputs.new_release_version }}"
148174 cargo update --package bloop-box
149175
150176 - name : Semantic Release
0 commit comments