-
Notifications
You must be signed in to change notification settings - Fork 83
93 lines (81 loc) · 2.5 KB
/
ci-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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: CI tests
on:
pull_request:
push:
branches:
- master
env:
TYK_PMP_ANALYTICSSTORAGETYPE: redis
TYK_PMP_ANALYTICSSTORAGECONFIG_TYPE: redis
TYK_PMP_ANALYTICSSTORAGECONFIG_HOST: localhost
TYK_PMP_ANALYTICSSTORAGECONFIG_PORT: 6379
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Tyk Pump
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Fetch base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }}
- name: golangci-lint
if: ${{ github.event_name == 'pull_request' }}
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --out-format=checkstyle:golanglint.xml --timeout=300s --max-issues-per-linter=0 --max-same-issues=0 --new-from-rev=origin/${{ github.base_ref }}
- uses: actions/upload-artifact@v2
with:
name: golangcilint
retention-days: 1
path: |
golanglint.xml
test:
name: Go ${{ matrix.go }} tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
redis-version: [5]
mongodb-version: [4.2]
go: [1.21]
steps:
- name: Checkout Tyk Pump
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Install Dependencies and basic hygiene test
id: hygiene
run: |
go install golang.org/x/tools/cmd/goimports@latest
- name: Fetch base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }}
- name: Start Redis
uses: supercharge/redis-github-action@1.2.0
with:
redis-version: ${{ matrix.redis-version }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.2.0
with:
mongodb-version: "${{ matrix.mongodb-version }}"
- name: Cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Pump Tests
id: ci-tests
run: |
./bin/ci-test.sh 2>&1 | tee test.log
result_code=${PIPESTATUS[0]}
echo "log=$(sed -ze 's/%/%25/g;s/\n/%0A/g' test.log)" >> $GITHUB_OUTPUT
exit $result_code