This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
77 lines (77 loc) · 2.27 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Test
on:
push:
branches:
- master
- release/**
pull_request:
permissions:
contents: read
defaults:
run:
shell: bash
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
find-modules:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-modules.outputs.modules }}
steps:
- uses: actions/checkout@v2
- id: set-modules
run: |
GO_MODULES=$(find . -type d -name platform -prune -or -type f -name go.mod -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]')
echo $GO_MODULES
echo "::set-output name=modules::$GO_MODULES"
test:
needs: find-modules
name: Test ${{ matrix.module }}
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go }}-
${{ runner.os }}-go-
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: List Packages
run: go list ./... # sanity check that we're building/testing what we expect
working-directory: ${{ matrix.module }}
- name: Build
run: go build ./...
working-directory: ${{ matrix.module }}
- name: Vet
run: go vet ./...
working-directory: ${{ matrix.module }}
- name: Check go.mod Tidiness
run: go mod tidy && git diff --exit-code
working-directory: ${{ matrix.module }}
- name: Test
run: go test -count=1 ./...
working-directory: ${{ matrix.module }}
- name: Test (race)
run: go test -count=1 -race ./...
working-directory: ${{ matrix.module }}
timeout-minutes: 10
strategy:
matrix:
module: ${{fromJson(needs.find-modules.outputs.modules)}}
go: ["1.17"]
os: [ubuntu] # windows, macos
fail-fast: false