Skip to content

ci: Run cargo CI jobs with --locked #1890

ci: Run cargo CI jobs with --locked

ci: Run cargo CI jobs with --locked #1890

Workflow file for this run

name: CI
on:
push:
branches:
- master
- "release/**"
pull_request:
jobs:
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- run: rustup component add rustfmt clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy --all-features --workspace --tests --examples --locked -- -D clippy::all
check:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, 1.88.0]
name: Check feature permutations using Rust ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust ${{ matrix.rust }} toolchain
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal --no-self-update
rustup default ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Check all features
run: cargo check --all-features --locked
env:
RUSTFLAGS: -Dwarnings
- name: Check sentry-core without default features
run: cargo check --no-default-features --locked
working-directory: sentry-core
env:
RUSTFLAGS: -Dwarnings
- name: Check default features
run: cargo check --locked
env:
RUSTFLAGS: -Dwarnings
- name: Check sentry panic feature without defaults
run: cargo check --no-default-features --features panic --locked
working-directory: sentry
env:
RUSTFLAGS: -Dwarnings
- name: Check sentry curl feature
run: cargo check --features curl --locked
working-directory: sentry
env:
RUSTFLAGS: -Dwarnings
- name: Check sentry curl+panic without defaults
run: cargo check --no-default-features --features curl,panic --locked
working-directory: sentry
env:
RUSTFLAGS: -Dwarnings
- name: Check sentry-actix
run: cargo check --locked
working-directory: sentry-actix
env:
RUSTFLAGS: -Dwarnings
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, 1.88.0]
name: Test using Rust ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust ${{ matrix.rust }} toolchain
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal --no-self-update
rustup default ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Run cargo test
run: cargo test --workspace --all-features --all-targets --locked
- name: Run cargo doc tests
run: cargo test --workspace --all-features --doc --locked
# Keep this separate so we continue asserting the default+test feature
# combination for sentry explicitly, even with broader all-features coverage.
- name: Test sentry default+test feature combination
run: cargo test -p sentry --features test --locked
codecov:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info --locked
- uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
doc:
name: Build-test documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- name: Checkout sources
uses: actions/checkout@v4
- run: rustup component add rust-docs
- uses: Swatinem/rust-cache@v2
- name: Run cargo doc
run: cargo doc --workspace --all-features --document-private-items --no-deps --locked
required:
name: Check required jobs
runs-on: ubuntu-latest
if: ${{ always() }}
# Keep this list in sync with all CI jobs that should be required.
# `codecov` is intentionally excluded from this aggregator.
needs: [lints, check, test, doc]
steps:
- name: Fail if any required job did not succeed
if: >-
${{
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled') ||
contains(needs.*.result, 'skipped')
}}
run: exit 1