Skip to content

Commit

Permalink
ci: Added Rust tests and release automated workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
frol committed Sep 30, 2023
1 parent 455f56b commit e472d8b
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Rust

permissions:
pull-requests: write
contents: write

on:
push:
branches: [ main ]
pull_request:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: '-D warnings'
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short

defaults:
run:
working-directory: ./crate

jobs:
clippy:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Run clippy
run: cargo clippy --benches -- -D clippy::all

cargo-fmt:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Run cargo fmt
run: cargo fmt --check

# there're sometimes warnings, which signal, that the generated doc
# won't look as expected, when rendered, and sometimes errors, which will prevent doc from being
# generated at release time altogether.
cargo-doc:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: run cargo doc
run: RUSTDOCFLAGS="-D warnings" cargo doc

release-plz:
runs-on: ubuntu-latest
needs: [clippy, cargo-fmt, cargo-doc]
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.MY_GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
env:
# https://release-plz.ieni.dev/docs/github/trigger
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit e472d8b

Please sign in to comment.