-
Notifications
You must be signed in to change notification settings - Fork 4
192 lines (187 loc) · 7.51 KB
/
cpp-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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: C++ CI
on:
pull_request:
merge_group:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CMAKE_BUILD_PARALLEL_LEVEL: 3
CTEST_PARALLEL_LEVEL: 1
jobs:
read-parameters:
name: read-parameters
runs-on: ubuntu-latest
outputs:
gurobiVersion: ${{ steps.set-output.outputs.gurobiVersion }}
gurobiShortVersion: ${{ steps.set-output.outputs.gurobiShortVersion }}
gurobiFolder: ${{ steps.set-output.outputs.gurobiFolder }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Read current gurobi Version
uses: zlatko-ms/varfiletoenv@v3
with:
paths: ./.github/gurobi_version.json
- name: Export variables for next jobs
id: set-output
run: |
echo "gurobiVersion=${{ env.gurobiVersion }}" >> $GITHUB_OUTPUT
echo "gurobiShortVersion=${{ env.gurobiShortVersion }}" >> $GITHUB_OUTPUT
echo "gurobiFolder=${{ env.gurobiFolder }}" >> $GITHUB_OUTPUT
cpp-ubuntu-latest:
name: cpp-ubuntu-latest
runs-on: ubuntu-latest
needs: read-parameters
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup-gurobi-license
id: write-license
env:
GUROBI_LICENSE: ${{ secrets.GUROBI_LICENSE }}
run: |
echo "$GUROBI_LICENSE" > $PWD/gurobi.lic
echo "GRB_LICENSE_FILE=$PWD/gurobi.lic" >> $GITHUB_ENV
- name: download-gurobi-linux
env:
GUROBI_VERSION_SHORT: ${{ needs.read-parameters.outputs.gurobiShortVersion }}
GUROBI_VERSION: ${{ needs.read-parameters.outputs.gurobiVersion }}
GUROBI_VERSION_FOLDER: ${{ needs.read-parameters.outputs.gurobiFolder }}
GUROBI_FILE: gurobi${{ needs.read-parameters.outputs.gurobiVersion }}_linux64.tar.gz
run: |
wget https://packages.gurobi.com/${{ env.GUROBI_VERSION_SHORT }}/${{ env.GUROBI_FILE }}
tar -xvzf ${{ env.GUROBI_FILE }}
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON ${{ matrix.config.toolchain }}
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest -C Release --output-on-failure --test-dir build --repeat until-pass:3 --timeout 500
cpp-macos-latest:
name: cpp-macos-latest
runs-on: macos-latest
needs: read-parameters
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup-gurobi-license
id: write-license
env:
GUROBI_LICENSE: ${{ secrets.GUROBI_LICENSE_TWO }}
run: |
echo "$GUROBI_LICENSE" > $PWD/gurobi.lic
echo "GRB_LICENSE_FILE=$PWD/gurobi.lic" >> $GITHUB_ENV
- name: download-gurobi-mac
env:
GUROBI_VERSION_SHORT: ${{ needs.read-parameters.outputs.gurobiShortVersion }}
GUROBI_VERSION: ${{ needs.read-parameters.outputs.gurobiVersion }}
GUROBI_VERSION_FOLDER: ${{ needs.read-parameters.outputs.gurobiFolder }}
GUROBI_FILE: gurobi${{ needs.read-parameters.outputs.gurobiVersion }}_macos_universal2.pkg
run: |
wget https://packages.gurobi.com/${{ env.GUROBI_VERSION_SHORT }}/${{ env.GUROBI_FILE }}
sudo installer -pkg ${{ env.GUROBI_FILE }} -target /
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON ${{ matrix.config.toolchain }}
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest -C Release --output-on-failure --test-dir build --repeat until-pass:3 --timeout 500
cpp-windows-latest:
name: cpp-windows-latest
runs-on: windows-latest
needs:
- cpp-macos-latest
- read-parameters
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup-gurobi-license
id: write-license
env:
GUROBI_LICENSE: ${{ secrets.GUROBI_LICENSE_TWO }}
run: |
echo "$GUROBI_LICENSE" > $PWD/gurobi.lic
echo "GRB_LICENSE_FILE=$PWD/gurobi.lic" >> $GITHUB_ENV
- name: download-gurobi-windows
shell: powershell
env:
GUROBI_VERSION_SHORT: ${{ needs.read-parameters.outputs.gurobiShortVersion }}
GUROBI_VERSION: ${{ needs.read-parameters.outputs.gurobiVersion }}
GUROBI_VERSION_FOLDER: ${{ needs.read-parameters.outputs.gurobiFolder }}
GUROBI_FILE: Gurobi-${{ needs.read-parameters.outputs.gurobiVersion }}-win64.msi
run: |
wget https://packages.gurobi.com/${{ env.GUROBI_VERSION_SHORT }}/${{ env.GUROBI_FILE }} -OutFile ${{ env.GUROBI_FILE }}
New-Item -itemType directory gurobi
$proc = Start-Process msiexec.exe -ArgumentList "/a ${{ env.GUROBI_FILE }} /qb /L*! install.log TARGETDIR=$PWD\gurobi" -NoNewWindow -PassThru
$timeouted = $null
$proc | Wait-Process -Timeout 120 -ErrorAction SilentlyContinue -ErrorVariable timeouted
if ($timeouted)
{
echo "TIMEOUT"
$proc.Kill()
}
cat install.log
ls $PWD\gurobi
- name: set-gurobi-env-variables
id: gurobi-env-variables
shell: powershell
run: |
echo "GUROBI_HOME=$PWD\gurobi\${{ needs.read-parameters.outputs.gurobiFolder }}\win64" >> $env:GITHUB_ENV
echo "$PWD\gurobi\${{ needs.read-parameters.outputs.gurobiFolder }}\win64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON ${{ matrix.config.toolchain }}
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest -C Release --output-on-failure --test-dir build --repeat until-pass:3 --timeout 500
coverage:
name: Coverage
runs-on: ubuntu-latest
needs:
- cpp-ubuntu-latest
- read-parameters
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup-gurobi-license
id: write-license
env:
GUROBI_LICENSE: ${{ secrets.GUROBI_LICENSE }}
run: |
echo "$GUROBI_LICENSE" > $PWD/gurobi.lic
echo "GRB_LICENSE_FILE=$PWD/gurobi.lic" >> $GITHUB_ENV
- name: download-gurobi-linux
env:
GUROBI_VERSION_SHORT: ${{ needs.read-parameters.outputs.gurobiShortVersion }}
GUROBI_VERSION: ${{ needs.read-parameters.outputs.gurobiVersion }}
GUROBI_VERSION_FOLDER: ${{ needs.read-parameters.outputs.gurobiFolder }}
GUROBI_FILE: gurobi${{ needs.read-parameters.outputs.gurobiVersion }}_linux64.tar.gz
run: |
wget https://packages.gurobi.com/${{ env.GUROBI_VERSION_SHORT }}/${{ env.GUROBI_FILE }}
tar -xvzf ${{ env.GUROBI_FILE }}
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON
- name: Build
run: cmake --build build --config Debug --target rail_test
- name: Test
run: ctest -C Debug --output-on-failure --test-dir build --repeat until-pass:3 --timeout 500
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
gcov: true
gcov_ignore: "extern/**/*"
token: ${{ secrets.CODECOV_TOKEN }}