-
Notifications
You must be signed in to change notification settings - Fork 5
544 lines (445 loc) · 17 KB
/
cmake.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
name: CMake
on:
push:
pull_request:
branches:
- master
schedule:
- cron: '15 14 4,11,18,25 * *'
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
NAME: IPhreeqc
jobs:
init:
runs-on: ubuntu-latest
# Map step outputs to job outputs
outputs:
VER: ${{ steps.vars.outputs.VER }}
REL: ${{ steps.vars.outputs.REL }}
DATE: ${{ steps.vars.outputs.DATE }}
DATE_RFC_3339: ${{ steps.vars.outputs.DATE_RFC_3339 }}
steps:
- name: Setup vars
id: vars
run: |
echo VER=$(curl -sS https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/next_ver.sh | sh) >> $GITHUB_OUTPUT
echo REL=$(curl -sS https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/rel.py | python3) >> $GITHUB_OUTPUT
echo DATE=$(date "+%x") >> $GITHUB_OUTPUT
echo DATE_RFC_3339=$(date --rfc-3339=date) >> $GITHUB_OUTPUT
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
BUILD_DIR: _ctest # set in ctest.cmake
steps:
- uses: actions/checkout@v4
- name: Install ninja valgrind (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build valgrind
- name: Install ninja (macOS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Set up Visual Studio shell (Windows)
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: CTest
run: ctest -S ctest.cmake -V --output-on-failure --timeout 900
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ github.job }}-results
path: ${{ github.workspace }}/${{ env.BUILD_DIR }}/Testing/
test-shared:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
BUILD_DIR: _ctest_shared # set in ctest-shared.cmake
steps:
- uses: actions/checkout@v4
- name: Install ninja valgrind (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build valgrind
- name: Install ninja (macOS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Set up Visual Studio shell (Windows)
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: CTest
run: ctest -S ctest-shared.cmake -V --output-on-failure --timeout 900
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ github.job }}-results
path: ${{ github.workspace }}/${{ env.BUILD_DIR }}/Testing/
test-clang:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
shared_libs: [OFF, ON]
enable_module: [OFF, ON]
runs-on: ${{ matrix.os }}
env:
BUILD_DIR: _build
steps:
- uses: actions/checkout@v4
- name: Install ninja valgrind (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build clang valgrind
- name: Install ninja (macOS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Set up Visual Studio shell (Windows)
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: CMake configure
if: runner.os == 'Linux'
run: CC=clang CXX=clang++ cmake -B ${{ env.BUILD_DIR }} -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} -DIPHREEQC_ENABLE_MODULE=${{ matrix.enable_module }} -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON
- name: CMake configure
if: runner.os == 'macOS'
run: CC=$(brew --prefix llvm@15)/bin/clang CXX=$(brew --prefix llvm@15)/bin/clang++ cmake -B ${{ env.BUILD_DIR }} -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} -DIPHREEQC_ENABLE_MODULE=${{ matrix.enable_module }} -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON
- name: CMake configure
if: runner.os == 'Windows'
run: cmake -B ${{ env.BUILD_DIR }} -A x64 -T "ClangCL" -DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} -DIPHREEQC_ENABLE_MODULE=${{ matrix.enable_module }} -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON
- name: CMake build
run: cmake --build ${{ env.BUILD_DIR }}
- name: CTest
run: ctest --test-dir ${{ env.BUILD_DIR }}
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ github.job }}-SHARED=${{ matrix.shared_libs }}-MODULE=${{ matrix.enable_module }}-results
path: ${{ github.workspace }}/${{ env.BUILD_DIR }}/Testing/
chm:
runs-on: windows-latest
steps:
- name: Checkout phreeqc3-HTMLversion
uses: actions/checkout@v4
with:
repository: usgs-coupled-subtrees/phreeqc3-HTMLversion
ref: master
- name: cache htmlhelp
id: cache-htmlhelp
uses: actions/cache@v4
with:
path: "C:/Program Files (x86)/HTML Help Workshop"
key: ${{ runner.os }}-htmlhelp
- name: install htmlhelp
if: steps.cache-htmlhelp.outputs.cache-hit != 'true'
timeout-minutes: 5
run: |
curl -L -O --max-time 120 http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe
cmd /c start /wait .\htmlhelp.exe /q /c /t:$(Get-Location)\tmp
$file = "$(Get-Location)\tmp\htmlhelp.inf"
(Get-Content $file) | Foreach-Object { $_ `
-replace '^BeginPrompt', ';;BeginPrompt' `
-replace '^EndPrompt', ';;EndPrompt' `
-replace '^49000=CustomLDID49000, 1', '49000=CustomLDID49000, 5' `
-replace '^"hhupd.exe', ';;hhupd.exe' `
-replace '^DefaultInstallDir="C:\\Program Files\\HTML Help Workshop"', 'DefaultInstallDir="%ProgramFiles%\\HTML Help Workshop"'
} | Set-Content $file
cmd /c start /wait .\tmp\setup.exe
Remove-Item -Recurse -Force .\tmp
Remove-Item -Recurse -Force .\htmlhelp.exe
# the next line doesn't seem to work (supposed to set the path)
# echo 'C:\Program Files (x86)\HTML Help Workshop' >> $GITHUB_PATH
- name: compile chm
shell: bash
run: |
pushd HTML
bash fixup_html.bash
popd
# hhc returns 1 on success
set +e
'C:\Program Files (x86)\HTML Help Workshop\hhc' phreeqc3.hhp | tee hhc.out
status=${PIPESTATUS[0]}
set -e
if [ "$status" -eq 1 ]; then
echo "[OK]"
exit 0
else
echo "[FAILED]"
exit 1
fi
- uses: actions/upload-artifact@v4
with:
name: chm
path: ${{github.workspace}}/phreeqc3.chm
R-CMD-check:
needs: [init]
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
steps:
- uses: actions/checkout@v4
- name: versioning
run: ./jenkins-dist.sh -v ${{ needs.init.outputs.VER }} -r ${{ needs.init.outputs.REL }} -d ${{ needs.init.outputs.DATE }}
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
- name: create source
working-directory: R
run: make VERSION=${{ needs.init.outputs.VER }} RELEASE_DATE=${{ needs.init.outputs.DATE_RFC_3339 }} source
- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2, any::pkgbuild, any::rcmdcheck
needs: roxygen2, pkgbuild, check
working-directory: R/phreeqc
- name: Display sessionInfo()
run: sessionInfo()
working-directory: R/phreeqc
shell: Rscript {0}
- name: roxygen2::roxygenise()
run: roxygen2::roxygenise()
working-directory: R/phreeqc
shell: Rscript {0}
- name: Check
uses: r-lib/actions/check-r-package@v2
with:
working-directory: R/phreeqc
- name: List files
if: matrix.config.os == 'ubuntu-latest' && matrix.config.r == 'release'
run: |
pwd
ls -lR
find -name "*.tar.gz"
- uses: actions/upload-artifact@v4
if: matrix.config.os == 'ubuntu-latest' && matrix.config.r == 'release'
with:
name: cran
path: ${{ github.workspace }}/R/phreeqc/check/phreeqc_*.tar.gz
# r-build:
# needs: [init]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: r-lib/actions/setup-r@v2
# with:
# use-public-rspm: true
# - name: install devtools
# run: Rscript -e 'install.packages("devtools")'
# - name: install curl
# run: Rscript -e 'install.packages("curl")'
# - name: versioning
# run: ./jenkins-dist.sh -v ${{ needs.init.outputs.VER }} -r ${{ needs.init.outputs.REL }} -d ${{ needs.init.outputs.DATE }}
# - name: setup clang
# run: |
# mkdir -p ~/.R
# echo CC=clang -Qunused-arguments > ~/.R/Makevars
# echo CXX=clang++ -Qunused-arguments >> ~/.R/Makevars
# - name: check
# run: cd R && make VERSION=${{ needs.init.outputs.VER }} check_built
# - uses: actions/upload-artifact@v4
# with:
# name: cran
# path: ${{github.workspace}}/R/phreeqc_*.tar.gz
# r-valgrind:
# needs: [r-build]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# name: cran
# path: R
# - name: Display structure of downloaded files
# working-directory: R
# run: ls -lR
# - uses: r-lib/actions/setup-r@v2
# with:
# use-public-rspm: true
# - name: install devtools
# run: Rscript -e 'install.packages("devtools")'
# - name: install curl
# run: Rscript -e 'install.packages("curl")'
# - name: install valgrind
# run: sudo apt-get install -y valgrind
# - name: setup clang
# run: |
# mkdir -p ~/.R
# echo CC=clang -Qunused-arguments > ~/.R/Makevars
# echo CXX=clang++ -Qunused-arguments >> ~/.R/Makevars
# - name: install
# run: cd R && R CMD INSTALL --build phreeqc_*.tar.gz
# - name: run
# run: cd R && R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < valgrind.R 2>&1 | tee valgrind.full.out
# - uses: actions/upload-artifact@v4
# with:
# name: valgrind
# path: ${{github.workspace}}/R/valgrind.full.out
distcheck:
needs: [init, chm]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: chm
- name: mv chm
run: mv phreeqc3.chm doc/.
- name: versioning
run: ./jenkins-dist.sh -v ${{ needs.init.outputs.VER }} -r ${{ needs.init.outputs.REL }} -d ${{ needs.init.outputs.DATE }}
- name: doxygen
run: sudo apt-get install -y doxygen && cd doc && doxygen
- name: autoreconf
run: autoreconf -fvi
- name: mkdir
run: mkdir _build
- name: configure
working-directory: ${{github.workspace}}/_build
run: ../configure --prefix=$(pwd)/INSTALL
- name: make
working-directory: ${{github.workspace}}/_build
run: make -j2 distcheck
- name: convert
run: |
sudo apt install -y dos2unix
native="
doc/Makefile \
doc/examples/AccumulateLine.c \
doc/examples/CreateIPhreeqc.c \
doc/examples/F90ClearAccumulatedLines.f90 \
doc/examples/F90CreateIPhreeqc.f90 \
doc/examples/F90DestroyIPhreeqc.f90 \
doc/examples/F90GetComponent.f90 \
doc/examples/F90GetDumpStringLine.f90 \
doc/examples/F90GetSelectedOutputValue.f90 \
doc/examples/F90GetVersionString.f90 \
doc/examples/GetComponent.c \
doc/examples/GetDumpString.c \
doc/examples/GetSelectedOutputValue.c \
doc/examples/GetVersionString.c \
doc/examples/IPhreeqc.cpp \
doc/examples/Makefile \
doc/examples/phreeqc.dat \
src/CSelectedOutput.cpp \
src/CSelectedOutput.hxx \
src/CVar.hxx \
src/Debug.h \
src/ErrorReporter.hxx \
src/IPhreeqc.cpp \
src/IPhreeqc.f.inc \
src/IPhreeqc.f90.inc \
src/IPhreeqc.h \
src/IPhreeqc.hpp \
src/IPhreeqcCallbacks.h \
src/IPhreeqcF.f \
src/IPhreeqcLib.cpp \
src/IPhreeqc_interface.F90 \
src/IPhreeqc_interface_F.cpp \
src/IPhreeqc_interface_F.h \
src/Var.c \
src/Var.h \
src/Version.h \
src/fimpl.h \
src/fwrap.cpp \
src/fwrap.h \
src/fwrap1.cpp \
src/fwrap2.cpp \
src/fwrap3.cpp \
src/fwrap4.cpp \
src/fwrap5.cpp \
src/fwrap6.cpp \
src/fwrap7.cpp \
src/fwrap8.cpp \
src/pp_sys.cpp \
src/thread.h \
test/llnl.dat \
test/phreeqc.dat \
test2/Makefile \
test2/wateq4f.dat \
test5/Makefile \
test5/phreeqc.dat \
test5/test5.c \
tests/main_fortran.cxx \
tests/test_c.c \
tests/test_cxx.cxx \
tests/test_f90.F90 \
unit/TestCVar.cpp \
unit/TestCVar.h \
unit/TestInterface.cpp \
unit/TestInterface.h \
unit/TestSelectedOutput.cpp \
unit/TestSelectedOutput.h \
unit/TestVar.cpp \
unit/TestVar.h \
unit/llnl.dat.old \
unit/missing_e.dat \
unit/phreeqc.dat.old \
unit/unit.cpp"
for f in ${native}; do
unix2dos "${f}"
done
- name: dist-zip
working-directory: ${{github.workspace}}/_build
run: make dist-zip
- name: copy
run: cp doc/README IPhreeqc_ReadMe.txt
- uses: actions/upload-artifact@v4
with:
name: readme
path: ${{github.workspace}}/IPhreeqc_ReadMe.txt
- uses: actions/upload-artifact@v4
with:
name: tarball
path: ${{github.workspace}}/_build/*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: zipball
path: ${{github.workspace}}/_build/*.zip
# build:
# needs: [init]
# # The CMake configure and build commands are platform agnostic and should work equally
# # well on Windows or Mac. You can convert this to a matrix build if you need
# # cross-platform coverage.
# # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
# runs-on: windows-2019
# # Check all combinations of BUILD_SHARED_LIBS and BUILD_CLR_LIBS
# strategy:
# matrix:
# BUILD_SHARED_LIBS: [ON, OFF]
# BUILD_CLR_LIBS: [ON, OFF]
# exclude:
# - BUILD_SHARED_LIBS: OFF
# BUILD_CLR_LIBS: ON
# steps:
# - uses: actions/checkout@v4
# - name: Configure CMake
# # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=${{matrix.BUILD_SHARED_LIBS}} -DBUILD_CLR_LIBS=${{matrix.BUILD_CLR_LIBS}}
# - name: Build
# # Build your program with the given configuration
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# - name: Test
# working-directory: ${{github.workspace}}/build
# # Execute tests defined by the CMake configuration.
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C ${{env.BUILD_TYPE}}