mirror of
https://github.com/ratatui/ratatui.git
synced 2025-09-27 04:50:46 +00:00

- format toml files using taplo - add toml formatting check to CI - use xtask consistently from bacon - refactor xtask commands to take params instead of multiple commands
189 lines
5.8 KiB
YAML
189 lines
5.8 KiB
YAML
name: Continuous Integration
|
|
|
|
on:
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
# ensure that the workflow is only triggered once per PR, subsequent pushes to the PR will cancel
|
|
# and restart the workflow. See https://docs.github.com/en/actions/using-jobs/using-concurrency
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
# lint, clippy and coverage jobs are intentionally early in the workflow to catch simple formatting,
|
|
# typos, and missing tests as early as possible. This allows us to fix these and resubmit the PR
|
|
# without having to wait for the comprehensive matrix of tests to complete.
|
|
jobs:
|
|
# Lint the formatting of the codebase.
|
|
lint-formatting:
|
|
name: Check Formatting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
with: { components: rustfmt }
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: taplo-cli
|
|
- run: cargo xtask format --check
|
|
|
|
# Check for typos in the codebase.
|
|
# See <https://github.com/crate-ci/typos/>
|
|
lint-typos:
|
|
name: Check Typos
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: crate-ci/typos@master
|
|
|
|
# Check for any disallowed dependencies in the codebase due to license / security issues.
|
|
# See <https://github.com/EmbarkStudios/cargo-deny>
|
|
dependencies:
|
|
name: Check Dependencies
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: EmbarkStudios/cargo-deny-action@v2
|
|
|
|
# Check for any unused dependencies in the codebase.
|
|
# See <https://github.com/bnjbvr/cargo-machete/>
|
|
cargo-machete:
|
|
name: Check Unused Dependencies
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: bnjbvr/cargo-machete@v0.7.0
|
|
|
|
# Run cargo clippy.
|
|
lint-clippy:
|
|
name: Check Clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with: { components: clippy }
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask clippy
|
|
|
|
# Run markdownlint on all markdown files in the repository.
|
|
lint-markdown:
|
|
name: Check Markdown
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: DavidAnson/markdownlint-cli2-action@v18
|
|
with:
|
|
globs: |
|
|
'**/*.md'
|
|
'!target'
|
|
|
|
# Run cargo coverage. This will generate a coverage report and upload it to codecov.
|
|
# <https://app.codecov.io/gh/ratatui/ratatui>
|
|
coverage:
|
|
name: Coverage Report
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: llvm-tools
|
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask coverage
|
|
- uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
fail_ci_if_error: true
|
|
|
|
# Run cargo check. This is a fast way to catch any obvious errors in the code.
|
|
check:
|
|
name: Check ${{ matrix.os }} ${{ matrix.toolchain }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
toolchain: ["1.74.0", "stable"]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.toolchain }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask check --all-features
|
|
|
|
# Check if README.md is up-to-date with the crate's documentation.
|
|
check-readme:
|
|
name: Check README
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: taiki-e/install-action@cargo-rdme
|
|
- run: cargo xtask readme --check
|
|
|
|
# Run cargo rustdoc with the same options that would be used by docs.rs, taking into account the
|
|
# package.metadata.docs.rs configured in Cargo.toml. https://github.com/dtolnay/cargo-docs-rs
|
|
lint-docs:
|
|
name: Check Docs
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUSTDOCFLAGS: -Dwarnings
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
- uses: dtolnay/install@cargo-docs-rs
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask docs
|
|
|
|
# Run cargo test on the documentation of the crate. This will catch any code examples that don't
|
|
# compile, or any other issues in the documentation.
|
|
test-docs:
|
|
name: Test Docs
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask test-docs
|
|
|
|
# Run cargo test on the libraries of the crate.
|
|
test-libs:
|
|
name: Test Libs ${{ matrix.toolchain }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
toolchain: ["1.74.0", "stable"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask test-libs
|
|
|
|
# Run cargo test on all the backends.
|
|
test-backends:
|
|
name: Test ${{matrix.backend}} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
backend: [crossterm, termion, termwiz]
|
|
exclude:
|
|
# termion is not supported on windows
|
|
- os: windows-latest
|
|
backend: termion
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo xtask test-backend ${{ matrix.backend }}
|