chore: release main #78
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: Lint | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - review_requested | |
| - ready_for_review | |
| - reopened | |
| - synchronize | |
| - edited | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| pre-commit: | |
| name: Run pre-commit checks | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Install pre-commit and hooks | |
| run: | | |
| uv tool install pre-commit | |
| pre-commit install-hooks -c .config/pre-commit.yaml | |
| - name: Run pre-commit on all files | |
| run: pre-commit run -a -c .config/pre-commit.yaml | |
| validate-pr-title: | |
| name: Validate squash commit message | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.pull_request && github.event.pull_request.draft == false }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Cache pre-commit | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ hashFiles('.config/pre-commit.yaml') }} | |
| restore-keys: | | |
| pre-commit- | |
| - name: Install pre-commit and hooks | |
| run: | | |
| uv tool install pre-commit | |
| pre-commit install-hooks -c .config/pre-commit.yaml | |
| - name: Create commit message from PR | |
| run: | | |
| cat > /tmp/commit-msg.txt << 'EOF' | |
| ${{ github.event.pull_request.title }} | |
| ${{ github.event.pull_request.body }} | |
| EOF | |
| echo "--- Commit message to validate ---" | |
| cat /tmp/commit-msg.txt | |
| echo "--- End of commit message ---" | |
| - name: Find and validate with committed | |
| run: | | |
| # Find the committed binary in pre-commit cache | |
| COMMITTED_BIN=$(find ~/.cache/pre-commit -type f -name committed | head -n 1) | |
| if [ -z "$COMMITTED_BIN" ]; then | |
| echo "Error: committed binary not found in pre-commit cache" | |
| exit 1 | |
| fi | |
| echo "Using committed binary: $COMMITTED_BIN" | |
| "$COMMITTED_BIN" --config .config/committed.toml --commit-file /tmp/commit-msg.txt | |
| cargo-deny: | |
| name: Run cargo-deny | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| strategy: | |
| matrix: | |
| checks: | |
| - advisories | |
| - bans licenses sources | |
| continue-on-error: ${{ matrix.checks == 'advisories' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Run cargo-deny | |
| uses: EmbarkStudios/cargo-deny-action@v2 | |
| with: | |
| arguments: --all-features | |
| command: check | |
| command-arguments: ${{ matrix.checks }} -c .config/deny.toml | |
| semver-checks: | |
| name: Semver checks | |
| runs-on: ubuntu-latest | |
| if: | | |
| startsWith(github.head_ref, 'release-please--') && | |
| !github.event.pull_request.draft | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run semver checks for published crates | |
| uses: obi1kenobi/cargo-semver-checks-action@v2 | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy | |
| cache: true | |
| - name: Run clippy | |
| run: cargo clippy --workspace --all-features -- -D warnings | |
| clippy-zed-extension: | |
| name: Clippy (Zed extension) | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy | |
| target: wasm32-wasip2 | |
| cache: true | |
| - name: Run clippy | |
| run: cargo clippy --manifest-path extensions/forge-zed/Cargo.toml --target wasm32-wasip2 -- -D warnings | |
| rustfmt: | |
| name: rustfmt | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.draft }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: rustfmt | |
| cache: true | |
| - name: Check formatting | |
| run: | | |
| cargo fmt --all -- --check | |
| cargo fmt --manifest-path extensions/forge-zed/Cargo.toml -- --check | |
| lint: | |
| name: Lint | |
| if: ${{ always() && !github.event.pull_request.draft }} | |
| needs: | |
| [ | |
| pre-commit, | |
| validate-pr-title, | |
| cargo-deny, | |
| semver-checks, | |
| clippy, | |
| clippy-zed-extension, | |
| rustfmt, | |
| ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| result="${{ (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && 'failure' || 'success' }}" | |
| echo "result: $result" | |
| [[ "$result" == "success" ]] || exit 1 |