Bootstrap CI pipeline #10
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 | |
- 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 | |
- run: cargo clippy --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 # | |
########### | |
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 }} | |
components: rust-src | |
- run: cargo install cargo-careful | |
if: ${{ matrix.toolchain == 'nightly' }} | |
- run: cargo ${{ (matrix.toolchain == 'nightly' && '+nightly careful') || '' }} test | |
-p tigerbeetle-unofficial-sys --all-features | |
- run: cargo ${{ (matrix.toolchain == 'nightly' && '+nightly careful') || '' }} test | |
-p tigerbeetle-unofficial-core --all-features | |
- run: cargo ${{ (matrix.toolchain == 'nightly' && '+nightly 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 | |
- run: cargo publish -p tigerbeetle-unofficial-sys | |
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", "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)" | |
# TODO: Uncomment once CHANGELOG is added. | |
#- 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@v1 | |
with: | |
name: ${{ steps.release.outputs.version }} | |
body: | | |
[API docs](https://docs.rs/tigerbeetle-unofficial/${{ steps.release.outputs.version }}) | |
# TODO: Uncomment once CHANGELOG is added. | |
# [Changelog](${{ steps.changelog.outputs.link }}) | |
prerelease: ${{ contains(steps.release.outputs.version, '-') }} |