tealdeer/.github/workflows/ci.yml
2026-08-18 21:06:43 +02:00

92 lines
2.9 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:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest, windows-11-arm]
toolchain: [stable, 1.88.0] # MSRV
include:
- platform: windows-latest
exe_suffix: .exe
- platform: windows-11-arm
exe_suffix: .exe
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- run: mkdir artifacts
- name: Build with default features
run: |
cargo build --locked
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 --locked --features logging,rustls-with-webpki-roots --no-default-features
cp target/debug/tldr${{ matrix.exe_suffix}} artifacts/tldr-logging-rustls-webpki${{ matrix.exe_suffix}}
- name: Build with native TLS backend
run: |
# expects runners have the proper Native SSL library
cargo build --locked --features native-tls --no-default-features
cp target/debug/tldr${{ matrix.exe_suffix}} artifacts/tldr-native-tls${{ matrix.exe_suffix}}
- uses: actions/upload-artifact@v7
with:
name: tldr-debug-build-${{ matrix.platform }}-rust-${{ matrix.toolchain }}
path: artifacts/
- name: Run tests
run: cargo test --locked -- --test-threads 1
clippy:
name: run clippy lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.88.0 # MSRV
components: clippy
- name: run clippy lints
run: cargo clippy --locked --all-targets --features logging
fmt:
name: run rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- 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@v7
- run: ./scripts/get-mdbook.sh
- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Build
run: cargo build --locked
- name: Ensure that docs can be built
run: ./mdbook build docs
- name: Generate usage string
run: cargo run --locked -- --help > docs/src/usage-actual.txt
- name: Ensure that usage string is up to date
run: diff docs/src/usage{,-actual}.txt