Skip to content

Commit 491ace9

Browse files
committed
ci: add provisional build, remove unused scripts (#35)
1 parent 4fb34f9 commit 491ace9

File tree

5 files changed

+157
-27
lines changed

5 files changed

+157
-27
lines changed

.github/workflows/provisional.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: Provisional distribution
2+
on:
3+
# schedule:
4+
# - cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
5+
push:
6+
branches:
7+
- develop
8+
jobs:
9+
build:
10+
name: Build provisional distribution
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-20.04, macos-12, windows-2022]
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@v3
23+
24+
- name: Setup Intel Fortran
25+
uses: modflowpy/install-intelfortran-action@v1
26+
27+
# - name: Setup Intel Fortran
28+
# uses: awvwgk/setup-fortran@main
29+
# with:
30+
# compiler: intel-classic
31+
# version: 2021.7.0
32+
33+
- name: Setup Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: 3.9
37+
38+
- name: Install Python dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install https://github.com/modflowpy/pymake/zipball/master
42+
pip install modflow-devtools
43+
pip list
44+
45+
- name: Get OS tag
46+
id: get-ostag
47+
shell: python
48+
run: |
49+
from os import environ
50+
from modflow_devtools.ostags import get_modflow_ostag
51+
with open(environ.get("GITHUB_OUTPUT"), "a") as f:
52+
f.write(f"ostag={get_modflow_ostag()}")
53+
54+
- name: Get date
55+
uses: josStorer/get-current-time@v2
56+
id: current-time
57+
with:
58+
format: YYYYMMDD
59+
60+
- name: Get short SHA
61+
uses: benjlevesque/[email protected]
62+
id: short-sha
63+
64+
- name: Get exe name
65+
id: exe-name
66+
run: echo "name=mp7_${{ steps.get-ostag.outputs.ostag }}_${{ steps.current-time.outputs.formattedTime }}_${{ steps.short-sha.outputs.sha }}" >> $GITHUB_OUTPUT
67+
68+
- name: Build executable
69+
if: runner.os != 'Windows'
70+
run: mfpymake source ${{ steps.exe-name.outputs.name }} -ad msvs/bin_PROVISIONAL -fc ifort
71+
72+
- name: Build executable (Windows)
73+
if: runner.os == 'Windows'
74+
shell: cmd
75+
run: mfpymake source ${{ steps.exe-name.outputs.name }}.exe -ad msvs\bin_PROVISIONAL -fc ifort
76+
77+
- name: Upload executable
78+
if: runner.os != 'Windows'
79+
uses: actions/upload-artifact@v3
80+
with:
81+
name: ${{ steps.exe-name.outputs.name }}
82+
path: msvs/bin_PROVISIONAL/${{ steps.exe-name.outputs.name }}
83+
84+
- name: Upload executable (Windows)
85+
if: runner.os == 'Windows'
86+
uses: actions/upload-artifact@v3
87+
with:
88+
name: ${{ steps.exe-name.outputs.name }}
89+
path: msvs/bin_PROVISIONAL/${{ steps.exe-name.outputs.name }}.exe
90+
91+
commit:
92+
name: Commit and push executable
93+
# if: github.repository_owner == 'MODFLOW-USGS'
94+
needs: build
95+
runs-on: ubuntu-22.04
96+
permissions:
97+
contents: write
98+
defaults:
99+
run:
100+
shell: bash
101+
steps:
102+
103+
- name: Checkout repo
104+
uses: actions/checkout@v3
105+
106+
- name: Remove old binaries
107+
working-directory: msvs/bin_PROVISIONAL
108+
if: runner.os == 'Linux'
109+
run: rm -rf mp7*
110+
111+
- name: Download binaries
112+
uses: actions/download-artifact@v3
113+
with:
114+
path: msvs/bin_PROVISIONAL
115+
116+
- name: Get short SHA
117+
uses: benjlevesque/[email protected]
118+
id: short-sha
119+
120+
- name: Commit and push
121+
working-directory: msvs/bin_PROVISIONAL
122+
if: runner.os == 'Linux'
123+
run: |
124+
# configure git
125+
git config core.sharedRepository true
126+
git config user.name "github-actions[bot]"
127+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
128+
129+
echo "shortening nested dir names"
130+
date=$(date +%Y%m%d)
131+
find mp7* -type d | sed -e "p;s/_$date.*$//" | xargs -n2 mv
132+
133+
echo "moving exes to top-level bin dir"
134+
for file in mp7*/*; do
135+
mv $file $(basename $file)
136+
done
137+
138+
echo "removing empty nested dirs"
139+
find mp7* -type d -delete
140+
141+
# commit and push
142+
git add .
143+
git commit -m "add binaries built from ${{ github.sha }}"
144+
git push origin "${{ github.ref_name }}"

msvs/bin_PROVISIONAL/README_provisional.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ the condition that neither the USGS nor the U.S. Government shall be held
88
liable for any damages resulting from the authorized or unauthorized use of
99
the software.
1010

11-
The preliminary executable code is provided temporarily for evaluation purposes
12-
as a courtesy to users who are unable to compile the source code. Only a 64-bit
13-
Windows executable is provided. The name of the executable file references
14-
the MODPATH 7 github repository commit number on which the executable is
15-
based. The executable will not necessarily be updated after every commit.
11+
The provisional executable codes are provided temporarily for evaluation purposes
12+
as a courtesy to users who are unable to compile the source code. An executable
13+
compiled for a specific operating system might not be compatible with all
14+
distributions of that operating system. In such cases, we ask that users please
15+
work through any compatibility issues related to compilation. If there is evidence
16+
of a problem with the source code, please report it as an issue on this repository.
17+
18+
The name of an executable file includes the operating system for which is compiled,
19+
date it was generated, and the "develop" branch commit it is based on. For example,
20+
the name "mp7_win64_20230816_dbe916c" indicates that the executable is for 64-bit
21+
Windows and was generated on 2023-08-16 using source code from commit dbe916c.
22+
If there are multiple executables for a given operating system, the most recent
23+
for that operating system is the one with the most recent date and commit number.
-1.77 MB
Binary file not shown.

pymake/makebin.bat

Lines changed: 0 additions & 3 deletions
This file was deleted.

pymake/makebin.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)