Merge pull request #104 from spiralover/feat/anyhow #121
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: Code QA & Release | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
build: | |
name: Build & Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run Clippy | |
run: cargo clippy --all-targets --all-features | |
- name: Run Tests | |
run: cargo test --workspace --features=feat-regex,feat-crypto,feat-base64,feat-hmac,feat-reqwest | |
- name: Run cargo fmt | |
if: github.event_name == 'push' | |
run: cargo fmt --all | |
- name: Commit fmt changes | |
if: github.event_name == 'push' | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "action@github.com" | |
git add . | |
git commit -m "style(cargo-fmt): apply changes" || echo "No changes to commit" | |
- name: Push fmt changes | |
if: github.event_name == 'push' && success() | |
run: git push origin HEAD:${{ github.ref }} | |
release: | |
name: Release Package | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-gnu | |
- name: Publish package | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish |