-
Notifications
You must be signed in to change notification settings - Fork 12
89 lines (84 loc) · 1.78 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
78
79
80
81
82
83
84
85
86
87
88
89
name: test
on:
push:
branches:
- 'main'
- 'releases/v*'
tags:
- 'v*'
pull_request:
jobs:
prepare-validate:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.generate.outputs.targets }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v6
with:
target: validate
validate:
runs-on: ubuntu-latest
needs:
- prepare-validate
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare-validate.outputs.targets) }}
steps:
-
name: Validate
uses: docker/bake-action@v6
with:
targets: ${{ matrix.target }}
test:
runs-on: ubuntu-latest
steps:
-
name: Test
uses: docker/bake-action@v6
with:
targets: test
-
name: Upload coverage
uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
example:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
-
name: Download modules
run: |
go mod download
working-directory: ./example
-
name: Run
run: |
go run main.go
working-directory: ./example
-
name: List docs
run: |
tree -nh ./example/docs
-
name: Upload docs
uses: actions/upload-artifact@v4
with:
name: example-docs
path: ./example/docs/*
if-no-files-found: error