-
Notifications
You must be signed in to change notification settings - Fork 16
107 lines (106 loc) · 4.23 KB
/
windows-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
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: msvc, msystem: mingw64, debug: false, suffix: "-md" },
{ os: windows-2022, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" },
]
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
path: ${{ github.event.repository.name }}
- name: Checkout coinbrew
uses: actions/checkout@v4
with:
repository: coin-or/coinbrew
path: coinbrew
- name: Set up msvc
if: ${{ matrix.arch == 'msvc' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Set correct host flag and install requirements
if: ${{ matrix.arch != 'msvc' }}
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: Build project
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 )
./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@v4
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
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ 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