Skip to content

Commit cbad306

Browse files
committed
⚙️ Fix more CI?
1 parent e2a1855 commit cbad306

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ jobs:
9595
key: ${{ matrix.os }}-${{ matrix.go-module }}-${{ hashFiles('**/go.sum') }}
9696
restore-keys: |
9797
${{ matrix.os }}-${{ matrix.go-module }}-
98+
- name: Synchronise workspace
99+
run: go work sync
100+
working-directory: ${{ matrix.go-module }}
98101
- name: Compute workspace package patterns
99102
id: workspace-packages
100103
shell: pwsh

.github/workflows/codeql-analysis.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ jobs:
4646
with:
4747
go-version: '1.25.6'
4848

49+
- name: Compute workspace package patterns
50+
id: workspace-packages
51+
shell: pwsh
52+
run: |
53+
Push-Location "utils"
54+
$work = go work edit -json | ConvertFrom-Json
55+
$patterns = @($work.Use | ForEach-Object { "$($_.DiskPath)/..." })
56+
"patterns=$($patterns -join ' ')" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
57+
Pop-Location
58+
4959
# Initializes the CodeQL tools for scanning.
5060
- name: Initialize CodeQL
5161
uses: github/codeql-action/init@v4.36.1
@@ -57,8 +67,12 @@ jobs:
5767
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5868

5969
- name: Build workspace for analysis
60-
run: go test ./... -run TestDoesNotExist
61-
working-directory: utils
70+
shell: pwsh
71+
run: |
72+
Push-Location "utils"
73+
$patterns = "${{ steps.workspace-packages.outputs.patterns }}" -split ' '
74+
go test @patterns -run TestDoesNotExist
75+
Pop-Location
6276
6377
- name: Perform CodeQL Analysis
6478
uses: github/codeql-action/analyze@v4.36.1

DEVELOPMENT.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Go module with its own `go.mod`.
1616
To run all tests across the workspace:
1717
```bash
1818
cd utils
19-
go test ./...
19+
go work sync
20+
go test $(go work edit -json | jq -r '.Use[].DiskPath + "/..."')
2021
```
2122

2223
To run tests for a single subproject, run the same command from that subproject
@@ -29,7 +30,8 @@ We use the built-in mock library and use [mockgen](https://github.com/golang/moc
2930
To generate mocks:
3031
```bash
3132
cd utils
32-
go generate ./...
33+
go work sync
34+
go generate $(go work edit -json | jq -r '.Use[].DiskPath + "/..."')
3335
```
3436

3537
We make use of `go:generate` comments to instruct which `mockgen` commands should be run.
@@ -46,7 +48,8 @@ They come from [golangci-lint](https://golangci-lint.run/). To run this locally:
4648
```bash
4749
# Run from utils/ for the workspace or from an individual submodule directory.
4850
cd utils
49-
golangci-lint run ./...
51+
go work sync
52+
golangci-lint run $(go work edit -json | jq -r '.Use[].DiskPath + "/..."')
5053
```
5154

5255
### Precommit

0 commit comments

Comments
 (0)