1919
2020 - uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
2121 with :
22- go-version-file : ' go.mod '
22+ go-version-file : ' go.work '
2323 check-latest : true
2424 cache : true
2525
@@ -42,37 +42,62 @@ jobs:
4242 - name : Run ShellCheck
4343 uses : ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
4444
45+ detect-modules :
46+ runs-on : ubuntu-latest
47+ outputs :
48+ modules : ${{ steps.set-modules.outputs.modules }}
49+ steps :
50+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
51+ with :
52+ persist-credentials : false
53+ - uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
54+ with :
55+ go-version-file : ' go.work'
56+ check-latest : true
57+ - id : set-modules
58+ run : echo "modules=$(go list -m -json | jq -s 'del(.[] | select(.Path == "github.com/sigstore/scaffolding/hack"))' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
59+
4560 golangci :
4661 name : lint
62+ needs : detect-modules
4763 runs-on : ubuntu-latest
64+ strategy :
65+ matrix :
66+ modules : ${{ fromJSON(needs.detect-modules.outputs.modules) }}
4867 steps :
4968 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5069 with :
5170 persist-credentials : false
5271
5372 - uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
5473 with :
55- go-version-file : ' go.mod '
74+ go-version-file : ' go.work '
5675 check-latest : true
5776
5877 - name : golangci-lint
5978 uses : golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0
6079 with :
6180 version : v2.4
81+ working-directory : ${{ matrix.modules }}
6282
6383 unit-test :
6484 name : run unit tests
85+ needs : detect-modules
6586 runs-on : ubuntu-latest
87+ strategy :
88+ matrix :
89+ modules : ${{ fromJSON(needs.detect-modules.outputs.modules) }}
6690 steps :
6791 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6892 with :
6993 persist-credentials : false
7094
7195 - uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
7296 with :
73- go-version-file : ' go.mod '
97+ go-version-file : ' go.work '
7498 check-latest : true
7599
76100 - name : run unit tests
77101 run : |
78- go test $(go list ./... | grep -v third_party/)
102+ cd ${{ matrix.modules }}
103+ go test ./...
0 commit comments