-
-
Notifications
You must be signed in to change notification settings - Fork 183
185 lines (154 loc) · 5.74 KB
/
Copy pathintegration-tests.yml
File metadata and controls
185 lines (154 loc) · 5.74 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Integration Tests
on:
push:
branches: ["work", "develop", "ci/*", "v*"]
paths:
- "src/**"
- ".github/workflows/integration-tests.yml"
pull_request:
branches: ["develop", "work"]
paths:
- "src/**"
- ".github/workflows/integration-tests.yml"
workflow_dispatch:
jobs:
test:
name: Run Tests (Local Mode)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
global-json-file: src/global.json
- uses: actions/setup-node@v6
with:
node-version: latest
- name: Install pnpm
run: npm install -g pnpm
- name: Restore dependencies
working-directory: src
run: dotnet restore
- name: Build
working-directory: src
run: dotnet build --no-restore -c Release
- name: Run Unit Tests
working-directory: src
run: dotnet test GZCTF.Test/GZCTF.Test.csproj --no-build -c Release --logger "trx;LogFileName=unit-test-results.trx" --logger "console;verbosity=detailed" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/
- name: Run Integration Tests (Local Mode)
working-directory: src
env:
GZCTF_INTEGRATION_TEST_MODE: local
run: dotnet test GZCTF.Integration.Test/GZCTF.Integration.Test.csproj --no-build -c Release --logger "trx;LogFileName=integration-test-results.trx" --logger "console;verbosity=detailed" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage/
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v7
with:
name: unit-test-results
path: src/GZCTF.Test/**/unit-test-results.trx
retention-days: 7
- name: Upload Integration Test Results
if: always()
uses: actions/upload-artifact@v7
with:
name: integration-test-results-local
path: src/GZCTF.Integration.Test/**/integration-test-results.trx
retention-days: 7
- name: Unit Test Report
uses: dorny/test-reporter@v2
if: always()
with:
name: Unit Test Results
path: src/GZCTF.Test/**/unit-test-results.trx
reporter: dotnet-trx
- name: Integration Test Report
uses: dorny/test-reporter@v2
if: always()
with:
name: Integration Test Results (Local Mode)
path: src/GZCTF.Integration.Test/**/integration-test-results.trx
reporter: dotnet-trx
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-local
path: |
src/GZCTF.Test/coverage/coverage.cobertura.xml
src/GZCTF.Integration.Test/coverage/coverage.cobertura.xml
retention-days: 1
test-cloud-mode:
name: Run Tests (Cloud Mode)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
global-json-file: src/global.json
- uses: actions/setup-node@v6
with:
node-version: latest
- name: Install pnpm
run: npm install -g pnpm
- name: Restore dependencies
working-directory: src
run: dotnet restore
- name: Build
working-directory: src
run: dotnet build --no-restore -c Release
- name: Run Integration Tests (Cloud Mode)
working-directory: src
env:
GZCTF_INTEGRATION_TEST_MODE: cloud
run: dotnet test GZCTF.Integration.Test/GZCTF.Integration.Test.csproj --no-build -c Release --logger "trx;LogFileName=integration-test-results-cloud.trx" --logger "console;verbosity=detailed" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./coverage-cloud/
- name: Upload Integration Test Results (Cloud Mode)
if: always()
uses: actions/upload-artifact@v7
with:
name: integration-test-results-cloud
path: src/GZCTF.Integration.Test/**/integration-test-results-cloud.trx
retention-days: 7
- name: Integration Test Report (Cloud Mode)
uses: dorny/test-reporter@v2
if: always()
with:
name: Integration Test Results (Cloud Mode - K3s + MinIO)
path: src/GZCTF.Integration.Test/**/integration-test-results-cloud.trx
reporter: dotnet-trx
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-cloud
path: src/GZCTF.Integration.Test/coverage-cloud/coverage.cobertura.xml
retention-days: 1
upload-coverage:
name: Upload Coverage
runs-on: ubuntu-latest
needs: [test, test-cloud-mode]
if: always()
steps:
- uses: actions/checkout@v6
- name: Download coverage artifacts (local)
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: coverage-local
path: coverage-local
- name: Download coverage artifacts (cloud)
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: coverage-cloud
path: coverage-cloud
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: |
coverage-local/src/GZCTF.Test/coverage/coverage.cobertura.xml
coverage-local/src/GZCTF.Integration.Test/coverage/coverage.cobertura.xml
coverage-cloud/src/GZCTF.Integration.Test/coverage-cloud/coverage.cobertura.xml
fail_ci_if_error: false
verbose: true