-
Notifications
You must be signed in to change notification settings - Fork 1
189 lines (160 loc) · 8.63 KB
/
BuildAndTest.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
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
186
187
188
189
name: Build and Test
# PREREQUISITES FOR PUSH-BACK OF TEST RESULTS
# Please note: test project usually required nuget package JUnitTestLogger
# to be able to provide JUnit compatible test results XML file (required
# for pushing back details on succeeded/failed tests)
#
# NuGet install command:
# - Install-Package JUnitTestLogger
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Path to the solution file relative to the root of the project
SOLUTION_FILE_PATH: .
# Configuration type to build
BUILD_CONFIGURATION: CI_CD
#BUILD_OUTPUT: Ocs/bin/CI_CD
#BUILD_OUTPUT_TEST: Ocs.Tests.Trivial/bin/CI_CD
jobs:
test:
#needs: build
# Prevent concurrent job runners changing the very same data on the remote DMS test server
concurrency: ocs_test_server
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
#arch: [x86, x86_64, arm]
#os: [windows-latest, ubuntu-latest, macos-latest]
os: [ubuntu-latest]
#include:
#- os: macos-latest
# runNetExe: mono
# arch: x86_64
#- os: ubuntu-latest
# arch: x86
#- os: ubuntu-latest
# arch: x86_64
#- os: ubuntu-latest
# arch: arm
#- os: windows-latest
# arch: x86
#- os: windows-latest
# arch: x86_64
# the build-and-test job might be skipped, we don't need to run this job then
#if: success() || failure()
env:
RESULTS_PATH: TestResults.xml
TEST_NEXTCLOUD.ADMINUSER_SERVERURL: ${{ secrets.TEST_NEXTCLOUD_ADMINUSER_SERVERURL}}
TEST_NEXTCLOUD.ADMINUSER_USERNAME: ${{ secrets.TEST_NEXTCLOUD_ADMINUSER_USERNAME }}
TEST_NEXTCLOUD.ADMINUSER_PASSWORD: ${{ secrets.TEST_NEXTCLOUD_ADMINUSER_PASSWORD }}
TEST_NEXTCLOUD.STANDARDUSER_SERVERURL: ${{ secrets.TEST_NEXTCLOUD_STANDARDUSER_SERVERURL}}
TEST_NEXTCLOUD.STANDARDUSER_USERNAME: ${{ secrets.TEST_NEXTCLOUD_STANDARDUSER_USERNAME }}
TEST_NEXTCLOUD.STANDARDUSER_PASSWORD: ${{ secrets.TEST_NEXTCLOUD_STANDARDUSER_PASSWORD }}
TEST_OWNCLOUD.ADMINUSER_SERVERURL: ${{ secrets.TEST_OWNCLOUD_ADMINUSER_SERVERURL }}
TEST_OWNCLOUD.ADMINUSER_USERNAME: ${{ secrets.TEST_OWNCLOUD_ADMINUSER_USERNAME }}
TEST_OWNCLOUD.ADMINUSER_PASSWORD: ${{ secrets.TEST_OWNCLOUD_ADMINUSER_PASSWORD }}
TEST_OWNCLOUD.STANDARDUSER_SERVERURL: ${{ secrets.TEST_OWNCLOUD_STANDARDUSER_SERVERURL }}
TEST_OWNCLOUD.STANDARDUSER_USERNAME: ${{ secrets.TEST_OWNCLOUD_STANDARDUSER_USERNAME }}
TEST_OWNCLOUD.STANDARDUSER_PASSWORD: ${{ secrets.TEST_OWNCLOUD_STANDARDUSER_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Dir Listing (Win)
if: startsWith(matrix.os, 'windows')
run: dir
- name: Dir Listing (Linux/Mac)
if: (!startsWith(matrix.os, 'windows'))
run: ls -la
- name: unixODBC Driver Listing (Linux/Mac)
if: (!startsWith(matrix.os, 'windows'))
continue-on-error: true
run: odbcinst -q -d
- name: Install dependencies
run: dotnet restore /p:configuration=${{env.BUILD_CONFIGURATION}}
- name: Build
run: dotnet build --configuration=${{env.BUILD_CONFIGURATION}} --no-restore
- name: Run Unit Tests (CompuMaster.Ocs.TrivialTests)
run: dotnet test --framework net6.0 --results-directory test-results-trivial --logger junit --configuration=${{env.BUILD_CONFIGURATION}} --no-restore --filter CompuMaster.Ocs.Test
- name: Run Unit Tests (CompuMaster.Ocs.OwnCloudSharpTests)
run: dotnet test --framework net6.0 --results-directory test-results-ocs --logger junit --configuration=${{env.BUILD_CONFIGURATION}} --no-restore --filter CompuMaster.Ocs.OwnCloudSharpTests
- name: Dir Listing (Win) test-results-trivial (CompuMaster.Ocs.TrivialTests)
if: startsWith(matrix.os, 'windows')
run: dir test-results-trivial
- name: Dir Listing (Linux/Mac) test-results-trivial (CompuMaster.Ocs.TrivialTests)
if: (!startsWith(matrix.os, 'windows'))
run: ls -la test-results-trivial
- name: Dir Listing (Win) test-results-ocs (CompuMaster.Ocs.OwnCloudSharpTests)
if: startsWith(matrix.os, 'windows')
run: dir test-results-ocs
- name: Dir Listing (Linux/Mac) test-results-ocs (CompuMaster.Ocs.OwnCloudSharpTests)
if: (!startsWith(matrix.os, 'windows'))
run: ls -la test-results-ocs
#Following lines maybe required again after test&dev?!
# # the action is useless on pull_request events
# # (it can not create check runs or pull request comments)
# if: always() #&& startsWith(matrix.os, 'ubuntu') #&& github.event_name != 'pull_request'
- name: Unit Test Results (Linux) (CompuMaster.Ocs.TrivialTests)
uses: EnricoMi/publish-unit-test-result-action@v1
if: always() && startsWith(matrix.os, 'ubuntu')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results-trivial/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}}) (CompuMaster.Ocs.TrivialTests)
check_name: Unit Test Results (${{matrix.os}}) (CompuMaster.Ocs.TrivialTests)
report_individual_runs: true
- name: Unit Test Results (Win/Mac) (CompuMaster.Ocs.TrivialTests)
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always() && (!(startsWith(matrix.os, 'ubuntu')))
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results-trivial/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}}) (CompuMaster.Ocs.TrivialTests)
check_name: Unit Test Results (${{matrix.os}}) (CompuMaster.Ocs.TrivialTests)
report_individual_runs: true
- name: Publish Unit Test Results (CompuMaster.Ocs.TrivialTests)
uses: actions/upload-artifact@v4
if: always()
with:
name: NUnit Test Results ${{ matrix.os }} (CompuMaster.Ocs.TrivialTests)
path: test-results-trivial/TestResults.xml
- name: Unit Test Results (Linux) (CompuMaster.Ocs.OwnCloudSharpTests)
uses: EnricoMi/publish-unit-test-result-action@v1
if: always() && startsWith(matrix.os, 'ubuntu')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results-ocs/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}}) (CompuMaster.Ocs.OwnCloudSharpTests)
check_name: Unit Test Results (${{matrix.os}}) (CompuMaster.Ocs.OwnCloudSharpTests)
report_individual_runs: true
- name: Unit Test Results (Win/Mac) (CompuMaster.Ocs.OwnCloudSharpTests)
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always() && (!(startsWith(matrix.os, 'ubuntu')))
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results-ocs/TestResults.xml"
check_run_annotations: all tests
comment_title: Unit Test Statistics (${{matrix.os}}) (CompuMaster.Ocs.OwnCloudSharpTests)
check_name: Unit Test Results (${{matrix.os}}) (CompuMaster.Ocs.OwnCloudSharpTests)
report_individual_runs: true
- name: Publish Unit Test Results (CompuMaster.Ocs.OwnCloudSharpTests)
uses: actions/upload-artifact@v4
if: always()
with:
name: NUnit Test Results ${{ matrix.os }} (CompuMaster.Ocs.OwnCloudSharpTests)
path: test-results-ocs/TestResults.xml