Skip to content

Release openapi_type 0.5.0 #229

Release openapi_type 0.5.0

Release openapi_type 0.5.0 #229

Workflow file for this run

name: Rust
on:
push:
branches: [main]
pull_request:
env:
RUSTDOCFLAGS: "--default-theme ayu"
RUST_BACKTRACE: "1"
# speed up build by using clang/lld
CC: "clang-14"
CXX: "clang++-14"
LD: "clang-14"
LDFLAGS: "-fuse-ld=lld-14"
RUSTFLAGS: "-C linker=clang-14 -C link-arg=-fuse-ld=lld-14"
jobs:
test:
strategy:
fail-fast: false
matrix:
rust:
- name: MSRV
toolchain: "1.70"
nightly: false
- name: Stable
toolchain: stable
nightly: false
- name: Beta
toolchain: beta
nightly: false
- name: Nightly
toolchain: nightly
nightly: true
runs-on: ubuntu-latest
name: Test (Rust ${{matrix.rust.name}})
continue-on-error: ${{matrix.rust.nightly}}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust.toolchain}}
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
- run: cargo test --workspace -- --skip trybuild
test-trybuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.78"
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} (trybuild)"
- run: cargo test -- trybuild
clippy:
strategy:
fail-fast: false
matrix:
rust:
- name: MSRV
toolchain: "1.70"
nightly: false
- name: Nightly
toolchain: nightly
nightly: true
runs-on: ubuntu-latest
name: Clippy (Rust ${{matrix.rust.name}})
continue-on-error: ${{matrix.rust.nightly}}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust.toolchain}}
components: clippy
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} (clippy)"
- run: cargo clippy --workspace --profile test -- -Dclippy::all
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
- run: ./tests/fail/rustfmt.sh --check
readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker://ghcr.io/msrd0/cargo-doc2readme
with:
entrypoint: ./readme.sh
args: --check
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
- name: Get Tarpaulin Version
id: tarpaulin-version
run: echo "version=$(wget -qO- 'https://crates.io/api/v1/crates/cargo-tarpaulin' | jq -r '.crate.max_stable_version')" >>$GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/cargo-tarpaulin
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-version.outputs.version}} tarpaulin ${{steps.tarpaulin-version.outputs.version}}"
- name: Install Tarpaulin
run: |
test -e ~/.cargo/bin/cargo-tarpaulin || cargo install cargo-tarpaulin --version ${{steps.tarpaulin-version.outputs.version}}
- name: Run Tarpaulin coverage tests
run: |
cargo tarpaulin --verbose \
--target-dir target/tarpaulin \
--workspace \
--all-features \
--exclude-files 'derive/*' \
--exclude-files 'serde/*' \
--exclude-files 'target/*' \
--ignore-panics --ignore-tests \
--out html --out json \
-- --skip trybuild
- uses: actions/upload-artifact@v4
with:
name: tarpaulin-report
path: |
tarpaulin-report.json
tarpaulin-report.html
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} (rustdoc)"
- run: cargo doc --workspace --all-features
- run: tar cfJ rustdoc.tar.xz target/doc/
- uses: actions/upload-artifact@v4
with:
name: rustdoc
path: rustdoc.tar.xz
pages:
runs-on: ubuntu-latest
needs: [coverage, doc]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/download-artifact@v4
with:
name: rustdoc
- uses: actions/download-artifact@v4
with:
name: tarpaulin-report
- run: |
test ! -d ./doc || rm -r ./doc
tar xfJ rustdoc.tar.xz --strip-components=1
rm rustdoc.tar.xz
date >./doc/.timestamp
coverage=$(jq '.files | { covered: map(.covered) | add, coverable: map(.coverable) | add } | .covered / .coverable * 10000 | round | . / 100' tarpaulin-report.json)
color=$([[ $coverage < 80 ]] && printf yellow || printf brightgreen)
wget -qO coverage.svg "https://img.shields.io/badge/coverage-$coverage%25-$color"
git add ./doc coverage.svg || true
git status
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "GitHub Pages for ${{github.sha}}"
commit_user_name: "GitHub Actions"
commit_user_email: "[email protected]"
commit_author: "GitHub Actions <[email protected]>"