forked from MODFLOW-ORG/modflow6
-
Notifications
You must be signed in to change notification settings - Fork 0
824 lines (744 loc) · 29.5 KB
/
Copy pathrelease.yml
File metadata and controls
824 lines (744 loc) · 29.5 KB
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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
name: MODFLOW 6 release
on:
# workflow_call event lets this workflow be called either
# from this repo or the nightly build repo for dev builds
workflow_call:
inputs:
branch:
description: 'Branch to release from.'
required: true
type: string
compiler_toolchain:
description: 'Compiler toolchain to use. For supported options see https://github.com/MODFLOW-ORG/modflow6/blob/develop/DEVELOPER.md#compiler-compatibility.'
required: false
type: string
default: 'intel-classic'
compiler_version:
description: 'Compiler version to use. For supported options see https://github.com/MODFLOW-ORG/modflow6/blob/develop/DEVELOPER.md#compiler-compatibility.'
required: false
type: string
default: '2021.6'
releasemode:
description: 'Build a full distribution containing sources, examples, and all documentation. If false, the distribution contains only binaries, mf6io, release notes, and code.json, with binaries built in develop mode, and disclaimers & version strings indicating preliminary/provisional status. If true, a full distribution is created, with binaries built in release mode, and disclaimer language indicating review and approval.'
required: false
type: boolean
default: false
linux_version:
description: 'Linux runner image to build binaries on.'
required: false
type: string
default: 'ubuntu-22.04'
run_tests:
description: Run tests after building binaries.'
required: false
type: boolean
default: true
version:
description: 'Version number to use for release.'
required: true
type: string
patch:
description: 'Create a patch release. If true, only bug fixes will be included in generated documentation.'
required: false
type: boolean
default: false
outputs:
version:
description: 'Version number used for release'
value: ${{ jobs.build.outputs.version }}
distname:
description: 'Distribution name used for release'
value: ${{ jobs.build.outputs.distname }}
env:
PIXI_BETA_WARNING_OFF: true
jobs:
build:
name: Build binaries (${{ matrix.os }}, extended=${{ matrix.extended }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ${{ inputs.linux_version }}
compiler: ${{ inputs.compiler_toolchain }}
version: ${{ inputs.compiler_version }}
optimization: 2
extended: false
- os: macos-14
compiler: gcc
version: 13
optimization: 1
extended: false
xcode-version: '15.1.0'
- os: windows-2022
compiler: ${{ inputs.compiler_toolchain }}
version: ${{ inputs.compiler_version }}
optimization: 2
extended: false
- os: windows-2022
compiler: intel-classic
version: "2021.6"
optimization: 2
extended: true
defaults:
run:
shell: bash
outputs:
version: ${{ steps.set_version.outputs.version }}
distname: ${{ steps.set_version.outputs.distname }}
steps:
- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout modflow6
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/modflow6
path: modflow6
ref: ${{ inputs.branch }}
- name: Checkout modflow6-testmodels
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/modflow6-testmodels
path: modflow6-testmodels
- name: Checkout modflow6-examples
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/modflow6-examples
path: modflow6-examples
- name: Setup ${{ matrix.compiler }} ${{ matrix.version }}
if: (!(runner.os == 'Windows' && matrix.extended))
id: setup-fortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.41.4
manifest-path: "modflow6/pixi.toml"
- name: Custom pixi install
working-directory: modflow6
run: pixi run install
- name: Set version number
id: set_version
run: |
# distribution name format is 'mf<major.minor.patch[label]>'
distname="mf${{ inputs.version }}"
# set step outputs and environment variables
echo "version=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
echo "distname=$distname" >> "$GITHUB_OUTPUT"
echo "DISTNAME=$distname" >> "$GITHUB_ENV"
- name: Update version
id: update_version
working-directory: modflow6
run: |
ver="${{ steps.set_version.outputs.version }}"
cmd="pixi run update-version -v $ver"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Update flopy
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
working-directory: modflow6
run: |
cmd="pixi run update-flopy"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Set OS tag
id: ostag
working-directory: modflow6
run: |
ostag=$(pixi run python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())")
if [[ "${{ matrix.extended }}" == "true" ]]; then
ostag="${ostag}ext"
fi
echo "ostag=$ostag" >> $GITHUB_OUTPUT
- name: Set markers
if: inputs.run_tests == true
id: set_markers
run: |
markers="not large"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
markers="$markers and not developmode"
fi
echo "markers=$markers" >> $GITHUB_OUTPUT
- name: Set filters
if: inputs.run_tests == true
id: set_filters
run: |
filters=""
if [[ "${{ matrix.extended }}" == "true" ]] && [[ "${{ inputs.releasemode }}" != "true" ]]; then
# run only parallel/extended tests in developmode, run all tests in releasemode
filters="test_par or test_netcdf"
fi
# comparison fails on macos with optimization=1
if [[ "${{ runner.os }}" == "macOS" ]]; then
if [[ "$filters" != "" ]]; then
filters="$filters and not test028_sfr_rewet"
else
filters="not test028_sfr_rewet"
fi
fi
echo "filters=$filters" >> $GITHUB_OUTPUT
- name: Set xcode version (macOS)
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode-version }}
# static link gfortran libs
- name: Hide dylibs (macOS)
if: runner.os == 'macOS'
run: |
version="${{ matrix.version }}"
brew_prefix="$(brew --prefix)"
libpath="$brew_prefix/opt/gcc@$version/lib/gcc/$version"
mv $libpath/libgcc_s.1.1.dylib $libpath/libgcc_s.1.1.dylib.bak
mv $libpath/libgfortran.5.dylib $libpath/libgfortran.5.dylib.bak
mv $libpath/libquadmath.0.dylib $libpath/libquadmath.0.dylib.bak
# use classic xcode linker, static link libgcc
- name: Set LDFLAGS (macOS)
if: runner.os == 'macOS'
run: |
ldflags="$LDFLAGS -Wl,-ld_classic -static-libgcc"
echo "LDFLAGS=$ldflags" >> $GITHUB_ENV
- name: Build MF6
if: (!(runner.os == 'Windows' && matrix.extended))
working-directory: modflow6
run: |
pixi run setup builddir -Doptimization=${{ matrix.optimization }}
pixi run build builddir
- name: Build mf5to6 converter
if: (!(runner.os == 'Windows' && matrix.extended))
working-directory: modflow6
run: |
pixi run setup-mf5to6 builddir -Doptimization=${{ matrix.optimization }}
pixi run build-mf5to6 builddir
- name: Show build log
if: failure()
working-directory: modflow6
run: cat builddir/meson-logs/meson-log.txt
- name: Upload build log
if: failure()
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.version }}-meson-log.txt
path: modflow6/builddir/meson-logs/meson-log.txt
- name: Check arch/libs (macOS)
if: runner.os == 'macOS'
working-directory: modflow6/bin
run: |
otool -L mf6
otool -L libmf6.dylib
otool -L mf5to6
otool -L zbud6
lipo -info mf6
lipo -info libmf6.dylib
lipo -info mf5to6
lipo -info zbud6
# TODO remove after next executables release. only necessary because
# tests using gridgen were failing as the current gridgen depends on
# some dylibs. new executables all statically link gcc/gfortran libs
- name: Restore dylibs (macOS)
if: runner.os == 'macOS'
run: |
version="${{ matrix.version }}"
brew_prefix="$(brew --prefix)"
libpath="$brew_prefix/opt/gcc@$version/lib/gcc/$version"
mv $libpath/libgcc_s.1.1.dylib.bak $libpath/libgcc_s.1.1.dylib
mv $libpath/libgfortran.5.dylib.bak $libpath/libgfortran.5.dylib
mv $libpath/libquadmath.0.dylib.bak $libpath/libquadmath.0.dylib
- name: Unit test MF6
# temporarily skip on macOS.. why don't these fail in the normal CI?
if: (!(runner.os == 'Windows' && matrix.extended) && !(runner.os == 'macOS'))
working-directory: modflow6
run: pixi run test builddir
- name: Get executables
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
working-directory: modflow6
env:
GITHUB_TOKEN: ${{ github.token }}
run: pixi run get-exes -s
- name: Build binaries (Windows)
if: runner.os == 'Windows' && matrix.extended && !inputs.run_tests
uses: ./modflow6/.github/actions/build-extended-win
env:
RELEASEMODE: ${{ inputs.releasemode }}
- name: Build and test binaries (Windows)
if: runner.os == 'Windows' && matrix.extended && inputs.run_tests
uses: ./modflow6/.github/actions/test-extended-win
env:
RELEASEMODE: ${{ inputs.releasemode }}
MARKERS: ${{ steps.set_markers.outputs.markers }}
FILTERS: ${{ steps.set_filters.outputs.filters }}
- name: Copy deps to bin dir (Windows)
if: runner.os == 'Windows' && matrix.extended
working-directory: modflow6/bin
shell: cmd
run: |
:: copy dependencies
copy "C:\Windows\System32\ucrtbase.dll" .
copy "C:\Windows\System32\msvcrt.dll" .
copy "C:\Windows\System32\msvcp_win.dll" .
copy "C:\Windows\SYSTEM32\MSVCP140.dll" .
copy "C:\Windows\SYSTEM32\VCRUNTIME140.dll" .
copy "C:\Windows\SYSTEM32\VCRUNTIME140_1.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\bin\libifcoremd.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\bin\libmmd.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_sequential.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_core.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_def.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_avx2.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_avx512.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_mc3.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\impi.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\opt\mpi\libfabric\bin\libfabric.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\mpiexec.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_bstrap_proxy.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_pmi_proxy.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_service.exe" .
copy "%GITHUB_WORKSPACE%\petsc\arch-mswin-c-opt\lib\libpetsc.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.3-NC4-64\bin\hdf5.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.3-NC4-64\bin\hdf5_hl.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.3-NC4-64\bin\libcurl.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.3-NC4-64\bin\netcdf.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.3-NC4-64\bin\zlib1.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netcdf-fortran-4.6.2\build\fortran\netcdff.dll" .
:: remove rebuilt and downloaded dirs
if exist rebuilt rd /s /q rebuilt
if exist downloaded rd /s /q downloaded
- name: Test MF6
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
working-directory: modflow6
env:
REPOS_PATH: ${{ github.workspace }}
run: pixi run autotest -m "${{ steps.set_markers.outputs.markers }} and not external" -k "${{ steps.set_filters.outputs.filters }}"
- name: Test MF6 models
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
working-directory: modflow6
env:
REPOS_PATH: ${{ github.workspace }}
run: pixi run autotest -m "${{ steps.set_markers.outputs.markers }} and external" -k "${{ steps.set_filters.outputs.filters }}" --models-path ../../modflow6-testmodels/mf6
- name: Test converter models
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
working-directory: modflow6
env:
REPOS_PATH: ${{ github.workspace }}
run: pixi run autotest -m "${{ steps.set_markers.outputs.markers }} and external" -k "${{ steps.set_filters.outputs.filters }}" --models-path ../../modflow6-testmodels/mf5to6 --namefile-pattern "*.nam"
- name: Upload failed test output
if: failure()
uses: actions/upload-artifact@v7
with:
name: failed-${{ matrix.os }}-${{ inputs.compiler_toolchain }}-${{ inputs.compiler_version }}
path: modflow6/autotest/.failed
- name: Clean bin directory
if: inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended)
working-directory: modflow6/bin
run: rm -rf rebuilt downloaded
- name: Upload binaries
uses: actions/upload-artifact@v7
with:
name: bin-${{ steps.ostag.outputs.ostag }}
path: modflow6/bin
# steps below run only on Linux to test distribution procedures, e.g.
# compiling binaries, building documentation
- name: Checkout usgslatex
if: ${{ runner.os == 'Linux' && inputs.run_tests == true }}
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/usgslatex
path: usgslatex
- name: Install TeX Live
if: ${{ runner.os == 'Linux' && inputs.run_tests == true }}
run: |
sudo apt-get update
sudo apt install texlive-science \
texlive-latex-extra \
texlive-font-utils \
texlive-fonts-recommended \
texlive-fonts-extra
- name: Install USGS LaTeX style files and Univers font
if: ${{ runner.os == 'Linux' && inputs.run_tests == true }}
working-directory: usgslatex/usgsLaTeX
run: sudo ./install.sh --all-users
- name: Test distribution scripts
if: ${{ inputs.run_tests == true && !(runner.os == 'Windows' && matrix.extended) }}
working-directory: modflow6
env:
GITHUB_TOKEN: ${{ github.token }}
run: pixi run test-dist-scripts
docs:
name: Build docs
needs: build
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
steps:
- name: Free disk space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout modflow6
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/modflow6
path: modflow6
ref: ${{ inputs.branch }}
- name: Checkout modflow6-examples
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/modflow6-examples
path: modflow6-examples
- name: Checkout usgslatex
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/usgslatex
path: usgslatex
- name: Install TeX Live
run: |
sudo apt-get update
sudo apt install texlive-science \
texlive-latex-extra \
texlive-font-utils \
texlive-fonts-recommended \
texlive-fonts-extra
- name: Install USGS LaTeX style files and Univers font
working-directory: usgslatex/usgsLaTeX
run: sudo ./install.sh --all-users
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.41.4
manifest-path: "modflow6/pixi.toml"
- name: Custom pixi install
working-directory: modflow6
run: pixi run install
- name: Setup ${{ inputs.compiler_toolchain }} ${{ inputs.compiler_version }}
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ inputs.compiler_toolchain }}
version: ${{ inputs.compiler_version }}
- name: Update version
id: update_version
working-directory: modflow6/distribution
run: |
ver="${{ needs.build.outputs.version }}"
cmd="pixi run update-version -v $ver"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Update flopy
working-directory: modflow6
run: |
cmd="pixi run update-flopy --dfnpath doc/mf6io/mf6ivar/dfn"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Get OS tag
id: ostag
working-directory: modflow6
run: |
ostag=$(pixi run python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())")
echo "ostag=$ostag" >> $GITHUB_OUTPUT
- name: Download pre-built binaries
uses: actions/download-artifact@v8
with:
name: bin-${{ steps.ostag.outputs.ostag }}
path: bin
# execute permissions may not have survived artifact upload/download
- name: Set executable permissions
working-directory: modflow6-examples/etc
run: |
chmod +x "${{ github.workspace }}/bin/mf6"
chmod +x "${{ github.workspace }}/bin/mf5to6"
chmod +x "${{ github.workspace }}/bin/zbud6"
- name: Install dependencies for building models
if: inputs.releasemode == true
working-directory: modflow6-examples/etc
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
pixi run --manifest-path ../../modflow6/pixi.toml pip install -r requirements.pip.txt
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
pixi run --manifest-path ../../modflow6/pixi.toml get-modflow "${{ github.workspace }}/bin" --subset mf2005,triangle,gridgen
- name: Build example models
if: inputs.releasemode == true
working-directory: modflow6-examples/autotest
run: |
models="gwf,gwt,gwe,prt"
pixi run --manifest-path ../../modflow6/pixi.toml pytest -v -n auto test_scripts.py --init -k "${models//,/ or }"
- name: Collect deprecations
working-directory: modflow6/doc/mf6io/mf6ivar
run: |
pixi run collect-deprecations
cat md/deprecations.md
- name: Upload deprecations
uses: actions/upload-artifact@v7
with:
name: deprecations
path: modflow6/doc/mf6io/mf6ivar/md/deprecations.md
- name: Build MF6IO files from DFNs
working-directory: modflow6/doc/mf6io/mf6ivar
run: |
cmd="pixi run run-mf6ivar"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Build documentation
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
mkdir -p "${{ needs.build.outputs.distname }}/doc"
cmd="pixi run --manifest-path modflow6/pixi.toml build-docs -b ../../bin -o ../../doc --force"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
if [[ "${{ inputs.patch }}" == "true" ]]; then
cmd="$cmd --patch"
fi
eval "$cmd"
mv "doc/ReleaseNotes.pdf" "doc/release.pdf"
- name: Upload documentation artifact
uses: actions/upload-artifact@v7
with:
name: doc
path: doc
dist:
name: Build distribution (${{ matrix.os }})
needs:
- build
- docs
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
compiler: ${{ inputs.compiler_toolchain }}
version: ${{ inputs.compiler_version }}
- os: macos-14
compiler: gcc
version: 13
- os: windows-2022
compiler: ${{ inputs.compiler_toolchain }}
version: ${{ inputs.compiler_version }}
extended: false
- os: windows-2022
compiler: ${{ inputs.compiler_toolchain }}
version: ${{ inputs.compiler_version }}
extended: true
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout modflow6
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/modflow6
path: modflow6
ref: ${{ inputs.branch }}
- name: Checkout modflow6-examples
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/modflow6-examples
path: modflow6-examples
- name: Setup ${{ matrix.compiler }} ${{ matrix.version }}
uses: fortran-lang/setup-fortran@v1
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.41.4
manifest-path: "modflow6/pixi.toml"
- name: Custom pixi install
working-directory: modflow6
run: pixi run install
- name: Update version
id: update_version
working-directory: modflow6/distribution
run: |
ver="${{ needs.build.outputs.version }}"
cmd="pixi run update-version -v $ver"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Get OS tag
working-directory: modflow6
id: ostag
run: |
ostag=$(pixi run python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())")
if [[ "${{ matrix.extended }}" == "true" ]]; then
ostag="${ostag}ext"
fi
echo "ostag=$ostag" >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: ${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}
- name: Select artifacts
working-directory: ${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}
run: |
echo "selecting ${{ steps.ostag.outputs.ostag }} artifacts"
# remove dists for other systems
rm -rf ${{ needs.build.outputs.distname }}_*
# remove release notes
rm -rf release_notes
# rename dist bin directory
mv bin-${{ steps.ostag.outputs.ostag }} bin
# remove binaries for other systems
rm -rf bin-*
echo "dist directory contains:"
ls
- name: Build distribution
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
# build distribution
distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
cmd="pixi run --manifest-path modflow6/pixi.toml build-dist -o ../../$distname"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
# rename PDF documents
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
mv "$distname/doc/converter_mf5to6.pdf" "$distname/doc/mf5to6.pdf"
fi
- name: Zip distribution
if: runner.os != 'Windows'
run: |
distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
zip -r $distname.zip \
$distname/bin \
$distname/dfns \
$distname/src \
$distname/srcbmi \
$distname/doc \
$distname/examples \
$distname/make \
$distname/msvs \
$distname/utils \
$distname/code.json \
$distname/meson.build \
$distname/meson.options \
-x '*.DS_Store' \
-x '*libmf6.lib' \
-x '*idmloader*' \
-x '*obj_temp*' \
-x '*mod_temp*'
else
zip -r $distname.zip \
$distname/bin/* \
$distname/dfns \
$distname/doc/mf6io.pdf \
$distname/doc/release.pdf \
$distname/code.json \
-x '*.DS_Store' \
-x '*libmf6.lib' \
-x '*idmloader*' \
-x '*obj_temp*' \
-x '*mod_temp*'
fi
- name: Zip distribution (Windows)
if: runner.os == 'Windows'
run: |
distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
7z a -tzip $distname.zip \
$distname/bin \
$distname/dfns \
$distname/src \
$distname/srcbmi \
$distname/doc \
$distname/examples \
$distname/make \
$distname/msvs \
$distname/utils \
$distname/code.json \
$distname/meson.build \
$distname/meson.options \
-xr!libmf6.lib \
-xr!idmloader \
-xr!obj_temp \
-xr!mod_temp
else
7z a -tzip $distname.zip \
$distname/bin/* \
$distname/dfns \
$distname/doc/mf6io.pdf \
$distname/doc/release.pdf \
$distname/code.json \
-xr!libmf6.lib \
-xr!idmloader \
-xr!obj_temp \
-xr!mod_temp
fi
- name: Upload distribution
uses: actions/upload-artifact@v7
with:
name: "${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
path: "${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}.zip"
- name: Create DFN asset
if: runner.os == 'Linux'
run: |
distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
cd "$distname/dfns"
zip -r "../../${{ needs.build.outputs.distname }}_dfns.zip" .
- name: Upload DFN asset
if: runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: "${{ needs.build.outputs.distname }}_dfns"
path: "${{ needs.build.outputs.distname }}_dfns.zip"
- name: Upload release notes
if: runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: release_notes
path: "${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}/doc/release.pdf"
- name: Check distribution
run: |
# unzip and validate the archive
distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
distfile="$distname.zip"
checkdir="check"
mkdir $checkdir
if [[ "$RUNNER_OS" == "Windows" ]]; then
7z x $distfile -o$checkdir
else
unzip $distfile -d $checkdir
fi
cmd="pixi run --manifest-path modflow6/pixi.toml check-dist --path $checkdir/$distname"
if [[ "${{ inputs.releasemode }}" == "true" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"