mirror of
https://github.com/element-hq/matrix-authentication-service.git
synced 2026-09-25 11:14:19 +00:00
Until now only the clippy CI job and the Dockerfile named a Rust version (kept in sync by hand), while every other CI job, the release binaries and the docs build ran on whatever `stable` happened to be that day. Rust 1.98.0 landing on 2026-08-20 broke `build-binaries` overnight because of that (#5935). `rust-toolchain.toml` pins 1.96.0 with the `minimal` profile plus clippy, and every `rustup toolchain install stable ...` in CI becomes a bare `rustup toolchain install`, which reads the file. Starting at 1.96.0 (the version clippy is already clean against) keeps this change free of lint churn; catching up to 1.98.0 is a follow-up. rustfmt stays on nightly because `.rustfmt.toml` uses nightly-only options, so that job now invokes `cargo +nightly fmt` explicitly instead of setting a rustup directory override, which would silently take precedence over the toolchain file. The file does not list the linux cross-compilation targets on purpose: that would make every developer and CI job download `rust-std` they never use. The two consumers that cross-compile add the targets themselves.
148 lines
4.1 KiB
YAML
148 lines
4.1 KiB
YAML
# Copyright 2025, 2026 Element Creations Ltd.
|
|
# Copyright 2025 New Vector Ltd.
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
# Please see LICENSE files in the repository root for full details.
|
|
|
|
name: Coverage
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
|
|
|
|
jobs:
|
|
opa:
|
|
name: Run OPA test suite with coverage
|
|
runs-on: ubuntu-24.04
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: ./.github/actions/build-policies
|
|
|
|
- name: Run OPA tests with coverage
|
|
working-directory: ./policies
|
|
run: make coverage
|
|
|
|
- name: Upload to codecov.io
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: policies/coverage.json
|
|
flags: policies
|
|
|
|
frontend:
|
|
name: Run frontend test suite with coverage
|
|
runs-on: ubuntu-24.04
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: ./.github/actions/build-frontend
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
- name: Test
|
|
run: pnpm --filter mas-frontend run coverage
|
|
|
|
- name: Upload to codecov.io
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
directory: frontend/coverage/
|
|
flags: frontend
|
|
|
|
rust:
|
|
name: Run Rust test suite with coverage
|
|
runs-on: ubuntu-24.04
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
RUSTC_WRAPPER: "sccache"
|
|
|
|
services:
|
|
postgres:
|
|
image: docker.io/library/postgres:15.3
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: postgres
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- "5432:5432"
|
|
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Rust toolchain
|
|
# llvm-tools-preview installs some llvm tools, which are needed for `grcov` below.
|
|
# See https://github.com/rust-lang/rust/issues/85658 for stability tracking issue.
|
|
run: |
|
|
rustup toolchain install
|
|
rustup component add llvm-tools-preview
|
|
|
|
- name: Setup sccache
|
|
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
|
|
|
|
- name: Install grcov
|
|
uses: taiki-e/install-action@b8cecb83565409bcc297b2df6e77f030b2a468d5 # v2
|
|
with:
|
|
tool: grcov
|
|
|
|
- uses: ./.github/actions/build-frontend
|
|
- uses: ./.github/actions/build-policies
|
|
|
|
- name: Run test suite with profiling enabled
|
|
run: |
|
|
cargo test --no-fail-fast --workspace
|
|
env:
|
|
RUSTFLAGS: "-Cinstrument-coverage --cfg tokio_unstable"
|
|
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost/postgres
|
|
SQLX_OFFLINE: "1"
|
|
|
|
- name: Build grcov report
|
|
run: |
|
|
mkdir -p target/coverage
|
|
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/tests.lcov
|
|
|
|
- name: Upload to codecov.io
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: target/coverage/*.lcov
|
|
flags: unit
|