chore: update examples to xpg v0.4.0" (#19) #15
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| GOTOOLCHAIN: local | |
| jobs: | |
| modules: | |
| name: Discover modules | |
| runs-on: ubuntu-latest | |
| outputs: | |
| modules: ${{ steps.modules.outputs.modules }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v7 | |
| - name: Discover Go modules | |
| id: modules | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| modules="$( | |
| { | |
| printf '.\n' | |
| find ./extra ./examples \ | |
| -name go.mod \ | |
| -type f \ | |
| -print | | |
| while IFS= read -r mod; do | |
| dirname "${mod#./}" | |
| done | |
| } | | |
| sort | | |
| jq -R -s -c 'split("\n")[:-1]' | |
| )" | |
| echo "modules=${modules}" >> "${GITHUB_OUTPUT}" | |
| lint: | |
| name: Lint (${{ matrix.module }}) | |
| needs: | |
| - modules | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| module: ${{ fromJSON(needs.modules.outputs.modules) }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| cache-dependency-path: | | |
| go.sum | |
| extra/**/go.mod | |
| examples/**/go.mod | |
| - name: Create temporary Go workspace | |
| run: bash .github/scripts/create-go-workspace.sh --with-examples | |
| - name: Verify workspace resolution | |
| env: | |
| GOWORK: ${{ github.workspace }}/go.work | |
| run: | | |
| set -euo pipefail | |
| test "$(go env GOWORK)" = "${GITHUB_WORKSPACE}/go.work" | |
| go list -m \ | |
| -f '{{if .Main}}{{.Path}} => {{.Dir}}{{end}}' \ | |
| all | | |
| sed '/^$/d' | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| env: | |
| GOWORK: ${{ github.workspace }}/go.work | |
| with: | |
| version: v2.13.1 | |
| working-directory: ${{ matrix.module }} | |
| args: >- | |
| --config=${{ github.workspace }}/.golangci.yml | |
| --timeout=5m | |
| --modules-download-mode=readonly | |
| result: | |
| name: Lint | |
| if: always() | |
| needs: | |
| - lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check lint jobs | |
| run: test "${{ needs.lint.result }}" = "success" |