refactor: Add workspace (#7) #23
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
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
name: Test | |
jobs: | |
dump-ctx: | |
name: Context | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump Github context | |
uses: crazy-max/ghaction-dump-context@v2 | |
build-and-release: | |
name: Build and Test | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { target: x86_64-unknown-linux-musl, os: linux, arch: amd64, runner: ubuntu-latest, cross: false } | |
- { target: x86_64-apple-darwin, os: darwin, arch: amd64, runner: macos-latest, cross: false } | |
- { target: x86_64-pc-windows-msvc, os: windows, arch: amd64, runner: windows-latest, cross: false } | |
runs-on: ${{ matrix.job.runner }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
if: not ${{ matrix.job.cross }} | |
- name: Install Cross Compiler | |
if: matrix.job.os == 'linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y musl-tools gcc-multilib | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.job.target }} | |
toolchain: 1.76.0 | |
components: rust-src,rust-docs,rustfmt,clippy | |
- name: Setup Cache | |
uses: Swatinem/[email protected] | |
with: | |
shared-key: "build-${{ matrix.job.target }}" | |
- name: Build | |
run: | | |
cargo build --locked --release --target ${{ matrix.job.target }} | |
- name: Test | |
run: | | |
cargo test --locked --release --target ${{ matrix.job.target }} | |
- name: Format | |
run: | | |
cargo fmt --check | |
- name: Clippy | |
run: | | |
cargo clippy --no-deps -- -Dwarnings -Dunused-crate-dependencies |