Skip to content

Bump actions/checkout from 3 to 4 #12

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #12

Workflow file for this run

---
name: Run Tests & Publishing
on: [push, pull_request]
jobs:
lint:
name: Lint Codebase
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
profile: minimal
- name: Setup WebAssembly Target
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
- name: Restore Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run Lints
if: github.event_name == 'push'
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- name: Run Lints (WebAssembly)
if: github.event_name == 'push'
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --target=wasm32-unknown-unknown
- name: Run Lints (PR)
if: github.event_name == 'pull_request'
run: cargo clippy --all-features
- name: Run Lints (PR)
if: github.event_name == 'pull_request'
run: cargo clippy --all-features --target=wasm32-unknown-unknown
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
profile: minimal
- name: Restore Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run Tests
run: cargo test --all-features
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs:
- lint
- test
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
profile: minimal
- name: Restore Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo publish --dry-run
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run
env:
RUSTFLAGS: "--cfg releasing"
- name: Run cargo publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }}
env:
RUSTFLAGS: "--cfg releasing"