chore: bump Python target version from 3.11 to 3.12 #13
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: CI - PR Checks | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| # Detect if PR contains code changes (skip expensive checks for docs-only PRs) | |
| check-code-changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| has_code_changes: ${{ steps.filter.outputs.code }} | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Check for code changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| code: | |
| - '!docs/**' | |
| - '!**/*.md' | |
| - '!LICENSE' | |
| - '!OWNERS' | |
| # Go: lint, build, and test | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| needs: check-code-changes | |
| if: needs.check-code-changes.outputs.has_code_changes == 'true' | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Extract Go version from go.mod | |
| run: sed -En 's/^go (.*)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "${{ env.GO_VERSION }}" | |
| cache-dependency-path: ./go.sum | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: v2.8.0 | |
| args: "" | |
| - name: Build | |
| run: make build | |
| - name: Test | |
| run: make test | |
| # Python: lint (only if Python files exist) | |
| python-lint: | |
| runs-on: ubuntu-latest | |
| needs: check-code-changes | |
| if: needs.check-code-changes.outputs.has_code_changes == 'true' | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Check for Python files | |
| id: check-python | |
| run: | | |
| if find . -name "*.py" -not -path "./.git/*" | head -1 | grep -q .; then | |
| echo "has_python=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_python=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up Python | |
| if: steps.check-python.outputs.has_python == 'true' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install ruff | |
| if: steps.check-python.outputs.has_python == 'true' | |
| run: pip install ruff | |
| - name: Run ruff check | |
| if: steps.check-python.outputs.has_python == 'true' | |
| run: ruff check . | |
| - name: Run ruff format check | |
| if: steps.check-python.outputs.has_python == 'true' | |
| run: ruff format --check . | |
| # Container: build (no push) to validate Dockerfile | |
| container-build: | |
| runs-on: ubuntu-latest | |
| needs: check-code-changes | |
| if: needs.check-code-changes.outputs.has_code_changes == 'true' | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build container (no push) | |
| run: | | |
| docker buildx build \ | |
| --platform linux/amd64 \ | |
| --tag test-build:pr-${{ github.event.pull_request.number }} \ | |
| . |