Debian Codegraph @

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

raw
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 }}\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}.sln /p:Configuration=Release /p:Platform=x64 /m
77 - name: Test project
78 shell: cmd
79 run: |
80 .\${{ github.event.repository.name }}\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}Test.cmd .\${{ github.event.repository.name }}\${{ 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 }}\${{ 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