Integrate @dependabot #78
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: ["master"] | |
tags: ["v*"] | |
pull_request: | |
branches: ["master"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
################ | |
# Pull Request # | |
################ | |
pr: | |
if: ${{ github.event_name == 'pull_request' }} | |
needs: | |
- clippy | |
- msrv | |
- rustfmt | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- run: true | |
########################## | |
# Linting and formatting # | |
########################## | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy,rustfmt | |
- run: cargo clippy --workspace --all-features -- -D warnings | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- run: cargo +nightly fmt --all -- --check | |
########### | |
# Testing # | |
########### | |
msrv: | |
name: MSRV | |
strategy: | |
fail-fast: false | |
matrix: | |
msrv: ["1.78.0"] | |
os: ["ubuntu", "macOS", "windows"] | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.msrv }}${{ matrix.os == 'windows' && '-gnu' || '' }} | |
components: rustfmt | |
- run: cargo +nightly update -Z minimal-versions | |
- run: cargo test -p tigerbeetle-unofficial-sys --all-features | |
- run: cargo test -p tigerbeetle-unofficial-core --all-features | |
- run: cargo test -p tigerbeetle-unofficial --all-features | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: ["stable", "beta", "nightly"] | |
os: ["ubuntu", "macOS", "windows"] | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }}${{ matrix.os == 'windows' && '-gnu' || '' }} | |
components: rust-src,rustfmt | |
- run: cargo install cargo-careful | |
if: ${{ matrix.toolchain == 'nightly' && matrix.os != 'windows' }} | |
- run: cargo ${{ (matrix.toolchain == 'nightly' && matrix.os != 'windows') && 'careful' || '' }} test | |
-p tigerbeetle-unofficial-sys --all-features | |
- run: cargo ${{ (matrix.toolchain == 'nightly' && matrix.os != 'windows') && 'careful' || '' }} test | |
-p tigerbeetle-unofficial-core --all-features | |
- run: cargo ${{ (matrix.toolchain == 'nightly' && matrix.os != 'windows') && 'careful' || '' }} test | |
-p tigerbeetle-unofficial --all-features | |
############# | |
# Releasing # | |
############# | |
publish: | |
name: publish (crates.io) | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
needs: ["release-github"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
# TODO: Investigate how to fix this. | |
# `--no-verify` is required because the source directory is modified by `build.rs` (`zig/download.sh` running) | |
# during `cargo publish`, which isn't happy about (build scripts should not modify anything outside of `OUT_DIR`). | |
- run: cargo publish -p tigerbeetle-unofficial-sys --no-verify | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATESIO_TOKEN }} | |
- run: cargo publish -p tigerbeetle-unofficial-core | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATESIO_TOKEN }} | |
- run: cargo publish -p tigerbeetle-unofficial | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATESIO_TOKEN }} | |
release-github: | |
name: release (GitHub) | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
needs: | |
- clippy | |
- msrv | |
- rustfmt | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Parse release version | |
id: release | |
run: echo "version=${GITHUB_REF#refs/tags/v}" | |
>> $GITHUB_OUTPUT | |
- name: Verify release version matches Cargo manifest | |
run: | | |
test "${{ steps.release.outputs.version }}" \ | |
== "$(grep -m1 -e '^version = "' Cargo.toml | cut -d'"' -f2)" | |
- name: Parse CHANGELOG link | |
id: changelog | |
run: echo "link=${{ github.server_url }}/${{ github.repository }}/blob/v${{ steps.release.outputs.version }}/CHANGELOG.md#$(sed -n '/^## \[${{ steps.release.outputs.version }}\]/{s/^## \[\(.*\)\][^0-9]*\([0-9].*\)/\1--\2/;s/[^0-9a-z-]*//g;p;}' CHANGELOG.md)" | |
>> $GITHUB_OUTPUT | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ steps.release.outputs.version }} | |
body: | | |
[API docs](https://docs.rs/tigerbeetle-unofficial/${{ steps.release.outputs.version }}) | |
[Changelog](${{ steps.changelog.outputs.link }}) | |
prerelease: ${{ contains(steps.release.outputs.version, '-') }} |