Merge pull request #2 from PierreZ/init-v3 #1
This file contains hidden or 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
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: Rust CI | |
| concurrency: | |
| group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE" | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE" | |
| workflow_dispatch: | |
| jobs: | |
| # Check crate compiles - runs first and blocks other jobs | |
| check: | |
| name: cargo check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| run: | | |
| rustup toolchain install stable | |
| rustup default stable | |
| - name: Rust Dependency Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "ci-check" | |
| save-if: ${{ github.ref_name == 'main' }} | |
| - name: Run cargo check | |
| run: cargo check --workspace --all-targets | |
| # Run tests | |
| test: | |
| name: cargo test | |
| needs: check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| run: | | |
| rustup toolchain install stable | |
| rustup default stable | |
| - name: Rust Dependency Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "ci" | |
| save-if: ${{ github.ref_name == 'main' }} | |
| - name: Run tests | |
| env: | |
| RUST_BACKTRACE: 1 | |
| run: cargo test --workspace --lib --tests --bins | |
| - name: Verify working directory is clean | |
| run: git diff --exit-code | |
| # Clippy linting | |
| clippy: | |
| name: cargo clippy | |
| needs: check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| run: | | |
| rustup toolchain install stable | |
| rustup default stable | |
| rustup component add clippy | |
| - name: Rust Dependency Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "ci-clippy" | |
| save-if: ${{ github.ref_name == 'main' }} | |
| - name: Run clippy | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| # Format checking | |
| fmt: | |
| name: cargo fmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| run: | | |
| rustup toolchain install stable | |
| rustup default stable | |
| rustup component add rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check |