Skip to content

Bump actions/upload-artifact from 3.1.3 to 4.0.0 and actions/download-artifact from 3.0.2 to 4.0.0 #104

Bump actions/upload-artifact from 3.1.3 to 4.0.0 and actions/download-artifact from 3.0.2 to 4.0.0

Bump actions/upload-artifact from 3.1.3 to 4.0.0 and actions/download-artifact from 3.0.2 to 4.0.0 #104

Workflow file for this run

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/[email protected]
- name: Set up Cargo cache
uses: actions/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
with:
fetch-depth: 0
- name: Set up Cargo cache
uses: actions/[email protected]
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/[email protected]
with:
path: /tmp/artifacts
- name: Restructure target directory
run: |
target=$(pwd)/target
pushd /tmp/artifacts
find . -exec ls -hl {};
find . -exec file {};
for d in *-executables
do
rm -Rf $ $target/$(echo $d | sed -e 's/-executables//g')
mv -vf $d $target/$(echo $d | sed -e 's/-executables//g')
done
popd
ls -hl target/
file target/x86_64-unknown-linux-gnu/release/dsmr-rs
file target/arm-unknown-linux-musleabihf/release/dsmr-rs
- 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/[email protected]
if: github.ref == 'refs/heads/main'
with:
name: packages
path: |
target/arm-unknown-linux-musleabihf/debian/
target/x86_64-unknown-linux-gnu/debian/