Skip to content

fixed issue #18

fixed issue #18 #218

Workflow file for this run

name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
linux:
runs-on: ubuntu-20.04
steps:
- name: Download apt packages
run: |
sudo apt-get update -y && sudo apt-get install -y libasound2-dev libudev-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-deb
run: cargo binstall cargo-deb -y
- name: Use sccache-cache
uses: mozilla-actions/[email protected]
- uses: actions/checkout@v4
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy check
run: cargo clippy --all --all-targets --all-features -- -D warnings
# breaks for now since Cargo.lock is in a new version (4)
# - uses: actions-rs/audit-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: cargo build --verbose --all --all-targets --profile=ci
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
# runs cargo with defaults flags, using the default `lcov` output
- name: Test
run: cargo llvm-cov --all-features --workspace --exclude plastic --exclude plastic_tui --lcov --output-path lcov.info
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
# afterwards, upload the report to codecov
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
- name: Create Debian package
run: cargo deb
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
- name: Upload debian package artifact
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: plastic.deb
path: target/debian/*.deb
overwrite: true
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: Release ${{ github.ref_name }}
body: |
Release ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
target/debian/*.deb
LICENSE
windows:
runs-on: windows-latest
steps:
- name: Use sccache-cache
uses: mozilla-actions/[email protected]
- uses: actions/checkout@v4
- name: Build
run: cargo build --all --all-targets --profile=ci
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
- name: Test
run: cargo test --workspace --exclude plastic --exclude plastic_tui --lib
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"