tealdeer/.github/workflows/ci.yml
2026-08-17 18:35:50 +02:00

86 lines
2.4 KiB
YAML

name: CI
on:
push:
branches:
- main
- "v*.x"
pull_request:
schedule:
- cron: '30 3 * * 2'
workflow_dispatch:
jobs:
test:
name: run tests
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, 1.62.0]
include:
- platform: windows-latest
exe_suffix: .exe
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- run: mkdir artifacts
- name: Build with default features
run: |
cargo build
cp target/debug/tldr${{ matrix.exe_suffix}} artifacts/tldr-default${{ matrix.exe_suffix}}
- name: Build with logging and Rustls with webpki roots
run: |
cargo build --features logging,webpki-roots --no-default-features
cp target/debug/tldr${{ matrix.exe_suffix}} artifacts/tldr-logging-rustls-webpki${{ matrix.exe_suffix}}
- uses: actions/upload-artifact@v5
with:
name: tldr-debug-build-${{ matrix.platform }}-rust-${{ matrix.toolchain }}
path: artifacts/
- name: Run tests
run: cargo test -- --test-threads 1
clippy:
name: run clippy lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: run clippy lints
run: cargo clippy --features logging
fmt:
name: run rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: run rustfmt
run: cargo fmt --all -- --check
docs:
name: build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: ./scripts/get-mdbook.sh
- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Build
run: cargo build
- name: Ensure that docs can be built
run: ./mdbook build docs
- name: Generate usage string
run: cargo run -- --help > docs/src/usage-actual.txt
- name: Ensure that usage string is up to date
run: diff docs/src/usage{,-actual}.txt