Fix workflows #137
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: 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 | |
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 | |
rustdoc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
target: x86_64-unknown-linux-musl | |
components: rustfmt, rust-src | |
- name: Build Documentation | |
run: cargo doc --all --no-deps --target x86_64-unknown-linux-musl | |
- name: Deploy Docs | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: ./target/x86_64-unknown-linux-musl/doc/ |