This repository provides a reusable github workflow for rust projects. The workflow runs the following jobs:
- cargo-build-release: does a
cargo build --release
and makes thetarget
directory available for other jobs. - cargo-check
- cargo-doc
- cargo-test: runs
cargo test
with coverage and uploads results to coveralls.io and/or codecov.io. - rustfmt
- clippy
- cargo-audit
- cargo-deb: installs and run
cargo-deb
; copies manual to crate directory, if present. (optional) - rust-misc: misc checks; for now it checks if the Cargo.lock version matches the one in Cargo.toml.
- cargo-semver-checks: checks semver violantions before publishing.
- publish-cratesio: uses publish-crate to publish the crate
to crates.io when the repository is tagged with a version.
Requires the
CARGO_REGISTRY_TOKEN
secret. (optional) - publish-packagecloud: uses packagecloud to upload
the Debian package built by
cargo-deb
job to packagecloud.io when the repository is tagged with a version. Requires thePACKAGECLOUD_TOKEN
secret and thedeb
input to betrue
. (optional) - publish-github-release: uses action-automatic-releases to publish a github release when the repository is tagged with a version. (optional)
To use this worflow, with both packagecloud and crates.io uploads
enabled, use the following in your .github/workflows/ci.yml
:
---
name: CI
on: [ push, pull_request ]
jobs:
rust:
uses: lpenz/ghworkflow-rust/.github/workflows/rust.yml@v0.23.3
with:
coveralls: true
codecov: true
deb: true
packagecloud: true
publish_packagecloud_repository: |
["debian/debian/bookworm", "ubuntu/ubuntu/jammy"]
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
You may have to enable public reusable workflow usage in your organization. See reusing-workflows for more information.
enable_cargo-semver-checks
: enables cargo-semver-checks - default istrue
.coveralls
: makes cargo-test upload test coverage data to coveralls.io whentrue
.codecov
: makes cargo-test upload test coverage data to codecov.io whentrue
.deb
: enables cargo-deb whentrue
.dependencies_debian
: dependencies as Debian packages to install; used in the appropriate actions if definedpublish_cratesio
: enables the publish-cratesio job.publish_github_release
: enables the publish-github-release job.publish_github_release_files
: files to publish in the github release.publish_packagecloud
: enables the publish-packagecloud job.publish_packagecloud_repository
: json list with packagecloud repositories to publish .deb.