Bump taiki-e/setup-cross-toolchain-action from 1.20.0 to 1.21.0 #181
Workflow file for this run
This file contains 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: Build Debian packages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: | |
- arm-unknown-linux-musleabihf | |
- x86_64-unknown-linux-gnu | |
# Consider adding armv7-unknown-linux-musleabihf | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4.1.1 | |
- name: Set up Cargo cache | |
uses: actions/cache@v4.0.1 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install cross-compilation tools | |
uses: taiki-e/setup-cross-toolchain-action@v1.21.0 | |
if: ${{ matrix.target }} != 'x86_64-unknown-linux-gnu' | |
with: | |
target: ${{ matrix.target }} | |
- name: Perform build | |
run: | | |
cargo build --target ${{ matrix.target }} --release --features "" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4.3.1 | |
with: | |
name: ${{ matrix.target }}-executables | |
path: target/**/release/dsmr-rs | |
retention-days: 1 | |
build-packages: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Set up Cargo cache | |
uses: actions/cache@v4.0.1 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Download all build artifacts | |
uses: actions/download-artifact@v4.1.4 | |
with: | |
path: /tmp/artifacts | |
- name: Move executables to target directory | |
run: | | |
archs=("arm-unknown-linux-musleabihf" "x86_64-unknown-linux-gnu") | |
for arch in ${archs[@]}; do | |
echo Copying binary for $arch | |
mkdir -p target/$arch/release | |
cp /tmp/artifacts/$arch-executables/$arch/release/dsmr-rs target/$arch/release/dsmr-rs | |
echo Verifying binary for $arch | |
file target/$arch/release/dsmr-rs | |
done | |
- name: Prepare packaging | |
run: | | |
sudo apt update -y | |
sudo apt install -y dpkg dpkg-dev liblzma-dev libssl-dev | |
cargo install cargo-deb | |
rustup target add arm-unknown-linux-musleabihf | |
- name: Create Debian package | |
run: | | |
cargo deb --target arm-unknown-linux-musleabihf --no-build --no-strip -v | |
cargo deb --target x86_64-unknown-linux-gnu --no-build --no-strip -v | |
- name: Inspect generated packages | |
run: | | |
find target/ -name "*.deb" -exec file {} \; | |
- name: Upload Debian packages | |
uses: actions/upload-artifact@v4.3.1 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: packages | |
path: | | |
target/arm-unknown-linux-musleabihf/debian/ | |
target/x86_64-unknown-linux-gnu/debian/ |