Fix issue 2900 #5248
Workflow file for this run
This file contains hidden or 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: build-nuget-package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Package version (e.g. 1.15.1-preview.1)' | |
| required: true | |
| default: '1.15.1-preview.1' | |
| push_package: | |
| description: 'Push package to NuGet.org' | |
| type: boolean | |
| default: false | |
| pull_request: | |
| release: | |
| types: | |
| - published | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Build macos intel | |
| build_macos_intel: | |
| runs-on: macos-15-intel | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build HiGHS | |
| run: | | |
| cmake -E make_directory ${{github.workspace}}/build | |
| - name: Configure CMake | |
| working-directory: ${{github.workspace}}/build | |
| run: | | |
| cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON \ | |
| -DCMAKE_C_COMPILER=/usr/bin/clang \ | |
| -DCMAKE_CXX_COMPILER=/usr/bin/clang++ | |
| - name: Build | |
| working-directory: ${{github.workspace}}/build | |
| run: cmake --build . --config Release --parallel --verbose | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: macos-x64 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| # Build macos arm64 | |
| build_macos_arm: | |
| runs-on: macos-14 # macos-14 is arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build HiGHS | |
| run: | | |
| cmake -E make_directory ${{github.workspace}}/build | |
| - name: Configure CMake | |
| working-directory: ${{github.workspace}}/build | |
| run: | | |
| cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON \ | |
| -DCMAKE_C_COMPILER=/usr/bin/clang \ | |
| -DCMAKE_CXX_COMPILER=/usr/bin/clang++ | |
| - name: Build | |
| working-directory: ${{github.workspace}}/build | |
| run: cmake --build . --config Release --parallel | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: macos-arm64 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| # Build windows 32 and linux | |
| build_windows_32: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build HiGHS | |
| run: | | |
| cmake -E make_directory ${{github.workspace}}/build32 | |
| - name: Configure CMake win32 | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build32 | |
| run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded | |
| - name: Build win32 | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build32 | |
| run: cmake --build . --config Release --parallel | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: win-x86 | |
| path: ${{github.workspace}}/build32/dotnet/Highs.Native/runtimes/win-x86/ | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| container: stabletec/build-core:debian-11 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build HiGHS | |
| run: | | |
| cmake -E make_directory /__w/HiGHS/HiGHS/build | |
| - name: Configure CMake | |
| working-directory: /__w/HiGHS/HiGHS/build | |
| run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON | |
| - name: Build | |
| working-directory: /__w/HiGHS/HiGHS/build | |
| run: cmake --build . --config Release --parallel | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: linux-x64 | |
| path: /__w/HiGHS/HiGHS/build/dotnet/Highs.Native/runtimes | |
| build_linux_arm64: | |
| runs-on: ubuntu-24.04-arm | |
| container: stabletec/build-core:debian-11 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build HiGHS | |
| run: | | |
| cmake -E make_directory /__w/HiGHS/HiGHS/build_linux_arm64 | |
| - name: Configure CMake linux-arm-64 | |
| working-directory: /__w/HiGHS/HiGHS/build_linux_arm64 | |
| shell: bash | |
| run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/nuget/arm-toolchain.cmake | |
| - name: Build linux-arm-64 | |
| working-directory: /__w/HiGHS/HiGHS/build_linux_arm64 | |
| shell: bash | |
| run: cmake --build . --config Release --parallel | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: linux-arm64 | |
| path: /__w/HiGHS/HiGHS/build_linux_arm64/dotnet/Highs.Native/runtimes | |
| build_windows: | |
| runs-on: windows-latest | |
| needs: [build_macos_intel, build_macos_arm, build_windows_32, build_linux, build_linux_arm64] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build HiGHS Windows native | |
| run: | | |
| cmake -E make_directory ${{github.workspace}}/build | |
| - name: Configure CMake | |
| working-directory: ${{github.workspace}}/build | |
| shell: bash | |
| run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded | |
| - name: Build | |
| working-directory: ${{github.workspace}}/build | |
| shell: bash | |
| run: cmake --build . --config Release --parallel | |
| - name: Display structure of downloaded files | |
| run: | | |
| pwd | |
| ls -R ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| - name: Download runtimes macos-x64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: macos-x64 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| - name: Download runtimes macos-arm64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: macos-arm64 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| - name: Download runtimes win-x86 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: win-x86 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes/win-x86 | |
| - name: Download runtimes | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: linux-x64 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| - name: Download runtimes | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: linux-arm64 | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| - name: Display structure of downloaded files | |
| run: ls -R ${{github.workspace}}/build/dotnet/Highs.Native/runtimes | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '6.0.x' | |
| - name: Dotnet pack | |
| working-directory: ${{github.workspace}}/build/dotnet/Highs.Native | |
| run: dotnet pack -c Release /p:Version=${{ inputs.version || '1.15.1' }} | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: nuget | |
| path: ${{github.workspace}}/build/dotnet/Highs.Native/bin/Release/*.nupkg | |
| dotnet_push: | |
| runs-on: windows-latest | |
| needs: [build_windows] | |
| environment: | |
| name: nuget | |
| permissions: | |
| id-token: write # enable GitHub OIDC token issuance for this job | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.push_package) | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| - name: Download nuget | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: nuget | |
| # Get a short-lived NuGet API key | |
| - name: NuGet login (OIDC → temp API key) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Dotnet push | |
| run: dotnet nuget push "*.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |