Skip to content

Commit e66ccc8

Browse files
authored
chore: sample with github actions (#24)
1 parent 867942f commit e66ccc8

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

README.md

+39-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,43 @@ func TestC(t *testing.T) {
5353

5454
> Because of `go test` package separation, you have to call `buckets.Buckets(m)` in every package you want to ignore.
5555
56-
# Why?
56+
## Why?
5757
Speed up ci pipelines by parallelizing go tests without thinking about [t.Parallel](https://golang.org/pkg/testing/#T.Parallel).
58-
And getting rid of weird piping `go test $(go list ./... | grep -v /ignore/)`
58+
And getting rid of weird piping `go test $(go list ./... | grep -v /ignore/)`
59+
60+
61+
## Extra Github Actions
62+
You can use following github action when using test buckets:
63+
```yaml
64+
on:
65+
push:
66+
67+
name: "push"
68+
jobs:
69+
test:
70+
strategy:
71+
matrix:
72+
platform: [ubuntu-latest]
73+
bucket: [0, 1, 2, 3]
74+
env:
75+
TOTAL_BUCKETS: 4
76+
runs-on: ${{ matrix.platform }}
77+
steps:
78+
-
79+
name: Checkout code
80+
uses: actions/[email protected]
81+
-
82+
name: Get go.mod details
83+
84+
id: go-mod-details
85+
-
86+
name: Install Go
87+
uses: actions/setup-go@v4
88+
with:
89+
go-version: ${{ steps.go-mod-details.outputs.go_version }}
90+
-
91+
name: Test
92+
run: go test -v -count=1 ./...
93+
env:
94+
BUCKET: ${{ matrix.bucket }}
95+
```

0 commit comments

Comments
 (0)