Skip to content

ci: Bump dtolnay/rust-toolchain from bb45937a0 to d8352f6b1 #252

ci: Bump dtolnay/rust-toolchain from bb45937a0 to d8352f6b1

ci: Bump dtolnay/rust-toolchain from bb45937a0 to d8352f6b1 #252

Workflow file for this run

name: Continuous integration
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 # Fail cache download after 2 minutes.
jobs:
build-test:
name: ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
skip-tests: true
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # v1
with:
toolchain: stable
components: clippy
target: ${{ matrix.target }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
cache-dependency-path: 'go-lib/go.sum'
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
shared-key: ${{ matrix.target }}
# Always save the build artifacts to the cache to speed up builds of additional
# commits added to an already-opened pull request.
# save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build the library
run: cargo build --lib --all-features --target=${{ matrix.target }}
- name: Build the tests to check linking
if: matrix.skip-tests == true
run: cargo build --tests --all-features --target=${{ matrix.target }}
- name: Run all tests
if: matrix.skip-tests != true
run: cargo test --all-features --target=${{ matrix.target }}
- name: Run Clippy linter
run: cargo custom-clippy # cargo alias to allow reuse of config locally
lint:
name: Run Rust linters
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # v1
with:
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
shared-key: "x86_64-unknown-linux-gnu"
save-if: false
- name: Check Rust formatting
run: cargo fmt -- --check
- name: Check rustdoc links
run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links --deny warnings" cargo doc --verbose --workspace --no-deps --all-features --document-private-items
prettier-check:
name: Check Markdown formatting (Prettier)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actionsx/prettier@3d9f7c3fa44c9cb819e68292a328d7f4384be206 # latest
with:
# prettier CLI arguments.
args: --check .
validate_pr_title:
name: Validate PR title
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e # v5.5.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed (newline delimited).
types: |
feat
fix
chore
docs
deps
test
ci
refactor
requireScope: false
- name: Check PR title length
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
title_length=${#TITLE}
if [ $title_length -gt 72 ]
then
echo "PR title is too long (greater than 72 characters)"
exit 1
fi
cross-compile:
name: Cross-compile for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
test: true
- target: aarch64-unknown-linux-gnu
test: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # v1
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Setup Cross
run: |
curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-gnu.tar.gz -o /tmp/cross.tgz
tar xzf /tmp/cross.tgz -C ~/.cargo/bin
cross --version
- name: Cache Rust deps
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
shared-key: cross-${{ matrix.target }}
cache-on-failure: true
- name: Build
run: cross build --all-targets --target ${{ matrix.target }}
- name: Test
if: matrix.test == 'true'
run: cross test --target ${{ matrix.target }}