cargo-semver-checks/action.yml
2023-02-27 16:42:26 -05:00

38 lines
1.3 KiB
YAML

name: 'cargo-semver-checks'
description: 'Ensure the public API in your Rust crate follows semantic versioning'
branding:
icon: 'check-circle'
color: 'green'
inputs:
crate-name:
description: 'The crate whose API to check for semver. If not set, all crates in the workspace are processed.'
required: false
default: ''
manifest-path:
description: 'Path to Cargo.toml of crate or workspace to check. Has an effect only if crate-name is not specified.'
required: false
default: ''
runs:
using: "composite"
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Check for semver violations
shell: bash
run: |
set -euxo pipefail
# Colorize output, since GitHub Actions terminals support color.
export CARGO_TERM_COLOR=always
export CRATE_NAME="${{ inputs.crate-name }}"
export MANIFEST_PATH="${{ inputs.manifest-path }}"
export SEMVER_CHECKS_OPTIONS="${CRATE_NAME:+"--package $CRATE_NAME"} ${MANIFEST_PATH:+"--manifest-path $MANIFEST_PATH"}"
# Check for semver violations.
cargo install cargo-semver-checks --locked
cargo semver-checks check-release $SEMVER_CHECKS_OPTIONS