Update README #25
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
# Run cargo test | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install Dependencies | |
run: sudo apt-get update; sudo apt-get install --no-install-recommends libwayland-dev libasound2-dev libudev-dev | |
- name: Run cargo test | |
run: cargo test | |
# Run cargo clippy -- -D warnings | |
clippy_check: | |
name: Clippy | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Install Dependencies | |
run: sudo apt-get update; sudo apt-get install --no-install-recommends libwayland-dev libasound2-dev libudev-dev | |
- name: Run clippy | |
run: cargo clippy -- -D warnings | |
# Run cargo fmt --all -- --check | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
web_build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ github.ref || github.run_id }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Install wasm bindgen | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: wasm-bindgen-cli | |
- name: Build | |
run: cargo build --release --example simple --target wasm32-unknown-unknown && wasm-bindgen --out-dir ./out/ --target web target/wasm32-unknown-unknown/release/examples/simple.wasm | |
- name: Copy | |
run: cp wasm/* out/ && ls -R out | |
- name: Push | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
SQUASH_HISTORY: true | |
REPO: self | |
BRANCH: gh-pages # The branch name where you want to push the assets | |
FOLDER: ./out # The directory where your assets are generated | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token | |
MESSAGE: "Build: ({sha}) {msg}" # The commit message |