Skip to content

Commit 129e757

Browse files
committed
chore: simplify workflow by using workspace
Signed-off-by: Knut Ahlers <knut@ahlers.me>
1 parent 3582903 commit 129e757

2 files changed

Lines changed: 14 additions & 22 deletions

File tree

.forgejo/workflows/pr-test.yaml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,18 @@ jobs:
2020
- name: Marking workdir safe
2121
run: git config --global --add safe.directory /__w/ots/ots
2222

23-
- name: 'Lint and test code: API'
23+
- name: Initialize Go Workspace
2424
run: |
25-
go test -cover -v ./...
26-
golangci-lint run ./...
25+
go work init
26+
find . -name 'go.mod' | xargs dirname | xargs go work use
2727
28-
- name: 'Lint and test code: Client'
29-
working-directory: ./pkg/client
28+
- name: Run golangci-lint
3029
run: |
31-
go test -cover -v ./...
32-
golangci-lint run ./...
30+
golangci-lint run $(go list -f "{{.Dir}}/..." -m)
3331
34-
- name: 'Lint and test code: OTS-CLI'
35-
working-directory: ./cmd/ots-cli
32+
- name: Run go test
3633
run: |
37-
go test -cover -v ./...
38-
golangci-lint run ./...
34+
go list -m | xargs go test -v -cover
3935
4036
- name: Generate (and validate) translations
4137
run: make translate

.github/workflows/test-and-build.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,18 @@ jobs:
2929
- name: Marking workdir safe
3030
run: git config --global --add safe.directory /__w/ots/ots
3131

32-
- name: 'Lint and test code: API'
32+
- name: Initialize Go Workspace
3333
run: |
34-
go test -cover -v ./...
35-
golangci-lint run ./...
34+
go work init
35+
find . -name 'go.mod' | xargs dirname | xargs go work use
3636
37-
- name: 'Lint and test code: Client'
38-
working-directory: ./pkg/client
37+
- name: Run golangci-lint
3938
run: |
40-
go test -cover -v ./...
41-
golangci-lint run ./...
39+
golangci-lint run $(go list -f "{{.Dir}}/..." -m)
4240
43-
- name: 'Lint and test code: OTS-CLI'
44-
working-directory: ./cmd/ots-cli
41+
- name: Run go test
4542
run: |
46-
go test -cover -v ./...
47-
golangci-lint run ./...
43+
go list -m | xargs go test -v -cover
4844
4945
- name: Generate (and validate) translations
5046
run: make translate

0 commit comments

Comments
 (0)