name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
msrv: 1.57.0
nightly: nightly-2021-12-03
jobs:
build-msrv:
strategy:
matrix:
include:
- os: windows-latest
features: ""
- os: ubuntu-latest
features: --all-features
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}${{ matrix.features }}-msrv-cargo-build-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.msrv }}
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace ${{ matrix.features }} --all-targets
- name: Run CLI tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path=cli/Cargo.toml ${{ matrix.features }} --all-targets
- name: Run doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace ${{ matrix.features }} --doc
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings
- name: Clippy CLI
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path=cli/Cargo.toml --all-features --all-targets -- -D warnings
name: clippy (CLI)
- name: Clippy (no features)
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p term-transcript --no-default-features --lib
name: clippy (no features)
- name: Clippy (features = svg)
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p term-transcript --no-default-features --features svg --lib
name: clippy (features = svg)
- name: Clippy (features = test)
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p term-transcript --no-default-features --features test --lib
name: clippy (features = test)
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-features --all-targets
- name: Run CLI tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path=cli/Cargo.toml --all-features --all-targets
- name: Run doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-features --doc
- name: Generate snapshots
run: ./examples/generate-snapshots.sh
document:
needs:
- build
- build-msrv
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-document-target
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.nightly }}
profile: minimal
override: true
- name: Build docs
run: |
cargo clean --doc && \
cargo rustdoc -p term-transcript --all-features -- --cfg docsrs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc
SINGLE_COMMIT: true