Skip to content

Crates publish is independent of GitHub release packages #35

Crates publish is independent of GitHub release packages

Crates publish is independent of GitHub release packages #35

Workflow file for this run

# GitHub Actions workflow for CI of the digipin-rs library
# This workflow runs on pushes and pull requests to the main branch,
# specifically when changes are made in the directory.
# It performs formatting checks, linting, testing, and security audits.
# Workflow Dispatch is also enabled for manual runs.
# Permissions are set to read-only for repository contents.
# Workflow Name: CI — digipin-rs
# Required repository variable:
# - None
name: CI — digipin-rs
on:
push:
branches: [main]
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
pull_request:
branches: [main]
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Build & Test (stable)
runs-on: ubuntu-latest
steps:
- name: Checkout digipin-rs
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 1
- name: Show checked-out files
run: |
echo "Repo root:"
ls -la
- name: Cache cargo registry & build
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust toolchain (pin if desired)
run: |
set -euo pipefail
if ! command -v rustup >/dev/null 2>&1; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
fi
rustup toolchain install stable --profile default || true
rustup default stable
rustc --version
cargo --version
- name: fmt check
run: cargo fmt -- --check
- name: clippy (deny warnings)
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --workspace --all-features --verbose
- name: Install cargo-audit
run: |
# install cargo-audit (ignore failure to allow cached installs)
cargo install --locked cargo-audit || true
- name: Run cargo-audit
run: |
if command -v cargo-audit >/dev/null; then
cargo audit || (echo "cargo-audit found issues" && exit 1)
else
echo "cargo-audit not installed"
fi
- name: Install cargo-deny
run: |
cargo install cargo-deny || true
- name: Run cargo-deny (policy check)
run: |
if command -v cargo-deny >/dev/null; then
cargo deny check || (echo "cargo-deny found policy issues" && exit 1)
else
echo "cargo-deny not installed"
fi