Merge pull request #11 from robjsliwa/wasmbindgen #30
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: | |
branches: [ "main" ] | |
tags: | |
- 'release_v*' | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install wasm32 target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Check code formatting | |
run: cargo fmt | |
- name: Run linter | |
run: cargo clippy | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Build WASM | |
run: cargo build --target wasm32-unknown-unknown --release | |
publish: | |
if: startsWith(github.ref, 'refs/tags/release_v') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable Rust | |
run: rustup install stable | |
- name: Verify cargo package | |
run: cargo package | |
- name: Publish to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
run: cargo publish |