Skip to content

Commit d115e4d

Browse files
authored
Use module-specific workflows (#11)
* define workflow for always module * Update github workflow path * Add back working-directory but target specific module folder * Remove remaining dir matrices * fix linting issues * add missing newline * Update name of action to include target module * Add probe module workflow * Add graceful module workflow
1 parent 199f4a6 commit d115e4d

File tree

4 files changed

+286
-18
lines changed

4 files changed

+286
-18
lines changed

Diff for: .github/workflows/checks.yml renamed to .github/workflows/always.yml

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
name: checks
1+
name: check-always
22

33
on:
44
push:
55
branches:
66
- "main"
7+
paths:
8+
- "always/**"
9+
- ".github/workflows/always.yml"
710
pull_request:
811
branches:
912
- "*"
13+
paths:
14+
- "always/**"
15+
- ".github/workflows/always.yml"
1016

1117
jobs:
1218

@@ -17,7 +23,6 @@ jobs:
1723
strategy:
1824
matrix:
1925
go: [stable]
20-
dir: ['always', 'probe', 'graceful']
2126
fail-fast: true
2227
steps:
2328
- name: Checkout repo
@@ -28,13 +33,13 @@ jobs:
2833
go-version: ${{ matrix.go }}
2934
cache: true
3035
- name: Run go mod tidy
31-
working-directory: ${{ matrix.dir }}
36+
working-directory: always
3237
run: go mod tidy && git diff --exit-code
3338
- name: Run go mod verify
34-
working-directory: ${{ matrix.dir }}
39+
working-directory: always
3540
run: go mod verify
3641
- name: Run formatting
37-
working-directory: ${{ matrix.dir }}
42+
working-directory: always
3843
run: go run golang.org/x/tools/cmd/goimports@latest -w . && git diff --exit-code
3944

4045
lint:
@@ -44,7 +49,6 @@ jobs:
4449
strategy:
4550
matrix:
4651
go: [stable]
47-
dir: ['always', 'probe', 'graceful']
4852
fail-fast: true
4953
steps:
5054
- name: Checkout repo
@@ -59,7 +63,7 @@ jobs:
5963
with:
6064
version: latest
6165
args: --timeout=4m
62-
working-directory: ${{ matrix.dir }}
66+
working-directory: always
6367

6468
test:
6569
name: test
@@ -68,7 +72,6 @@ jobs:
6872
strategy:
6973
matrix:
7074
go: [stable]
71-
dir: ['always', 'probe', 'graceful']
7275
fail-fast: true
7376
steps:
7477
- name: Checkout repo
@@ -79,13 +82,13 @@ jobs:
7982
go-version: ${{ matrix.go }}
8083
cache: true
8184
- name: Run tests
82-
working-directory: ${{ matrix.dir }}
85+
working-directory: always
8386
run: go test -shuffle=on -v -count=1 -race -failfast -timeout=30s -covermode=atomic -coverprofile=coverage.out ./...
8487
- name: Codecov Coverage
8588
uses: codecov/codecov-action@v4
8689
with:
8790
token: ${{ secrets.CODECOV_TOKEN }}
88-
working-directory: ${{ matrix.dir }}
91+
working-directory: always
8992

9093
benchmark:
9194
name: benchmark
@@ -94,7 +97,6 @@ jobs:
9497
strategy:
9598
matrix:
9699
go: [stable]
97-
dir: ['always', 'probe', 'graceful']
98100
fail-fast: true
99101
steps:
100102
- name: Checkout repo
@@ -105,7 +107,7 @@ jobs:
105107
go-version: ${{ matrix.go }}
106108
cache: true
107109
- name: Run benchmarks
108-
working-directory: ${{ matrix.dir }}
110+
working-directory: always
109111
run: go test -v -shuffle=on -run=- -bench=. -benchtime=1x -timeout=10s ./...
110112

111113
build:
@@ -115,7 +117,6 @@ jobs:
115117
strategy:
116118
matrix:
117119
go: [stable]
118-
dir: ['always', 'probe', 'graceful']
119120
fail-fast: true
120121
steps:
121122
- name: Checkout repo
@@ -126,8 +127,8 @@ jobs:
126127
go-version: ${{ matrix.go }}
127128
cache: true
128129
- name: Run go generate
129-
working-directory: ${{ matrix.dir }}
130+
working-directory: always
130131
run: go generate ./... && git diff --exit-code
131132
- name: Run go build
132-
working-directory: ${{ matrix.dir }}
133+
working-directory: always
133134
run: go build -o /dev/null ./...

Diff for: .github/workflows/graceful.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: check-graceful
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- "graceful/**"
9+
- ".github/workflows/graceful.yml"
10+
pull_request:
11+
branches:
12+
- "*"
13+
paths:
14+
- "graceful/**"
15+
- ".github/workflows/graceful.yml"
16+
17+
jobs:
18+
19+
clean:
20+
name: clean
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 2
23+
strategy:
24+
matrix:
25+
go: [stable]
26+
fail-fast: true
27+
steps:
28+
- name: Checkout repo
29+
uses: actions/checkout@v4
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: ${{ matrix.go }}
34+
cache: true
35+
- name: Run go mod tidy
36+
working-directory: graceful
37+
run: go mod tidy && git diff --exit-code
38+
- name: Run go mod verify
39+
working-directory: graceful
40+
run: go mod verify
41+
- name: Run formatting
42+
working-directory: graceful
43+
run: go run golang.org/x/tools/cmd/goimports@latest -w . && git diff --exit-code
44+
45+
lint:
46+
name: lint
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 4
49+
strategy:
50+
matrix:
51+
go: [stable]
52+
fail-fast: true
53+
steps:
54+
- name: Checkout repo
55+
uses: actions/checkout@v4
56+
- name: Set up Go
57+
uses: actions/setup-go@v5
58+
with:
59+
go-version: ${{ matrix.go }}
60+
cache: true
61+
- name: Run go linting
62+
uses: golangci/golangci-lint-action@v4
63+
with:
64+
version: latest
65+
args: --timeout=4m
66+
working-directory: graceful
67+
68+
test:
69+
name: test
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 2
72+
strategy:
73+
matrix:
74+
go: [stable]
75+
fail-fast: true
76+
steps:
77+
- name: Checkout repo
78+
uses: actions/checkout@v4
79+
- name: Set up Go
80+
uses: actions/setup-go@v5
81+
with:
82+
go-version: ${{ matrix.go }}
83+
cache: true
84+
- name: Run tests
85+
working-directory: graceful
86+
run: go test -shuffle=on -v -count=1 -race -failfast -timeout=30s -covermode=atomic -coverprofile=coverage.out ./...
87+
- name: Codecov Coverage
88+
uses: codecov/codecov-action@v4
89+
with:
90+
token: ${{ secrets.CODECOV_TOKEN }}
91+
working-directory: graceful
92+
93+
benchmark:
94+
name: benchmark
95+
runs-on: ubuntu-latest
96+
timeout-minutes: 2
97+
strategy:
98+
matrix:
99+
go: [stable]
100+
fail-fast: true
101+
steps:
102+
- name: Checkout repo
103+
uses: actions/checkout@v4
104+
- name: Set up Go
105+
uses: actions/setup-go@v5
106+
with:
107+
go-version: ${{ matrix.go }}
108+
cache: true
109+
- name: Run benchmarks
110+
working-directory: graceful
111+
run: go test -v -shuffle=on -run=- -bench=. -benchtime=1x -timeout=10s ./...
112+
113+
build:
114+
name: build
115+
runs-on: ubuntu-latest
116+
timeout-minutes: 4
117+
strategy:
118+
matrix:
119+
go: [stable]
120+
fail-fast: true
121+
steps:
122+
- name: Checkout repo
123+
uses: actions/checkout@v4
124+
- name: Set up Go
125+
uses: actions/setup-go@v5
126+
with:
127+
go-version: ${{ matrix.go }}
128+
cache: true
129+
- name: Run go generate
130+
working-directory: graceful
131+
run: go generate ./... && git diff --exit-code
132+
- name: Run go build
133+
working-directory: graceful
134+
run: go build -o /dev/null ./...

Diff for: .github/workflows/probe.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: check-probe
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- "probe/**"
9+
- ".github/workflows/probe.yml"
10+
pull_request:
11+
branches:
12+
- "*"
13+
paths:
14+
- "probe/**"
15+
- ".github/workflows/probe.yml"
16+
17+
jobs:
18+
19+
clean:
20+
name: clean
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 2
23+
strategy:
24+
matrix:
25+
go: [stable]
26+
fail-fast: true
27+
steps:
28+
- name: Checkout repo
29+
uses: actions/checkout@v4
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: ${{ matrix.go }}
34+
cache: true
35+
- name: Run go mod tidy
36+
working-directory: probe
37+
run: go mod tidy && git diff --exit-code
38+
- name: Run go mod verify
39+
working-directory: probe
40+
run: go mod verify
41+
- name: Run formatting
42+
working-directory: probe
43+
run: go run golang.org/x/tools/cmd/goimports@latest -w . && git diff --exit-code
44+
45+
lint:
46+
name: lint
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 4
49+
strategy:
50+
matrix:
51+
go: [stable]
52+
fail-fast: true
53+
steps:
54+
- name: Checkout repo
55+
uses: actions/checkout@v4
56+
- name: Set up Go
57+
uses: actions/setup-go@v5
58+
with:
59+
go-version: ${{ matrix.go }}
60+
cache: true
61+
- name: Run go linting
62+
uses: golangci/golangci-lint-action@v4
63+
with:
64+
version: latest
65+
args: --timeout=4m
66+
working-directory: probe
67+
68+
test:
69+
name: test
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 2
72+
strategy:
73+
matrix:
74+
go: [stable]
75+
fail-fast: true
76+
steps:
77+
- name: Checkout repo
78+
uses: actions/checkout@v4
79+
- name: Set up Go
80+
uses: actions/setup-go@v5
81+
with:
82+
go-version: ${{ matrix.go }}
83+
cache: true
84+
- name: Run tests
85+
working-directory: probe
86+
run: go test -shuffle=on -v -count=1 -race -failfast -timeout=30s -covermode=atomic -coverprofile=coverage.out ./...
87+
- name: Codecov Coverage
88+
uses: codecov/codecov-action@v4
89+
with:
90+
token: ${{ secrets.CODECOV_TOKEN }}
91+
working-directory: probe
92+
93+
benchmark:
94+
name: benchmark
95+
runs-on: ubuntu-latest
96+
timeout-minutes: 2
97+
strategy:
98+
matrix:
99+
go: [stable]
100+
fail-fast: true
101+
steps:
102+
- name: Checkout repo
103+
uses: actions/checkout@v4
104+
- name: Set up Go
105+
uses: actions/setup-go@v5
106+
with:
107+
go-version: ${{ matrix.go }}
108+
cache: true
109+
- name: Run benchmarks
110+
working-directory: probe
111+
run: go test -v -shuffle=on -run=- -bench=. -benchtime=1x -timeout=10s ./...
112+
113+
build:
114+
name: build
115+
runs-on: ubuntu-latest
116+
timeout-minutes: 4
117+
strategy:
118+
matrix:
119+
go: [stable]
120+
fail-fast: true
121+
steps:
122+
- name: Checkout repo
123+
uses: actions/checkout@v4
124+
- name: Set up Go
125+
uses: actions/setup-go@v5
126+
with:
127+
go-version: ${{ matrix.go }}
128+
cache: true
129+
- name: Run go generate
130+
working-directory: probe
131+
run: go generate ./... && git diff --exit-code
132+
- name: Run go build
133+
working-directory: probe
134+
run: go build -o /dev/null ./...

0 commit comments

Comments
 (0)