Skip to content

Properly build with -MD on windows, update MacOS versions, and add arm64 #87

Properly build with -MD on windows, update MacOS versions, and add arm64

Properly build with -MD on windows, update MacOS versions, and add arm64 #87

Workflow file for this run

---
name: Windows build and test
on:
push:
branches:
- 'master'
- 'stable/*'
pull_request:
branches:
- '**'
release:
types:
- created
jobs:
test:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include: [
{ os: windows-2019, arch: x86_64, msystem: mingw64, debug: true, suffix: "-dbg" },
{ os: windows-2019, arch: x86_64, msystem: mingw64, debug: false, suffix: "" },
{ os: windows-2019, arch: i686, msystem: mingw32, debug: true, suffix: "-dbg" },
{ os: windows-2019, arch: i686, msystem: mingw32, debug: false, suffix: "" },
{ os: windows-2019, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" },
{ os: windows-2022, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" },
{ os: windows-2022, arch: msvs, msystem: mingw64, debug: false, suffix: "" },
]
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
path: ${{ github.event.repository.name }}
- name: Checkout coinbrew
uses: actions/checkout@v3
with:
repository: coin-or/coinbrew
path: coinbrew
- name: Set up msvc
if: ${{ matrix.arch == 'msvc' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Set up for msvs
if: ${{ matrix.arch == 'msvs' }}
uses: microsoft/[email protected]
- name: Set correct host flag and install requirements
if: ${{ matrix.arch != 'msvc' && matrix.arch != 'msvs' }}
run: |
echo "host_flag=--host=${{ matrix.arch }}-w64-mingw32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
C:\msys64\usr\bin\pacman -S mingw-w64-${{ matrix.arch }}-lapack mingw-w64-${{ matrix.arch }}-winpthreads-git mingw-w64-${{ matrix.arch }}-readline mingw-w64-${{ matrix.arch }}-suitesparse mingw-w64-${{ matrix.arch }}-metis --noconfirm
- name: Set up msys with ${{ matrix.msystem }}
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
git
zip
path-type: inherit
msystem: ${{ matrix.msystem }}
- name: Fetch project for msvs
if: ${{ matrix.arch == 'msvs' }}
run: |
ADD_ARGS=()
ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' )
./coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update "${ADD_ARGS[@]}"
echo "##################################################"
echo "### Extracting Netlib and Miplib3 if available"
if [ -d "./Data/Netlib/" ]; then gunzip ./Data/Netlib/*.gz; fi
if [ -d "./Data/Miplib3/" ]; then gunzip ./Data/Miplib3/*.gz; fi
echo "##################################################"
shell: msys2 {0}
- name: Build project for msvs
if: ${{ matrix.arch == 'msvs' }}
shell: cmd
run: |
msbuild ${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}.sln /p:Configuration=Release /p:Platform=x64 /m
- name: Test project for msvs
if: ${{ matrix.arch == 'msvs' }}
shell: cmd
run: |
.\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}Test.cmd .\${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release .\Data\Sample .\Data\Netlib .\Data\Miplib3
- name: Install project for msvs
if: ${{ matrix.arch == 'msvs' }}
shell: cmd
run: |
mkdir dist
copy ${{ github.event.repository.name }}\README.* dist\.
copy ${{ github.event.repository.name }}\AUTHORS.* dist\.
copy ${{ github.event.repository.name }}\LICENSE.* dist\.
mkdir dist\bin
copy ${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release\*.exe dist\bin\.
mkdir dist\include\coin
copy ${{ github.event.repository.name }}\src\*.h dist\include\coin\.
copy ${{ github.event.repository.name }}\src\*.hpp dist\include\coin\.
mkdir dist\lib
copy ${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release\*.lib dist\lib\.
mkdir dist\share\coin\Data
xcopy Data dist\share\coin\Data\. /s /e
- name: Build project using coinbrew
if: ${{ matrix.arch != 'msvs' }}
run: |
ADD_ARGS=()
ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' )
ADD_BUILD_ARGS=()
ADD_BUILD_ARGS+=( --build=x86_64-w64-mingw32 --tests main --enable-relocatable )
ADD_BUILD_ARGS+=( --verbosity 2 )
[[ ${{ matrix.debug }} == "true" ]] && ADD_BUILD_ARGS+=( --enable-debug )
[[ ${{ matrix.arch }} == "msvc" ]] && ADD_BUILD_ARGS+=( --enable-msvc=MD )
./coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update "${ADD_ARGS[@]}"
./coinbrew/coinbrew build ${{ github.event.repository.name }} ${{ env.host_flag }} \
"${ADD_ARGS[@]}" "${ADD_BUILD_ARGS[@]}"
cp ${{ github.event.repository.name }}/README.md dist/
cp ${{ github.event.repository.name }}/LICENSE dist/
shell: msys2 {0}
- name: Upload failed build directory
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os}}-{{ matrix.arch }}-debug=${{ matrix.debug }}-failedbuild
path: build
- name: Generate package name for msvc
run: |
msvc_version=${VisualStudioVersion%.*}
echo "package_suffix=w64-msvc${msvc_version}${{ matrix.suffix }}" >> $GITHUB_ENV
shell: msys2 {0}
if: ${{ matrix.arch == 'msvc' }}
- name: Generate package name
run: |
echo "package_suffix=${{ matrix.arch }}-w64-${{ matrix.msystem }}${{ matrix.suffix }}" >> $GITHUB_ENV
shell: msys2 {0}
if: ${{ matrix.arch != 'msvc' }}
- name: Upload artifact
if: ${{ github.event_name == 'pull_request'}}
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ github.head_ref }}-${{ env.package_suffix }}
path: dist
if-no-files-found: error
- name: Zip up dist contents for release
if: ${{ github.event_name == 'release'}}
run: cd dist && zip -r ../release.zip *
shell: msys2 {0}
- name: Upload package to release
if: ${{ github.event_name == 'release'}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./release.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ env.package_suffix }}.zip
asset_content_type: application/gzip