GitHub Actions use matrix strategy on go-test #4
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: golangci-lint | |
on: | |
push: | |
branches-ignore: [ main ] | |
env: | |
GO_VERSION: '1.24' | |
GOLANGCI_LINT_VERSION: 'v2.1' | |
jobs: # example from https://github.com/golangci/golangci-lint-action/tree/main | |
detect-modules: | |
runs-on: ubuntu-latest | |
outputs: | |
modules: ${{ steps.set-modules.outputs.modules }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- run: go work init && find . -name go.mod|sed -r 's/(.*)(go.mod)/use \1/g' >> go.work # kludge | |
- id: set-modules | |
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT | |
golangci-lint: | |
needs: detect-modules | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- run: go work init && find . -name go.mod|sed -r 's/(.*)(go.mod)/use \1/g' >> go.work # kludge | |
- name: golangci-lint ${{ matrix.modules }} | |
uses: golangci/golangci-lint-action@v8 | |
with: | |
version: ${{ env.GOLANGCI_LINT_VERSION }} | |
working-directory: ${{ matrix.modules }} |