Skip to content

0.5.0

0.5.0 #205

Workflow file for this run

name: Rust
on:
push:
pull_request:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
os: [x86_64-unknown-linux-musl, arm-unknown-linux-musleabihf, x86_64-unknown-linux-gnu] # arm-unknown-linux-gnueabihf
runs-on: [ubuntu-latest]
include:
- os: x86_64-apple-darwin
runs-on: macos-latest # Apple needs to be compiled on an apple os
- os: x86_64-pc-windows-gnu
runs-on: windows-latest
suffix: .exe # Windows has an .exe suffix
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.os }}
- name: Install Deps
if: contains(matrix.os, 'linux') && contains(matrix.os, 'gnu')
run: sudo apt update && sudo apt install libudev-dev -y
- name: Build Binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ contains(matrix.os, 'arm') }}
command: build
args: --target ${{ matrix.os }} --release
- name: Save Artifact
uses: actions/upload-artifact@v2
with:
name: ka3005p-${{ matrix.os }}${{ matrix.suffix }}
path: target/${{ matrix.os }}/release/ka3005p${{ matrix.suffix }}
- name: Upload Binary
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_name: ka3005p-${{ matrix.os }}${{ matrix.suffix }}
asset_path: target/${{ matrix.os }}/release/ka3005p${{ matrix.suffix }}
upload_url: ${{ github.event.release.upload_url }}
asset_content_type: application/octet-stream
- name: Tests
if: contains(matrix.os, 'x86_64')
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.os }} --verbose
- name: "Publish to crates.io"
if: matrix.os == 'x86_64' && startsWith(github.ref, 'refs/tags/')
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO }}
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: clippy
target: x86_64-unknown-linux-musl
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --target x86_64-unknown-linux-musl
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Check formatting
run: |
cargo fmt --all -- --check