-
Notifications
You must be signed in to change notification settings - Fork 10
157 lines (143 loc) · 6.87 KB
/
windows-ci.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
---
name: Windows build and test
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
release:
types:
- created
jobs:
build_and_test:
name: Build and Test
runs-on: windows-2022
steps:
- name: Setup environment
run: |
echo "builddate=$(Get-Date -format r)" >> $env:GITHUB_ENV
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1.1
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6
- name: Checkout Sonnet source
uses: actions/checkout@v3
with:
path: Sonnet
- name: Checkout dependenies sources
shell: cmd
run: |
git clone --depth 1 https://github.com/coin-or-tools/BuildTools.git -b master
git clone --depth 1 https://github.com/coin-or/Cbc.git -b master
git clone --depth 1 https://github.com/coin-or/Clp.git -b master
git clone --depth 1 https://github.com/coin-or/Cgl.git -b master
git clone --depth 1 https://github.com/coin-or/CoinUtils.git -b master
git clone --depth 1 https://github.com/coin-or/Osi.git -b master
git clone --depth 1 https://github.com/coin-or-tools/Data-Sample -b master
git clone --depth 1 https://github.com/coin-or-tools/Data-miplib3 -b master
7z x -bso0 -oData-miplib3 Data-miplib3\*.gz
erase /f Data-miplib3\*.gz
git clone --depth 1 https://github.com/GerHobbelt/pthread-win32.git -b master ..\pthreads
- name: Prepare for build
shell: pwsh
run: |
echo Built on: ${{ env.builddate }} > Sonnet\BUILD-INFO.txt
echo Version: 1.4.0.${{ github.run_number }} >> Sonnet\BUILD-INFO.txt
echo Ref: ${{ github.ref }} >> Sonnet\BUILD-INFO.txt
echo Ref name: ${{ github.ref_name }} >> Sonnet\BUILD-INFO.txt
echo Commit: ${{ github.sha }} >> Sonnet\BUILD-INFO.txt
Sonnet\build-third-party-license.bat
(Get-Content Sonnet\src\Sonnet\AssemblyInfo.cs).Replace('1.4.0.99','1.4.0.${{ github.run_number }}') | Set-Content Sonnet\src\Sonnet\AssemblyInfo.cs
(Get-Content Sonnet\src\SonnetWrapper\AssemblyInfo.h).Replace('1.4.0.99','1.4.0.${{ github.run_number }}').Replace('1,4,0,99','1,4,0,${{ github.run_number }}') | Set-Content Sonnet\src\SonnetWrapper\AssemblyInfo.h
7z --% a -tzip -r -x!.git "Sonnet-${{ github.ref_name }}-CI-src.zip" .\*
nuget restore Sonnet\MSVisualStudio\v17\Sonnet.sln
- name: Build
shell: cmd
run: |
echo Build pthread-win32 as static library
msbuild ..\pthreads\windows\VS2022\pthread_lib.2022.vcxproj -p:Configuration=Release -p:Platform=x64 -m
mkdir sonnet\lib\x64
copy ..\pthreads\windows\VS2022\bin\Release-Unicode-64bit-x64\pthread_static_lib.lib sonnet\lib\x64\.
echo.
echo Build Sonnet
msbuild Sonnet\MSVisualStudio\v17\Sonnet.sln -p:Configuration=ReleaseParallel -p:Platform=x64 -m
- name: Run tests for net4 framework
shell: cmd
run: |
cd Sonnet\MSVisualStudio\v17\SonnetTestNET4\bin\x64\Release\
dotnet test SonnetTest.exe --logger "trx;LogFileName=test-net4-results.trx;verbosity=detailed"
- name: Test Report for net4 framework
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Report for net4 framework
working-directory: Sonnet
path: "**/test-net4-results.trx"
reporter: dotnet-trx
fail-on-error: true
- name: Run tests for net60
if: always()
shell: cmd
run: |
cd Sonnet\MSVisualStudio\v17\SonnetTest\bin\x64\Release\net6.0\
dotnet test SonnetTest.exe --logger "trx;LogFileName=test-net60-results.trx"
- name: Test Report for net60
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Report for net60
working-directory: Sonnet
path: "**/test-net60-results.trx"
reporter: dotnet-trx
fail-on-error: true
- name: Create asset package
if: ${{ github.ref_name == 'master' }}
shell: cmd
run: |
mkdir package\x64\net6.0
copy Sonnet\MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\Sonnet.dll package\x64\net6.0\.
copy Sonnet\MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\Sonnet.xml package\x64\net6.0\.
copy Sonnet\MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\SonnetWrapper.dll package\x64\net6.0\.
copy Sonnet\MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\SonnetWrapper.xml package\x64\net6.0\.
copy Sonnet\MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\Ijwhost.dll package\x64\net6.0\.
mkdir package\x64\net48
copy Sonnet\MSVisualStudio\v17\SonnetNET4\bin\x64\Release\Sonnet.dll package\x64\net48\.
copy Sonnet\MSVisualStudio\v17\SonnetNET4\bin\x64\Release\Sonnet.xml package\x64\net48\.
copy Sonnet\MSVisualStudio\v17\SonnetNET4\bin\x64\Release\SonnetWrapper.dll package\x64\net48\.
copy Sonnet\MSVisualStudio\v17\SonnetNET4\bin\x64\Release\SonnetWrapper.xml package\x64\net48\.
copy Sonnet\AUTHORS.txt package\.
copy Sonnet\BUILD-INFO.txt package\.
copy Sonnet\CHANGELOG.txt package\.
copy Sonnet\LICENSE.txt package\.
copy Sonnet\NOTICE.txt package\.
copy Sonnet\README.md package\.
copy Sonnet\THIRD-PARTY-LICENSE.txt package\.
copy Sonnet\examples\Example5.cs package\.
cd package
7z a -tzip -r "..\Sonnet-${{ github.ref_name }}-CI-bin.zip" *
cd ..
- name: Update latest release
if: ${{ github.ref_name == 'master' }}
uses: IsaacShelton/update-existing-release@v1.3.2
with:
release: Sonnet-latest
tag: latest
draft: false
prerelease: true
replace: true
updateTag: true
body: |
Built on: ${{ env.builddate }} (v1.4.0.${{ github.run_number }} )
The Sonnet latest builds are pre-release builds based on the latest code in the master branch. As such, these builds may or may not be stable.
The Sonnet latest builds use the latest code in the [master branch of Cbc](https://github.com/coin-or/cbc) and its dependencies.
The Sonnet latest builds are created automatically at every successful build following a commit to the master branch.
Use the Sonnet-${{ github.ref_name }}-CI-src.zip to get all sources of Sonnet, Cbc and dependencies.
Do not use the 'Source code' assets.
token: ${{ secrets.GITHUB_TOKEN }}
files: |
Sonnet-${{ github.ref_name }}-CI-src.zip
Sonnet-${{ github.ref_name }}-CI-bin.zip