This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
104 lines (90 loc) · 3.55 KB
/
cli-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
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
---
name: CLI tests
on:
workflow_call:
inputs:
make_target:
description: 'Make target to execute'
type: string
required: true
jobs:
integration_tests:
name: CLI ${{inputs.make_target}}
runs-on: ubuntu-latest
timeout-minutes: 60
env:
# no `-mod=readonly` to test PRs made by @dependabot;
# `git diff --exit-code` step below still checks what we need
GOPRIVATE: github.com/percona,github.com/percona/percona-everest-backend,github.com/percona/everest-operator
PERCONA_VERSION_SERVICE_URL: https://check-dev.percona.com/versions/v1
MAKE_TARGET: ${{ inputs.make_target }}
steps:
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Set up Go release
uses: percona-platform/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Set GO_VERSION environment variable
run: |
go version
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Enable Go modules cache
uses: percona-platform/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
- name: Enable Go build cache
uses: percona-platform/cache@v3
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go-version }}-build-
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
# https://minikube.sigs.k8s.io/docs/drivers/docker/
- name: Configure minikube
working-directory: cli-tests
run: |
minikube delete --all --purge
rm -rf ~/.minikube
minikube config set cpus 2
minikube start
- name: Set up Go release for CLI
uses: percona-platform/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Build CLI binary
run: |
make init
make build
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Run ${{ env.MAKE_TARGET }} integration tests
working-directory: cli-tests
id: cli-tests
run: |
make init
make ${{ env.MAKE_TARGET }}
- name: Collect logs from backend
if: ${{ always() && steps.cli-tests.outcome != 'success' }}
working-directory: cli-tests
run: 'echo "here should be a command to extract and save backend logs"'
- name: Attach the report
if: ${{ always() && steps.cli-tests.outcome != 'skipped' }}
uses: actions/upload-artifact@v3
with:
name: test-delete-cluster-tests-report
path: cli-tests/test-report