Skip to content

Commit 8ad3f09

Browse files
committed
[actions] rethink testing workflow
1 parent 7c21774 commit 8ad3f09

File tree

3 files changed

+99
-75
lines changed

3 files changed

+99
-75
lines changed

.github/workflows/docker-publish.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,6 @@ permissions:
77
contents: read
88

99
jobs:
10-
test:
11-
name: Test
12-
runs-on: ubuntu-latest
13-
steps:
14-
# step 1: checkout repository code
15-
- name: Checkout code into workspace directory
16-
uses: actions/checkout@v4
17-
18-
# step 2: set up go
19-
- name: Set up Go
20-
uses: actions/setup-go@v5
21-
with:
22-
go-version: stable
23-
24-
# step 3: install dependencies
25-
- name: Install all Go dependencies
26-
run: go mod download
27-
28-
# step 4: run test
29-
- name: Run coverage
30-
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
31-
3210
e2e:
3311
name: E2E
3412
runs-on: ubuntu-latest
@@ -65,7 +43,6 @@ jobs:
6543
contents: read
6644
packages: write
6745
needs:
68-
- test
6946
- e2e
7047
if: github.actor != 'dependabot[bot]'
7148
uses: ./.github/workflows/docker-build.yml

.github/workflows/go.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Go
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [master]
10+
paths:
11+
- "**.go"
12+
- "go.mod"
13+
- "go.sum"
14+
pull_request:
15+
branches: [master]
16+
paths:
17+
- "**.go"
18+
- "go.mod"
19+
- "go.sum"
20+
21+
jobs:
22+
golangci:
23+
name: Lint
24+
runs-on: ubuntu-latest
25+
steps:
26+
# step 1: checkout repository code
27+
- name: Checkout code into workspace directory
28+
uses: actions/checkout@v4
29+
30+
# step 2: set up go
31+
- name: Set up Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version: stable
35+
36+
# step 3: run golangci-lint
37+
- name: Run golangci-lint
38+
uses: golangci/golangci-lint-action@v8
39+
with:
40+
version: latest
41+
args: --timeout=5m
42+
43+
test:
44+
name: Test
45+
runs-on: ubuntu-latest
46+
steps:
47+
# step 1: checkout repository code
48+
- name: Checkout code into workspace directory
49+
uses: actions/checkout@v4
50+
51+
# step 2: set up go
52+
- name: Set up Go
53+
uses: actions/setup-go@v5
54+
with:
55+
go-version: stable
56+
57+
# step 3: install dependencies
58+
- name: Install all Go dependencies
59+
run: go mod download
60+
61+
# step 4: run test
62+
- name: Run coverage
63+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
64+
65+
# step 5: upload coverage
66+
- name: Upload coverage to Codecov
67+
uses: codecov/codecov-action@v5
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
71+
benchmark:
72+
name: Benchmark
73+
runs-on: ubuntu-latest
74+
steps:
75+
# step 1: checkout repository code
76+
- name: Checkout code into workspace directory
77+
uses: actions/checkout@v4
78+
79+
# step 2: set up go
80+
- name: Set up Go
81+
uses: actions/setup-go@v5
82+
with:
83+
go-version: stable
84+
85+
- name: Run benchmarks
86+
run: go test -bench=. -benchmem ./... | tee benchmark.txt
87+
88+
- name: Upload benchmark results
89+
uses: benchmark-action/github-action-benchmark@v1
90+
with:
91+
name: Benchmark
92+
tool: "go"
93+
output-file-path: benchmark.txt
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
auto-push: false
96+
alert-threshold: "200%"
97+
comment-on-alert: true
98+
fail-on-alert: true
99+
alert-comment-cc-users: "@capcom6"

.github/workflows/golangci-lint.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)