name: Build crate
on:
push:
branches:
- main
- dev
tags:
- '**'
pull_request:
branches:
- '**'
permissions:
contents: read
id-token: write
jobs:
build_crate:
name: Crate
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up rusts
uses: actions-rs/toolchain@v1
with:
toolchain: 1.97.1
components: rustfmt, clippy
- name: Set up rust (stable)
uses: actions-rs/toolchain@v1
with:
toolchain: 1.97.1
components: rustfmt, clippy
- name: fmt (stable)
run: cargo +1.97.1 fmt -- --files-with-diff --check
- name: clippy (stable)
run: cargo +1.97.1 clippy && cargo +1.97.1 clippy --manifest-path wasm/Cargo.toml
- name: tests
run: cargo test && cargo test --release
- name: remove stray main.sym
run: rm -f main.sym
- name: build
run: cargo build --release
- name: dry-run of `cargo publish`
run: cargo publish --dry-run
- name: Upload crate artifacts
uses: actions/upload-artifact@v7
with:
name: crate
path: ./target/package/chialisp-*.crate
- uses: rust-lang/crates-io-auth-action@v1
if: startsWith(github.event.ref, 'refs/tags')
id: auth
- name: publish to crates.io if tagged
if: startsWith(github.event.ref, 'refs/tags')
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: cargo publish