-
Notifications
You must be signed in to change notification settings - Fork 135
112 lines (95 loc) · 3.4 KB
/
managed.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
name: Managed
on:
push:
branches:
- main
- pmm-*
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
paths-ignore:
- 'admin/**'
- 'agent/**'
- 'api-tests/**'
- 'cli-tests/**'
- 'docs/**'
- 'qan-api2/**'
- 'update/**'
- 'vmproxy/**'
jobs:
test:
name: Tests
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
fail-fast: false
env:
PMM_SERVER_IMAGE: perconalab/pmm-server:dev-latest
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
OAUTH_PMM_CLIENT_ID: ${{ secrets.OAUTH_PMM_CLIENT_ID }}
OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OAUTH_PMM_CLIENT_SECRET }}
DEVCONTAINER_CACHE_ENABLED: false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Enable Go build cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
uses: actions/cache@v3
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ runner.os }}-go-build-${{ github.ref }}-
${{ runner.os }}-go-build-
- name: Enable Go modules cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-modules-
- name: Download tools
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
run: |
pushd tools && go mod download -x
popd && go mod download -x
- name: Initialize CI environment
run: make env-compose-up # the container workdir is /root/go/src/github.com/percona/pmm
- name: Restore Go build cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
continue-on-error: true
run: docker cp ~/.cache/go-build pmm-server:/root/.cache/go-build
- name: Restore Go modules cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
continue-on-error: true
run: docker cp ~/go/pkg/mod pmm-server:/root/go/pkg/mod
- name: Mark the root directory of pmm as safe
run: docker exec -i pmm-server git config --global --add safe.directory /root/go/src/github.com/percona/pmm
- name: Update binaries
run: docker exec -i pmm-server make run-managed-ci run-agent run-vmproxy
- name: Run tests
run: docker exec -i pmm-server make -C managed test-cover
- name: Run PMM server update test
run: docker exec -i pmm-server make -C managed test-update
- name: Upload coverage results
uses: codecov/codecov-action@v3
with:
file: managed/cover.out
flags: managed
env_vars: PMM_SERVER_IMAGE
fail_ci_if_error: false
- name: Cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
run: |
docker exec pmm-server go clean -testcache
docker exec pmm-server find ./managed -type d -name fuzzdata -exec rm -r {} +
rm -fr ~/.cache/go-build
mkdir -p ~/.cache
docker cp pmm-server:/root/.cache/go-build ~/.cache/go-build
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env | sort
go env | sort
git status