feat: major rewrite and protocol v3 implementation #62
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: sudo apt-get install libasound2-dev | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo check | |
| - run: cargo check --no-default-features --features hardware-emulation | |
| fmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - run: sudo apt-get install libasound2-dev | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo fmt --all -- --check | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - run: sudo apt-get install libasound2-dev | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo clippy -- -D warnings | |
| - run: cargo clippy --no-default-features --features hardware-emulation -- -D warnings | |
| test-for-release: | |
| needs: [check, fmt, clippy] | |
| name: Test for Release | |
| runs-on: ubuntu-latest | |
| if: github.actor != 'sbosnick-bot' | |
| outputs: | |
| new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
| new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Semantic Release | |
| uses: cycjimmy/semantic-release-action@v4 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| id: semantic | |
| with: | |
| dry_run: true | |
| build: | |
| needs: [test-for-release] | |
| if: needs.test-for-release.outputs.new_release_published == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: arm-unknown-linux-gnueabihf | |
| build_flags: "--features with-bindgen" | |
| name: deb-armhf | |
| path: target/arm-unknown-linux-gnueabihf/debian/bloop-box_*_armhf.deb | |
| build_deb: true | |
| - target: aarch64-unknown-linux-gnu | |
| build_flags: "" | |
| name: deb-arm64 | |
| path: target/aarch64-unknown-linux-gnu/debian/bloop-box_*_arm64.deb | |
| build_deb: true | |
| - target: x86_64-unknown-linux-gnu | |
| build_flags: "--no-default-features --features hardware-emulation" | |
| features: "hardware-emulation" | |
| name: emulation-linux-x64 | |
| path: target/x86_64-unknown-linux-gnu/release/bloop-box | |
| build_deb: false | |
| - target: x86_64-pc-windows-gnu | |
| build_flags: "--no-default-features --features hardware-emulation" | |
| name: emulation-windows-x64 | |
| path: target/x86_64-pc-windows-gnu/release/bloop-box.exe | |
| build_deb: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install Rust Stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build binary | |
| run: | | |
| cargo install cargo-edit | |
| cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}" | |
| cross build --target "${{ matrix.target }}" --release ${{ matrix.build_flags }} | |
| - name: Bundle deb | |
| if: matrix.build_deb == true | |
| run: | | |
| cargo install cargo-deb | |
| cp -a "target/${{ matrix.target }}/release/bloop-box" target/bloop-box | |
| cargo-deb -v --no-build --target "${{ matrix.target }}" --no-strip | |
| # This is workaround for https://github.com/kornelski/cargo-deb/issues/47 | |
| # Patch the generated DEB to have ./ paths compatible with `unattended-upgrade`: | |
| pushd "target/$TARGET/debian" | |
| DEB_FILE_NAME=$(ls -1 *.deb | head -n 1) | |
| DATA_ARCHIVE=$(ar t "${DEB_FILE_NAME}"| grep -E '^data\.tar') | |
| ar x "${DEB_FILE_NAME}" "${DATA_ARCHIVE}" | |
| tar tf "${DATA_ARCHIVE}" | |
| if [[ "${DATA_ARCHIVE}" == *.xz ]]; then | |
| # Install XZ support that will be needed by TAR | |
| apt-get -y install -y xz-utils | |
| EXTRA_TAR_ARGS=J | |
| fi | |
| rm -rf tar-hack | |
| mkdir tar-hack | |
| tar -C tar-hack -xf "${DATA_ARCHIVE}" | |
| pushd tar-hack | |
| tar c${EXTRA_TAR_ARGS}f "../${DATA_ARCHIVE}" --owner=0 --group=0 ./* | |
| popd | |
| tar tf "${DATA_ARCHIVE}" | |
| ar r "${DEB_FILE_NAME}" "${DATA_ARCHIVE}" | |
| popd | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }} | |
| path: ${{ matrix.path }} | |
| release: | |
| needs: [test-for-release, build] | |
| name: Semantic Release | |
| runs-on: ubuntu-latest | |
| if: needs.test-for-release.outputs.new_release_published == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Install Rust Stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Update version | |
| run: | | |
| cargo install cargo-edit | |
| cargo set-version "${{ needs.test-for-release.outputs.new_release_version }}" | |
| cargo update --package bloop-box | |
| - name: Semantic Release | |
| uses: cycjimmy/semantic-release-action@v4 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| id: semantic | |
| with: | |
| extra_plugins: | | |
| @semantic-release/changelog@6.0 | |
| @semantic-release/git@10.0 |