Introducing v1 #7
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: PR Preview | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| quick-check: | |
| name: Quick Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-quick-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Check format | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features | |
| - name: Check build | |
| run: cargo check --all-features | |
| - name: Run quick tests | |
| run: cargo test --lib | |
| changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| src: ${{ steps.changes.outputs.src }} | |
| docs: ${{ steps.changes.outputs.docs }} | |
| workflows: ${{ steps.changes.outputs.workflows }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v2 | |
| id: changes | |
| with: | |
| filters: | | |
| src: | |
| - 'src/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| docs: | |
| - '**.md' | |
| - 'docs/**' | |
| workflows: | |
| - '.github/workflows/**' | |
| test-if-needed: | |
| name: Test if Source Changed | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run full test suite | |
| run: cargo test --all-features | |
| summary: | |
| name: PR Preview Summary | |
| runs-on: ubuntu-latest | |
| needs: [quick-check, changes, test-if-needed] | |
| if: always() | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## PR Preview Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Quick Check**: ${{ needs.quick-check.result }}" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ needs.changes.outputs.src }}" == "true" ]]; then | |
| echo "- **Full Tests**: ${{ needs.test-if-needed.result }}" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "- **Full Tests**: Skipped (no source changes)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Changed Files" >> $GITHUB_STEP_SUMMARY | |
| if [[ "${{ needs.changes.outputs.src }}" == "true" ]]; then | |
| echo "- ✅ Source code" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [[ "${{ needs.changes.outputs.docs }}" == "true" ]]; then | |
| echo "- 📚 Documentation" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [[ "${{ needs.changes.outputs.workflows }}" == "true" ]]; then | |
| echo "- ⚙️ GitHub Actions workflows" >> $GITHUB_STEP_SUMMARY | |
| fi |