1.0 #175
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -Dwarnings | |
jobs: | |
pre-build: | |
name: Pre-Build | |
runs-on: ubuntu-latest | |
outputs: | |
rust-version: ${{ steps.rust-version.outputs.rust-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Determine Rust Version | |
id: rust-version | |
run: | | |
rust_version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "terminal-colorsaurus") | .rust_version') | |
echo "rust-version=$rust_version" >> "$GITHUB_OUTPUT" | |
build: | |
needs: pre-build | |
name: ${{ format('Build ({0})', matrix.rust-version) }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust-version: ['${{needs.pre-build.outputs.rust-version}}', stable, nightly] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Rust ${{matrix.rust-version}} | |
if: matrix.rust-version != 'stable' | |
run: rustup override set '${{matrix.rust-version}}' | |
- name: Build | |
run: cargo build --workspace --all-features | |
- name: Check fallback implementation | |
run: cargo check --workspace | |
env: | |
RUSTFLAGS: --cfg terminal_colorsaurus_test_unsupported -Dwarnings | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup override set nightly | |
- uses: dtolnay/install@cargo-docs-rs | |
- name: Build Docs | |
run: cargo docs-rs | |
env: | |
RUSTDOCFLAGS: -Dwarnings | |
lint: | |
runs-on: ubuntu-latest | |
name: Lint | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check format | |
run: cargo fmt -- --check | |
- name: Run clippy | |
run: cargo clippy --workspace --all-targets --all-features -- --deny warnings | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
- name: Check spelling | |
uses: crate-ci/typos@v1.24.4 | |
test: | |
name: Test | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests | |
run: cargo test --workspace --all-features | |
test_package: | |
name: Test Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: just | |
- run: just test-package terminal-colorsaurus | |
- run: just test-package termtheme | |
continue-on-error: true |