-
-
Notifications
You must be signed in to change notification settings - Fork 26
159 lines (132 loc) · 5.15 KB
/
ci+cd.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
name: "Build, Test, and Pack"
on:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
build-and-test:
runs-on: ${{ matrix.os }}
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
framework: [net462, net8.0]
exclude:
# dotnet on Linux cannot build net461 without additional, unnecessary, work
- os: ubuntu-latest
framework: net462
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.framework }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
fetch-depth: 0 # fetch full history for GitVersion
- name: Setup .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: |
8.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Install python2 for test execution
run: sudo apt-get install python2
if: matrix.os == 'ubuntu-latest'
- name: Test Chorus
run: dotnet test src/Chorus.Tests/Chorus.Tests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults
if: matrix.framework == 'net462'
- name: Test Chorus Hub
run: dotnet test src/ChorusHubTests/ChorusHubTests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults
if: matrix.framework == 'net462'
- name: Test ChorusMerge
run: dotnet test src/ChorusMerge.Tests/ChorusMerge.Tests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults
- name: Test LibChorus
run: dotnet test src/LibChorusTests/LibChorus.Tests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults
# TODO: Give each test result its own name based on OS and framework and change the test-results.yml workflow accordingly, so that they don't overwrite each other
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (${{ matrix.framework }} on ${{matrix.os}})
path: "**/TestResults/*.xml"
build-installers:
name: "Build Windows installers"
runs-on: windows-latest
needs: build-and-test
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
fetch-depth: 0 # fetch full history for GitVersion
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Checkout Chorus Help # required for Chorus Merge Module
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
repository: sillsdev/chorushelp
path: DistFiles/Help
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@34cfbaee7f672c76950673338facd8a73f637506 # v1.1.3
# ChorusMergeModule.msm is used by FieldWorks, FLExBridge, and possibly WeSay installers (as of 2022.12).
# CMM must be built after tests have been run, since the fixutf8.pyc files are generated only when the .py files are run.
- name: Build Merge Module
run: msbuild src/Installer/ChorusMergeModule.wixproj
- name: Pack Merge Module
run: msbuild src/Installer/ChorusMergeModule.wixproj -t:pack
- name: Upload Merge Module
uses: actions/upload-artifact@v4
with:
name: chorus-merge-module
path: |
output/Release/*.msm
output/*.nupkg
- name: Build Chorus Hub Installer
run: |
msbuild src/Installer/ChorusHub.wixproj /t:Restore
msbuild src/Installer/ChorusHub.wixproj /t:StampLicenseYear
msbuild src/Installer/ChorusHub.wixproj /t:Build
- name: Upload Chorus Hub Installer
uses: actions/upload-artifact@v4
with:
name: chorus-hub-installer
path: |
output/Release/*.msi
- name: Pack
run: dotnet pack --no-restore --no-build -c Release
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: chorus-dotnet-nugetpackage
path: |
output/*.nupkg
output/*.snupkg
publish-nuget:
name: "Publish NuGet package"
runs-on: ubuntu-latest
needs: build-installers
if: github.event_name == 'push'
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish to Nuget
run: dotnet nuget push artifacts/**/*.*nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.SILLSDEV_PUBLISH_NUGET_ORG}} --skip-duplicate