Update CI with cargo fmt
, nightly build, and release (#39)
#16
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: | |
paths: | |
- "src/**" | |
- "tests/**" | |
- "examples/**" | |
- "Cargo.*" | |
- ".github/**" | |
schedule: | |
- cron: '0 1 * * *' | |
# Able to call by other workflow | |
workflow_call: | |
# Able to call on GitHub | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
RUST_TOOLCHAIN: ${{ vars.RUST_TOOLCHAIN || 'stable' }} | |
CARGO_TERM_COLOR: always | |
# To build on Ubuntu 22.04 | |
LLVM_CONFIG_PATH: /usr/bin/llvm-config-12 | |
LIBCLANG_PATH: /usr/lib/llvm-12/lib | |
LIBCLANG_STATIC_PATH: /usr/lib/llvm-12/lib | |
CLANG_PATH: /usr/bin/clang-12 | |
jobs: | |
markdown_lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: articulate/actions-markdownlint@v1 | |
with: | |
config: .markdownlint.yaml | |
files: '*.md' | |
ignore: target | |
version: 0.28.1 | |
build_test_rust: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install clang | |
run: sudo apt-get install -y clang-12 libclang-12-dev | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
components: clippy | |
- name: Run cargo check | |
run: | | |
cargo check --all --tests | |
- name: Check code format | |
run: | | |
cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" | |
- name: Run cargo clippy | |
run: | | |
cargo clippy --version | |
cargo clippy --all-targets --all-features -- -W warnings -D warnings | |
- name: Create Documentation | |
run: | | |
cargo doc --no-deps --all-features | |
- name: Run doc tests | |
run: | | |
cargo test |