2022-07-21 01:19:33 +02:00
|
|
|
name: 'cargo-semver-checks'
|
2022-07-21 01:34:12 +02:00
|
|
|
description: 'Ensure the public API in your Rust crate follows semantic versioning'
|
2022-08-10 07:28:06 +02:00
|
|
|
branding:
|
2022-09-28 21:16:55 +02:00
|
|
|
icon: 'check-circle'
|
2022-08-10 07:28:06 +02:00
|
|
|
color: 'green'
|
2022-07-21 01:19:33 +02:00
|
|
|
inputs:
|
|
|
|
crate-name:
|
2023-01-03 20:17:02 +01:00
|
|
|
description: 'The crate whose API to check for semver. If not set, all crates in the workspace are processed.'
|
2022-07-21 01:19:33 +02:00
|
|
|
required: false
|
|
|
|
default: ''
|
2023-01-03 20:39:25 +01:00
|
|
|
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: ''
|
2023-01-03 20:49:57 +01:00
|
|
|
verbose:
|
|
|
|
description: 'Enables verbose output of `cargo-semver-checks`.'
|
|
|
|
type: boolean
|
|
|
|
required: true
|
|
|
|
default: false
|
2022-07-21 01:19:33 +02:00
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Install rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2022-09-28 21:16:55 +02:00
|
|
|
toolchain: stable
|
2022-07-21 01:19:33 +02:00
|
|
|
profile: minimal
|
2023-01-03 20:17:02 +01:00
|
|
|
- name: Check for semver violations
|
2022-07-21 01:57:47 +02:00
|
|
|
shell: bash
|
2022-07-21 01:41:14 +02:00
|
|
|
run: |
|
2022-07-21 02:08:54 +02:00
|
|
|
set -euxo pipefail
|
|
|
|
|
2022-07-21 01:41:14 +02:00
|
|
|
# Colorize output, since GitHub Actions terminals support color.
|
|
|
|
export CARGO_TERM_COLOR=always
|
2022-07-21 01:19:33 +02:00
|
|
|
|
2023-01-03 20:39:25 +01:00
|
|
|
export CRATE_NAME="${{ inputs.crate-name }}"
|
|
|
|
export MANIFEST_PATH="${{ inputs.manifest-path }}"
|
|
|
|
|
2023-01-03 20:49:57 +01:00
|
|
|
if [[ ${{ inputs.verbose }} == 'true' ]]; then
|
|
|
|
export VERBOSE_FLAG="--verbose"
|
|
|
|
else
|
|
|
|
export VERBOSE_FLAG=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
export SEMVER_CHECKS_OPTIONS="${CRATE_NAME:+"--package $CRATE_NAME"} ${MANIFEST_PATH:+"--manifest-path $MANIFEST_PATH"} $VERBOSE_FLAG"
|
2022-07-21 01:19:33 +02:00
|
|
|
|
2022-07-21 01:41:14 +02:00
|
|
|
# Check for semver violations.
|
2022-11-16 02:15:26 +01:00
|
|
|
cargo install cargo-semver-checks --locked
|
2023-01-03 20:39:25 +01:00
|
|
|
cargo semver-checks check-release $SEMVER_CHECKS_OPTIONS
|