add crates io publish workflow (#5) #18
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: Build and run Rust tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- "**/*" | |
env: | |
# This env var is used by Swatinem/rust-cache@v2 for the cache | |
# key, so we set it to make sure it is always consistent. | |
CARGO_TERM_COLOR: always | |
# Disable full debug symbol generation to speed up CI build and keep memory down | |
# "1" means line tables only, which is useful for panic tracebacks. | |
RUSTFLAGS: "-C debuginfo=1" | |
RUST_BACKTRACE: "1" | |
# according to: https://matklad.github.io/2021/09/04/fast-rust-builds.html | |
# CI builds are faster with incremental disabled. | |
CARGO_INCREMENTAL: "0" | |
CARGO_BUILD_JOBS: "1" | |
jobs: | |
linux-build: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: . | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: rust | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y libssl-dev | |
- name: Run cargo fmt | |
run: cargo fmt --check | |
- name: Clippy | |
run: | | |
cargo clippy --all-features --tests -- -D warnings | |
- name: Build | |
run: | | |
cargo build --all-features | |
- name: Build test | |
run: | | |
cargo test --all-features --no-run | |
- name: Run tests | |
run: | | |
cargo test --all-features |