Bump actions/upload-artifact from 3.1.3 to 4.0.0 and actions/download-artifact from 3.0.2 to 4.0.0 #113
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/[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 | |
# echo Find all files and directories | |
# find . -exec ls -hl {} \; | |
# echo List all file types | |
# find . -type f -exec file {} \; | |
for d in *-executables | |
do | |
arch=$(echo $d | sed -e 's/-executables//g') | |
echo 1 List file types for $arch | |
find . -type f -exec file {} \; | |
mv -vf $d/* $target | |
# rm -Rf $target/$arch | |
# mv -vf $arch $target/ | |
done | |
popd | |
ls -hl target/ | |
# echo Find all files and directories | |
# find . -exec ls -hl {} \; | |
echo 98 List all file types | |
find target/ -type f -exec file {} \; | |
echo 99 List file types of expected files | |
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/ |