name: linux-release
on:
push:
tags:
- "*"
jobs:
build:
name: Build on Linux
container: node:alpine
runs-on: ubuntu-20.04
env:
RUST_BACKTRACE: "full"
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install dependencies
run: |
apk add --no-cache build-base dbus-x11 dbus-dev openssl-dev perl tar
- uses: Swatinem/rust-cache@v2
with:
key: ubuntu-20.04
- name: Build
env:
RUSTFLAGS: "-C link-arg=-s"
run: |
cargo build --release --locked
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: binary
path: target/release/crowbar
test:
name: Test on Linux
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Install dependencies
env:
DEBIAN_FRONTEND: "noninteractive"
run: |
sudo apt update && sudo apt install -y libdbus-1-dev gnome-keyring dbus-x11 libssl-dev
mkdir -p ~/.cache ~/.local/share/keyrings
- name: Test
run: |
cargo fmt -- --check
cargo clippy --release
export $(dbus-launch)
eval "printf '\n' | gnome-keyring-daemon --unlock"
cargo test --release --locked
release:
runs-on: ubuntu-20.04
needs: [build, test]
steps:
- name: Restore artifact from previous job
uses: actions/download-artifact@v3
with:
name: binary
- name: Upload binaries to release
uses: svenstaro/upload-release-action@2.5.0
with:
file: crowbar
asset_name: crowbar-x86_64-linux
overwrite: true
- uses: actions/checkout@v3
- name: Publish to crates.io
run: cargo publish -v --no-verify --locked --token ${{ secrets.CRATES_IO_TOKEN }}