-
Notifications
You must be signed in to change notification settings - Fork 553
80 lines (67 loc) · 2.08 KB
/
tests.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
name: tests
on:
push:
pull_request:
jobs:
test:
name: run tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go:
- "1.21"
- "1.20"
- "1.19"
- "1.18"
- "1.17"
- "1.16"
- "1.15"
- "1.14"
- "1.13"
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- run: go version
- name: install lambda runtime interface emulator
run: curl -L -o /usr/local/bin/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-x86_64
- run: chmod +x /usr/local/bin/aws-lambda-rie
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Edit the go.mod file to allow tests to run for versions of go before 1.16
run: >
if [[ ${{ matrix.go }} < "1.16" ]]; then
sed -i.bak 's/^.*retract.*$//' go.mod
else
echo "no edit required"
fi
- name: go test
run: go test -v -race ./...
coverage:
name: run tests with coverage
runs-on: ubuntu-latest
strategy:
matrix:
go:
- "1.21"
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: install lambda runtime interface emulator
run: curl -L -o /usr/local/bin/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-x86_64
- run: chmod +x /usr/local/bin/aws-lambda-rie
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: go test
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
env_vars: GO
env:
GO: ${{ matrix.go }}