From b206fe7399888e38769de6fec9a715136e9b7518 Mon Sep 17 00:00:00 2001 From: Jan-Willem Goossens Date: Sat, 18 Nov 2023 12:36:25 +0100 Subject: [PATCH] github and appveyor CI updates for artifact upload --- .github/workflows/windows-ci.yml | 34 +++++++++++++++++++++----------- README.md | 5 ++--- appveyor.yml | 9 +++------ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index c349a12..c87493a 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -19,6 +19,7 @@ jobs: - 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@v1.1 @@ -49,15 +50,10 @@ jobs: - 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('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 "Sonnet-${{ github.ref_name }}-CI-src.zip" .\* + 7z --% a -tzip -r -x!.git "${{ env.release_name }}-src.zip" .\* nuget restore Sonnet\MSVisualStudio\v17\Sonnet.sln - name: Build @@ -83,8 +79,8 @@ jobs: cd Sonnet\MSVisualStudio\v17\SonnetTest\bin\x64\Release\net6.0\ .\SonnetTest.exe - - name: Create asset package - if: ${{ github.ref_name == 'master' }} + - 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 @@ -107,8 +103,22 @@ jobs: 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" * + 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@v3 + 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@v3 + with: + name: Sonnet + path: ${{ env.release_name }}-bin.zip - name: Update latest release if: ${{ github.ref_name == 'master' }} @@ -126,9 +136,9 @@ jobs: 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. + 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: | - Sonnet-${{ github.ref_name }}-CI-src.zip - Sonnet-${{ github.ref_name }}-CI-bin.zip + ${{ env.release_name }}-src.zip + ${{ env.release_name }}-bin.zip diff --git a/README.md b/README.md index 3de98ff..a839e09 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ Sonnet is a modelling API and wrapper for COIN-OR mixed integer linear programmi Sonnet uses a wrapper to make the COIN-OR C++ classes available in .NET. COIN-OR projects included in the wrapper: -[BuildTools](https://github.com/coin-or-tools/BuildTools), [Cbc](https://github.com/coin-or/Cbc), [Cgl](https://github.com/coin-or/Cgl), [Clp](https://github.com/coin-or/Clp), +[CoinUtils](https://github.com/coin-or/CoinUtils) [Osi](https://github.com/coin-or/Osi). The Sonnet API allows for code like this: @@ -64,7 +64,6 @@ See https://github.com/coin-or/Cbc#source how to get the relevant sources. The Sonnet solution expects the COIN-OR source code to be in the same root folder. The folder structure should look like this: -├─ [BuildTools](https://github.com/coin-or-tools/BuildTools) ├─ [Cbc](https://github.com/coin-or/Cbc) ├─ [Cgl](https://github.com/coin-or/Cgl) ├─ [Clp](https://github.com/coin-or/Clp) @@ -102,7 +101,7 @@ Several pthread for Windows libraries are available. Sonnet was succesfully test To build Sonnet with pthread, all necessary project settings are available in the respective ReleaseParallel configurations of libCbc, libCbcSolver and SonnetWrapper: - Solution: Use the ReleaseParallel configuration. - Define: CBC_THREAD is defined by the projects -- Include: "pthreads" include folder is expected at one level above the Sonnet root folder, so _not_ besides BuildTools, etc., but one level above. +- Include: "pthreads" include folder is expected at one level above the Sonnet root folder, so _not_ besides Cbc, etc., but one level above. - Linker: SonnetWrapper links to pthread_static_lib.lib that is expected in the lib\Win32 or lib\x64 folder at the root of Sonnet folder. You have to build this first, below. Start by cloning the pthread repo, and opening the solution in VS2019. You can decide to build the pthread dll or the pthread static lib. diff --git a/appveyor.yml b/appveyor.yml index af6456b..3a65581 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -111,11 +111,6 @@ before_build: - echo RELEASE_NAME "%RELEASE_NAME%" - echo RELEASE_TYPE "%RELEASE_TYPE%" - echo Creating %RELEASE_NAME%-src.zip artefact from projects folder - - echo Built on %date% %time% > BUILD-INFO.txt - - echo Version 1.3.1.%APPVEYOR_BUILD_NUMBER% >> BUILD-INFO.txt - - echo Repo %APPVEYOR_REPO_NAME% >> BUILD-INFO.txt - - echo Ref name %APPVEYOR_REPO_BRANCH% >> BUILD-INFO.txt - - echo Commit %APPVEYOR_REPO_COMMIT% >> BUILD-INFO.txt - call build-third-party-license.bat - 7z a -tzip -r -x!.git "c:\projects\sonnet\%RELEASE_NAME%-src.zip" c:\projects\* - nuget restore MSVisualStudio\v17\Sonnet.sln @@ -170,7 +165,9 @@ after_test: - copy README.md package\. - copy THIRD-PARTY-LICENSE.txt package\. - copy examples\Example5.cs package\. - - 7z a -tzip -r "c:\projects\sonnet\%RELEASE_NAME%-bin.zip" c:\projects\sonnet\package\* + - cd package + - 7z a -tzip -r "c:\projects\sonnet\%RELEASE_NAME%-bin.zip" * + - cd .. - if not "%sonar_token%"=="" ( SonarScanner.MSBuild.exe end /d:"sonar.login=%sonar_token%" ) artifacts: