This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
130 lines (106 loc) · 3.44 KB
/
run_tests.yaml
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
119
120
121
122
123
124
125
126
127
128
129
name: Run tests
on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'
push:
branches:
- master
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash
# Concurrency ensures that only a single workflow using the same concurrency group will run at a time.
# When a workflow is queued in the same repository and concurrency group, any workflow in progress will be cancelled.
# This concurrency group is keyed to the 'ref' property in the 'github' context, to map back to the branch/tag that
# triggered this workflow run.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
matrix-generator:
uses: ./.github/workflows/setup_k8s_matrix.yaml
test:
runs-on: ubuntu-20.04
needs: matrix-generator
strategy:
fail-fast: false
matrix:
k8s-version: ${{ fromJSON(needs.matrix-generator.outputs.k8s-matrix) }}
tyk-version: ['v3.2','v4.0','v5.0','v5.2']
mode: ['ce','pro']
env:
CLUSTER_NAME: 'chart-testing'
TYK_MODE: ${{ matrix.mode }}
steps:
- name: Checkout tyk-operator
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Kind cluster
uses: helm/[email protected]
with:
wait: 2m
node_image: "kindest/node:${{ matrix.k8s-version }}"
config: hack/kind.yaml
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.21.x
- name: Cache Go Modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Bootstrap Tyk CE environment
if: ${{ env.TYK_MODE == 'ce' }}
run: |
TYK_VERSION=${{ matrix.tyk-version}} make boot-ce IMG=tykio/tyk-operator:test
- name: Bootstrap Tyk PRO environment
if: ${{ env.TYK_MODE == 'pro' }}
env:
TYK_DB_LICENSEKEY: ${{ secrets.DASH_LICENSE }}
run: |
TYK_VERSION=${{ matrix.tyk-version}} make boot-pro IMG=tykio/tyk-operator:test
- name: Run tests
run: |
make test-all
- name: Upload Coverage files
uses: actions/upload-artifact@v3
with:
name: test coverage files
path: '*_coverage.out'
sbom:
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@main
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
secrets:
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }}
DEPDASH_URL: ${{ secrets.DEPDASH_URL }}
DEPDASH_KEY: ${{ secrets.DEPDASH_KEY }}
ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }}
DOCKER_IMAGE: "tykio/tyk-operator:latest"
sonarcloud:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
needs: test
steps:
- name: Checkout tyk-operator
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Coverage files
uses: actions/download-artifact@v2
with:
name: test coverage files
- name: Display structure of downloaded files
run: ls -R
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.ORG_GH_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}