π fix(build): read the project metadata from the sdist #838
Workflow file for this run
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
| name: π§ͺ common | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| name: π changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }} | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: π Check for changes | |
| uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 | |
| id: filter | |
| with: | |
| filters: | | |
| run: | |
| - 'toml-doc/**' | |
| - 'common/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'rust-toolchain.toml' | |
| - '.github/workflows/common.yaml' | |
| clippy: | |
| name: π clippy | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: π¦ Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 | |
| with: | |
| components: clippy | |
| - name: π Run Clippy | |
| run: cargo clippy -p common --locked --all-targets -- -D warnings | |
| fmt: | |
| name: π¨ fmt | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: π¦ Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 | |
| with: | |
| components: rustfmt | |
| - name: π¨ Check formatting | |
| run: cargo fmt -p common --check | |
| build: | |
| name: π¨ build | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: π¦ Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 | |
| - name: π¨ Build | |
| run: cargo build -p common --locked | |
| test: | |
| name: β test | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| runs-on: ubuntu-24.04 | |
| environment: test | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: π¦ Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 | |
| with: | |
| components: llvm-tools-preview | |
| - name: π¦ Install cargo-llvm-cov and cargo-nextest | |
| uses: taiki-e/install-action@5b4d68e2e660441203ab128a23676f1e4faf1532 # v2.86.3 | |
| with: | |
| tool: cargo-llvm-cov,cargo-nextest | |
| - name: β Run tests with coverage | |
| run: cargo llvm-cov nextest -p common --no-default-features --locked --fail-under-lines 100 --codecov --output-path coverage.json | |
| - name: π€ Upload coverage | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.json | |
| flags: common | |
| all-pass: | |
| name: β common | |
| if: always() | |
| needs: [changes, clippy, fmt, build, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide whether all jobs passed or were skipped | |
| run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then | |
| echo "Some jobs failed or were canceled" | |
| exit 1 | |
| fi | |
| echo "All jobs passed or were skipped" |