Skip to content

Commit f07907a

Browse files
committed
Update windows ci splitting msvs to separate workflow
1 parent 5aaa3bf commit f07907a

File tree

2 files changed

+115
-43
lines changed

2 files changed

+115
-43
lines changed

.github/workflows/windows-ci.yml

+2-43
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
{ os: windows-2019, arch: x86_64, msystem: mingw64, debug: false, suffix: "" },
2525
{ os: windows-2019, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" },
2626
{ os: windows-2022, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" },
27-
{ os: windows-2022, arch: msvs, msystem: mingw64, debug: false, suffix: "" },
2827
]
2928
steps:
3029
- name: Checkout source
@@ -39,11 +38,8 @@ jobs:
3938
- name: Set up msvc
4039
if: ${{ matrix.arch == 'msvc' }}
4140
uses: ilammy/msvc-dev-cmd@v1
42-
- name: Set up for msvs
43-
if: ${{ matrix.arch == 'msvs' }}
44-
uses: microsoft/setup-msbuild@v2
4541
- name: Set correct host flag and install requirements
46-
if: ${{ matrix.arch != 'msvc' && matrix.arch != 'msvs' }}
42+
if: ${{ matrix.arch != 'msvc' }}
4743
run: |
4844
echo "host_flag=--host=${{ matrix.arch }}-w64-mingw32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
4945
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
@@ -57,44 +53,7 @@ jobs:
5753
zip
5854
path-type: inherit
5955
msystem: ${{ matrix.msystem }}
60-
- name: Fetch project for msvs
61-
if: ${{ matrix.arch == 'msvs' }}
62-
run: |
63-
ADD_ARGS=()
64-
ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' )
65-
./coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update "${ADD_ARGS[@]}"
66-
echo "##################################################"
67-
echo "### Extracting Netlib and Miplib3 if available"
68-
if [ -d "./Data/Netlib/" ]; then gunzip ./Data/Netlib/*.gz; fi
69-
if [ -d "./Data/Miplib3/" ]; then gunzip ./Data/Miplib3/*.gz; fi
70-
echo "##################################################"
71-
shell: msys2 {0}
72-
- name: Build project for msvs
73-
if: ${{ matrix.arch == 'msvs' }}
74-
shell: cmd
75-
run: |
76-
msbuild ${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}.sln /p:Configuration=Release /p:Platform=x64 /m
77-
- name: Test project for msvs
78-
if: ${{ matrix.arch == 'msvs' }}
79-
shell: cmd
80-
run: |
81-
.\${{ 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
82-
- name: Install project for msvs
83-
if: ${{ matrix.arch == 'msvs' }}
84-
shell: cmd
85-
run: |
86-
mkdir dist
87-
copy ${{ github.event.repository.name }}\README.* dist\.
88-
copy ${{ github.event.repository.name }}\AUTHORS.* dist\.
89-
copy ${{ github.event.repository.name }}\LICENSE.* dist\.
90-
mkdir dist\bin
91-
copy ${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release\*.exe dist\bin\.
92-
mkdir dist\share
93-
if exist .\Data\Sample xcopy .\Data\Sample dist\share\coin-or-sample /i
94-
if exist .\Data\Netlib xcopy .\Data\Netlib dist\share\coin-or-netlib /i
95-
if exist .\Data\Miplib3 xcopy .\Data\Miplib3 dist\share\coin-or-miplib3 /i
96-
- name: Build project using coinbrew
97-
if: ${{ matrix.arch != 'msvs' }}
56+
- name: Build project
9857
run: |
9958
ADD_ARGS=()
10059
ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' )

.github/workflows/windows-msvs-ci.yml

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
name: Windows MSVS build and test
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'stable/*'
8+
pull_request:
9+
branches:
10+
- '**'
11+
release:
12+
types:
13+
- created
14+
15+
jobs:
16+
test:
17+
name: Run tests
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include: [
23+
# Only os: windows-2022 has Visual Studio 2022 (v17) installed with toolset v143, which is required.
24+
# configuration: "Release" or "Debug", platform: "x86" or "x64". See solution Configuration Manager.
25+
{ os: windows-2022, configuration: "Release", platform: "x64" },
26+
]
27+
steps:
28+
- name: Set up environment variables
29+
shell: cmd
30+
# For cmd, dont use double quotes in the echo command and dont put a space before >> %GITHUB_ENV%
31+
run: |
32+
if "${{ matrix.platform }}"=="x64" echo output_dir=x64\${{ matrix.configuration }}>> %GITHUB_ENV%
33+
if "${{ matrix.platform }}"=="x86" echo output_dir=${{ matrix.configuration }}>> %GITHUB_ENV%
34+
echo package_suffix=${{ matrix.os}}-msvs-v17-${{ matrix.configuration }}-${{ matrix.platform }}>> %GITHUB_ENV%
35+
- name: Check environment variables
36+
shell: cmd
37+
run: |
38+
echo Output directory - '${{ env.output_dir }}'
39+
echo Package suffix - '${{ env.package_suffix }}'
40+
if "${{ env.output_dir }}"=="" echo ERROR - No output_dir set, possibly unsupported platform '${{ matrix.platform }}'. Expecting x64 or x86. && exit 1
41+
- name: Checkout source
42+
uses: actions/checkout@v4
43+
with:
44+
path: ${{ github.event.repository.name }}
45+
- name: Checkout coinbrew
46+
uses: actions/checkout@v4
47+
with:
48+
repository: coin-or/coinbrew
49+
path: coinbrew
50+
- name: Set up msbuild
51+
uses: microsoft/setup-msbuild@v2
52+
- name: Set up msys for coinbrew
53+
uses: msys2/setup-msys2@v2
54+
with:
55+
update: true
56+
install: >-
57+
base-devel
58+
git
59+
zip
60+
path-type: inherit
61+
msystem: mingw64
62+
- name: Fetch project
63+
run: |
64+
ADD_ARGS=()
65+
ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' )
66+
./coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update "${ADD_ARGS[@]}"
67+
echo "##################################################"
68+
echo "### Extracting Netlib and Miplib3 if available"
69+
if [ -d "./Data/Netlib/" ]; then gunzip ./Data/Netlib/*.gz; fi
70+
if [ -d "./Data/Miplib3/" ]; then gunzip ./Data/Miplib3/*.gz; fi
71+
echo "##################################################"
72+
shell: msys2 {0}
73+
- name: Build project
74+
shell: cmd
75+
run: |
76+
msbuild ${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /m
77+
- name: Test project
78+
shell: cmd
79+
run: |
80+
.\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}Test.cmd .\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ env.output_dir }} .\Data\Sample .\Data\Netlib .\Data\Miplib3
81+
- name: Install project
82+
shell: cmd
83+
run: |
84+
mkdir dist
85+
copy ${{ github.event.repository.name }}\README.* dist\.
86+
copy ${{ github.event.repository.name }}\AUTHORS.* dist\.
87+
copy ${{ github.event.repository.name }}\LICENSE.* dist\.
88+
mkdir dist\bin
89+
copy ${{ github.event.repository.name }}\MSVisualStudio\v17\${{ env.output_dir }}\*.exe dist\bin\.
90+
mkdir dist\share
91+
if exist .\Data\Sample xcopy .\Data\Sample dist\share\coin-or-sample /i
92+
if exist .\Data\Netlib xcopy .\Data\Netlib dist\share\coin-or-netlib /i
93+
if exist .\Data\Miplib3 xcopy .\Data\Miplib3 dist\share\coin-or-miplib3 /i
94+
- name: Upload artifact
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: ${{ github.event.repository.name }}-${{ env.package_suffix }}
98+
path: dist
99+
if-no-files-found: error
100+
- name: Zip up dist contents for release
101+
if: ${{ github.event_name == 'release'}}
102+
run: cd dist && zip -r ../release.zip *
103+
shell: msys2 {0}
104+
- name: Upload package to release
105+
if: ${{ github.event_name == 'release'}}
106+
uses: actions/upload-release-asset@v1
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
with:
110+
upload_url: ${{ github.event.release.upload_url }}
111+
asset_path: ./release.zip
112+
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ env.package_suffix }}.zip
113+
asset_content_type: application/gzip

0 commit comments

Comments
 (0)