-
Notifications
You must be signed in to change notification settings - Fork 11
119 lines (113 loc) · 3.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Tests / Code Coverage
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled]
merge_group:
types: [checks_requested]
permissions:
contents: read
repository-projects: read
concurrency:
group: ci-${{ github.ref }}-tests
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/sedaprotocol/vrf-go
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
arch: [amd64, arm64]
targetos: [darwin, linux]
name: sedad ${{ matrix.targetos }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
- name: Cache binaries
id: cache-binaries
uses: actions/cache@v3
with:
path: ./cmd/sedad/sedad
key: sedad-${{ matrix.targetos }}-${{ matrix.arch }}
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Setup go
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: true
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
- run: git config --global url.https://${GITHUB_TOKEN}@github.com/.insteadOf https://github.com/
- name: Compile
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
run: |
go mod download
make build
tests:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/sedaprotocol/vrf-go
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
cache: true
cache-dependency-path: go.sum
- run: git config --global url.https://${GITHUB_TOKEN}@github.com/.insteadOf https://github.com/
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
**/Makefile
Makefile
- name: Test & coverage report creation
if: env.GIT_DIFF
run: make test-unit-cover
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
path: ./${{ matrix.part }}profile.out
test-e2e:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/sedaprotocol/vrf-go
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 10
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- uses: actions/checkout@v4
- run: git config --global url.https://${GITHUB_TOKEN}@github.com/.insteadOf https://github.com/
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Build e2e Docker Image
run: make docker-build-e2e
- name: Test E2E
run: make test-e2e