-
Notifications
You must be signed in to change notification settings - Fork 17
183 lines (173 loc) · 6.06 KB
/
main.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
name: CI
on:
schedule:
- cron: "20 3 * * *"
push:
pull_request:
workflow_dispatch:
jobs:
build-linux:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["ubuntu-latest", "ubuntu-20.04"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y cmake cmake-data gfortran libcurl4-openssl-dev libxslt1-dev python3-setuptools
sudo python3 -m pip install conan
- name: Build TiXI
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DBUILD_SHARED_LIBS=ON \
-DTIXI_BUILD_TESTS=ON \
-DTIXI_ENABLE_FORTRAN=ON \
..
make -j
- name: Upload build directory
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
retention-days: 1
- name: Build conan package
run: |
conan profile detect
conan create . --build=missing -o 'tixi3/*:shared=True' -s build_type=${{ matrix.config }}
build-win64:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["windows-2019", "windows-latest"]
runs-on: ${{ matrix.os }}
steps:
# On the Github-hosted runner, git checks out text files with \r\n (I think)
# which messes up some unit tests, specifically UtilsTest.loadFileToString,
# which expects TestData/minimal.xml not to have any carriage returns \r.
# So we have to overwrite this checkout policy here:
- name: Set git to use LF instead of CRLF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
md c:\tixi-3rdparty -Force | Out-Null
If (!(Test-Path -Path "c:\tixi-3rdparty\tixi-3rdparty-vc2015-win64")) {
Write-Output "Downloading tixi 3rdparty libraries"
(new-object System.Net.WebClient).Downloadfile("https://sourceforge.net/projects/tixi/files/dev-tools/tixi-3rdparty-vc2015-win64.zip", "c:\tixi-3rdparty-vc2015-win64.zip")
Write-Output "Extract tixi 3rdparty libraries"
& 7z x -y "c:\tixi-3rdparty-vc2015-win64.zip" -oC:\tixi-3rdparty\ > null
}
If (!(Test-Path -Path "c:\tixi-3rdparty\matlab-libs-win")) {
Write-Output "Downloading matlab libraries"
(new-object System.Net.WebClient).Downloadfile("https://sourceforge.net/projects/tixi/files/dev-tools/matlab-libs-win.zip", "c:\matlab-libs-win.zip")
Write-Output "Extract matlab libraries"
& 7z x -y "c:\matlab-libs-win.zip" -oC:\tixi-3rdparty\ > null
}
- name: Setup msys2/gfortran
uses: msys2/setup-msys2@v2
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Build TiXI
shell: cmd /C call {0}
run: |
gfortran --version
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-DTIXI_ENABLE_FORTRAN=ON ^
-DBUILD_SHARED_LIBS=ON ^
-DTIXI_BUILD_TESTS=ON ^
-DMATLAB_DIR=c:\tixi-3rdparty\matlab-libs-win ^
-DCMAKE_PREFIX_PATH='c:\tixi-3rdparty\tixi-3rdparty-vc2015-win64' ^
-DCMAKE_INSTALL_PREFIX=install ^
..
cmake --build . --target install --config ${{ matrix.config }}
- name: Upload build directory
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
retention-days: 1
test-linux:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["ubuntu-latest", "ubuntu-20.04"]
runs-on: ${{ matrix.os }}
needs: build-linux
steps:
- name: Download build directory
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
- name: Run unit tests
run: |
cd build/tests
chmod a+x TIXI-unittests
./TIXI-unittests
test-win64:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["windows-2019", "windows-latest"]
runs-on: ${{ matrix.os }}
needs: build-win64
steps:
- name: Download build directory
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
- name: Run unit tests
shell: cmd /C call {0}
run: |
set PATH=%cd%\build\install\bin;%cd%\build\lib\${{ matrix.config }};%cd%\build\bin\${{ matrix.config }};%PATH%
cd build\tests
.\${{ matrix.config }}\TIXI-unittests.exe --gtest_output=xml:test_results.xml
deploy-win64:
runs-on: "windows-2019"
needs: test-win64
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download build directory
uses: actions/download-artifact@v4
with:
name: build-windows-2019-Release
path: build
- name: Artifact installer and zip
run: |
cd build
cmake --build .. --config Release --target doc
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
& 'C:\Program Files\CMake\bin\cpack.exe' -G NSIS
- name: Upload installer as artifact
uses: actions/upload-artifact@v4
with:
name: win64-installer
path: build/*.exe
- name: Upload package as artifact
uses: actions/upload-artifact@v4
with:
name: win64-package
path: build/*.zip
- name: Upload documentation as artifact
uses: actions/upload-artifact@v4
with:
name: html-documentation
path: build/doc/html/*