File tree Expand file tree Collapse file tree 2 files changed +70
-2
lines changed Expand file tree Collapse file tree 2 files changed +70
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : ci
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ pull_request :
7
+ workflow_dispatch :
8
+
9
+ jobs :
10
+ test :
11
+ runs-on : ${{ matrix.runner }}
12
+ strategy :
13
+ fail-fast : false
14
+ matrix :
15
+ flags : [""]
16
+ arch :
17
+ - amd64
18
+ runner :
19
+ - ubuntu-latest
20
+ steps :
21
+ - name : Checkout code
22
+ uses : actions/checkout@v4
23
+
24
+ - name : Install Go
25
+ uses : actions/setup-go@v5
26
+ with :
27
+ go-version : ' 1.23'
28
+ cache : false
29
+
30
+ - name : Get Go environment
31
+ id : go-env
32
+ shell : bash
33
+ run : |
34
+ echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV
35
+ echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV
36
+
37
+ # Build cache key prefix, using runner OS and arch.
38
+ - name : Compute cache prefix
39
+ id : cache-prefix
40
+ shell : bash
41
+ env :
42
+ RUNNER_PREFIX : ${{ runner.os }}-${{ runner.arch }}-go
43
+ ARCH_PREFIX : ${{ matrix.arch != 'amd64' && format('-{0}', matrix.arch) || '' }}
44
+ RACE_PREFIX : ${{ contains(matrix.flags, '-race') && '-race' || '' }}
45
+ run :
46
+ echo "cache_prefix=$RUNNER_PREFIX$ARCH_PREFIX$RACE_PREFIX" >> $GITHUB_ENV
47
+
48
+ - name : Set up cache
49
+ uses : actions/cache@v4
50
+ with :
51
+ path : |
52
+ ${{ env.cache }}
53
+ ${{ env.modcache }}
54
+ key : ${{ env.cache_prefix }}-${{ hashFiles('**/go.sum') }}
55
+ restore-keys : |
56
+ ${{ env.cache_prefix }}-
57
+
58
+ - name : Run tests
59
+ env :
60
+ GOARCH : ${{ matrix.arch }}
61
+ GOFLAGS : ${{ matrix.flags }}
62
+ run : go test --timeout 15m ./...
63
+
64
+ # Keep benchmark up to date.
65
+ - name : Run benchmarks
66
+ if : ${{ !contains(matrix.flags, '-race') }}
67
+ env :
68
+ GOARCH : ${{ matrix.arch }}
69
+ GOFLAGS : ${{ matrix.flags }}
70
+ run : go test --timeout 15m --benchtime 3x --benchmem --bench "Benchmark" --run=$^. ./...
Original file line number Diff line number Diff line change 9
9
# Common Go workflows from go faster
10
10
# See https://github.com/go-faster/x
11
11
jobs :
12
- test :
13
- uses : go-faster/x/.github/workflows/test.yml@main
14
12
lint :
15
13
uses : go-faster/x/.github/workflows/lint.yml@main
You can’t perform that action at this time.
0 commit comments