-
Notifications
You must be signed in to change notification settings - Fork 88
78 lines (76 loc) · 2.46 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
name: go tests
on:
pull_request:
push:
branches:
- main*
jobs:
unit_tests:
runs-on: charon-ci
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-go
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test -coverprofile=coverage.out -covermode=atomic -timeout=5m -race ./...
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
integration_tests:
runs-on: charon-ci
if: ${{ always() }} # makes this step always execute, even if unit_tests fails
needs:
- unit_tests
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-go
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test -v -timeout=10m -race github.com/obolnetwork/charon/testutil/integration -integration
compose_tests:
runs-on: charon-ci
if: ${{ always() }} # makes this step always execute, even if unit_tests or integration_tests fails
needs:
- unit_tests
- integration_tests
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2 # For compose to build images
with:
driver-opts: "image=moby/buildkit:v0.10.5" # avoid unknown/unknown arch in ghcr
- uses: ./.github/actions/setup-go
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: |
echo "CHARON_REPO=$(pwd)" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
- run: go test -race github.com/obolnetwork/charon/testutil/compose/smoke -v -integration -sudo-perms -timeout=20m -log-dir=.
- uses: actions/upload-artifact@v3
if: always()
with:
name: smoke-test-logs
path: testutil/compose/smoke/*.log
retention-days: 3