Update appveyor.yml for net6 global.json #147
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 | |
echo "release_name=Sonnet-$("${{ github.ref_name }}".Replace("/","-"))-CI" >> $env:GITHUB_ENV | |
- name: Setup msbuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6 | |
- name: Checkout Sonnet source | |
uses: actions/checkout@v4 | |
with: | |
path: Sonnet | |
- name: Checkout dependenies sources | |
shell: cmd | |
run: | | |
for /f "eol=# tokens=1,2,3" %%i in (sonnet\.coin-or\Dependencies) do ( | |
echo Cloning into folder %%i from github project %%j at branch %%k | |
git clone --depth=1 --branch=%%k %%j %%i | |
) | |
if exist Data\miplib3 ( | |
7z x -bso0 -oData\miplib3 Data\miplib3\*.gz | |
erase /f Data\miplib3\*.gz | |
) | |
- name: Prepare for build | |
shell: pwsh | |
run: | | |
Sonnet\build-third-party-license.bat | |
(Get-Content Sonnet\src\Sonnet\AssemblyInfo.cs).Replace('2.0.0.9999','2.0.0.${{ github.run_number }}') | Set-Content Sonnet\src\Sonnet\AssemblyInfo.cs | |
(Get-Content Sonnet\src\SonnetWrapper\AssemblyInfo.h).Replace('2.0.0.9999','2.0.0.${{ github.run_number }}').Replace('2,0,0,9999','2,0,0,${{ github.run_number }}') | Set-Content Sonnet\src\SonnetWrapper\AssemblyInfo.h | |
7z --% a -tzip -r -x!.git "${{ env.release_name }}-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\ | |
.\SonnetTest.exe | |
- name: Run tests for net60 | |
shell: cmd | |
run: | | |
cd Sonnet\MSVisualStudio\v17\SonnetTest\bin\x64\Release\net6.0\ | |
.\SonnetTest.exe | |
- name: Create artifact package for master or stable | |
if: ${{ ( github.ref_name == 'master' ) || startsWith(github.ref_name, 'stable/' ) }} | |
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 "..\${{ env.release_name }}-bin.zip" .\* | |
cd .. | |
- name: Upload src artifact | |
if: ${{ ( github.ref_name == 'master' ) || startsWith(github.ref_name, 'stable/' ) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Sonnet Sources | |
path: ${{ env.release_name }}-src.zip | |
- name: Upload bin artifact | |
if: ${{ ( github.ref_name == 'master' ) || startsWith(github.ref_name, 'stable/' ) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Sonnet | |
path: ${{ env.release_name }}-bin.zip | |
- name: Update latest release | |
if: ${{ github.ref_name == 'master' }} | |
uses: IsaacShelton/[email protected] | |
with: | |
release: Sonnet-latest | |
tag: latest | |
draft: false | |
prerelease: true | |
replace: true | |
updateTag: true | |
body: | | |
Built on: ${{ env.builddate }} (v2.0.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 S${{ env.release_name }}-src.zip to get all sources of Sonnet, Cbc and dependencies. | |
Do not use the 'Source code' assets because it only contains the sources of Sonnet. | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
${{ env.release_name }}-src.zip | |
${{ env.release_name }}-bin.zip |