1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# This is the name that shows up in the GitHub Actions interface
name: Build and Deploy
# When should this Github Action run?
on:
push:
branches:
# What Environment variables to use? It is possible to have secret environment variables, any defined here will be in plaintext though.
env:
CARGO_TERM_COLOR: always
# What do we want to run in order?
jobs:
# name of the job to run. Can be anything.
deploy:
# Docker based operating system to load. Windows and Mac are also available
runs-on: ubuntu-latest
steps:
# Defining a custom shell command to run for this job
- name: Install Packages
run: sudo apt update && sudo apt install libasound2-dev libudev-dev pkg-config
# Predefined GitHub action that is available globally
# This is supposed to cache the install
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Checkout the code so that we can use it
- uses: actions/checkout@v2
# Install rust and add features to rust for later usage
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt
- name: Check formatting
run: cargo fmt -- --check
- name: Check Clippy
run: cargo clippy -- -D clippy::all
- name: Test
run: cargo test
- name: Build
run: cargo build --release
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}