-
Notifications
You must be signed in to change notification settings - Fork 19
162 lines (134 loc) · 4.05 KB
/
tests.yml
File metadata and controls
162 lines (134 loc) · 4.05 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Tests
on:
push:
branches: [main]
paths:
- "client/scripts/ci"
- "client/scripts/minio"
- ".github/workflows/tests.yml"
- "**/*.go"
- go.mod
schedule:
- cron: "0 8 * * *"
pull_request:
repository_dispatch:
types: [tests]
workflow_dispatch:
jobs:
unit_server:
name: Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: server/go.mod
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare environment
run: |
sudo apt-get update
sudo apt-get install -y gpg
- name: Set up git config
run: task ci:setup:git-config
- name: Install 3p-git-signatures
run: task ci:install:3p-git-signatures
- name: Install ginkgo
run: task deps:install:ginkgo
- name: Test
run: |
task server:test:unit
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: unit_coverage
path: tests_coverage
e2e_tests:
name: End-to-end tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: e2e/go.mod
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up prebuilt trdl test binary
run: |
task client:build-with-coverage
echo TRDL_TEST_BINARY_PATH=$GITHUB_WORKSPACE/bin/coverage/trdl >> $GITHUB_ENV
echo TRDL_TEST_COVERAGE_DIR=$GITHUB_WORKSPACE/tests_coverage/e2e >> $GITHUB_ENV
- name: Set up git config
run: task ci:setup:git-config
- name: Prepare environment
run: |
sudo apt-get update
sudo apt-get install -y gpg
- name: Install 3p-git-signatures
run: task ci:install:3p-git-signatures
- name: Install ginkgo
run: task -p deps:install:ginkgo
- name: Test
run: task e2e:test:e2e
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: e2e_coverage
path: tests_coverage
upload_coverage:
name: Upload coverage
needs:
- unit_server
- e2e_tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: e2e/go.mod
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
path: tests_coverage
- name: Prepare environment
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
go install github.com/wadey/gocovmerge@latest
- name: Prepare coverage file
run: |
coverage_files=$(find tests_coverage -name '*.out')
gocovmerge ${coverage_files[@]} > coverage.out
- name: Format and upload
run: |
export GIT_BRANCH=${GITHUB_REF:11}
export GIT_COMMIT_SHA=$GITHUB_SHA
./cc-test-reporter format-coverage \
-t=gocov \
-p=github.com/werf/trdl/ \
coverage.out
./cc-test-reporter upload-coverage
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
notification:
name: Notification
if: always()
needs:
- unit_server
- e2e_tests
- upload_coverage
uses: werf/common-ci/.github/workflows/notification.yml@main
secrets:
loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }}
webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}
notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}