Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
refactor: misc
Browse files Browse the repository at this point in the history
* move inline install scripts back to files
* make steps cross-platform where possible
* replace set-output mechanism (soon deprecated)
* test compile on bash, cmd and pwsh on Windows
* save cache after install even if workflow fails
* set env vars for HPC kit, FC and install location
* add conventional commits to README and CONTRIBUTING
* fix cache restore issue on windows
* prepend MSVC linker bindir to system path
* don't use GNU tar on Windows (can't unpack symlinks)
* workaround libimf.so missing issue on Linux
* make install location configurable
* resolve relative paths and expand symlinks
  • Loading branch information
wpbonelli committed Oct 22, 2022
1 parent a180936 commit 9430643
Show file tree
Hide file tree
Showing 12 changed files with 475 additions and 260 deletions.
109 changes: 52 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
branches:
- main
- develop
env:
FC: ifort
jobs:
test:
name: Test
Expand All @@ -16,74 +18,67 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
path: [ absolute, relative, tilde, default ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install ifort
uses: ./
- name: Test ifort
- name: Set bin path
if: runner.os != 'Windows'
run: |
./test/test.sh /opt/intel/oneapi
- name: Test ifort (Windows)
if [ "${{ matrix.path }}" == "absolute" ]; then
bindir="$HOME/.local/bin"
elif [ "${{ matrix.path }}" == "relative" ]; then
bindir="bin"
elif [ "${{ matrix.path }}" == "tilde" ]; then
bindir="~/.local/bin"
else
# action's default location
bindir="~/.local/bin/ifort"
fi
echo "TEST_BINDIR=$bindir" >> $GITHUB_ENV
- name: Set bin path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
./test/test.ps1 "C:\Program Files (x86)\Intel\oneAPI"
test_compile_modflow:
name: Test compile modflow6
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
env: [ pip, miniconda, micromamba ]
defaults:
run:
shell:
bash -l {0}
steps:
- name: Checkout action
uses: actions/checkout@v3
- name: Checkout modflow6
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6
path: modflow6
if ("${{ matrix.path }}" -eq "absolute") {
# $bindir = "C:\Users\runneradmin\.local\bin"
$bindir = "C:\Program Files (x86)\Intel\oneAPI"
} elseif ("${{ matrix.path }}" -eq "relative") {
$bindir = "bin"
} elseif ("${{ matrix.path }}" -eq "tilde") {
$bindir = "~/.local/bin"
} else {
# actions's default location
$bindir = "~/.local/bin/ifort"
}
echo "TEST_BINDIR=$bindir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install ifort
if: matrix.path != 'default'
uses: ./
- name: Setup Python
if: matrix.env == 'pip'
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Python dependencies
if: matrix.env == 'pip'
run: |
pip3 install -r test/requirements.txt
- name: Install miniconda environment
if: matrix.env == 'miniconda'
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: modflow6/environment.yml
- name: Install micromamba environment
if: matrix.env == 'micromamba'
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: modflow6/environment.yml
cache-downloads: true
cache-env: true
- name: Build modflow6
path: ${{ env.TEST_BINDIR }}
- name: Install ifort
if: matrix.path == 'default'
uses: ./
- name: Test ifort (Linux & Mac)
if: runner.os != 'Windows'
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson compile -v -C builddir
meson install -C builddir
- name: Build modflow6 (Windows)
./test/test.sh ${{ env.TEST_BINDIR }}
# TODO: reenable if ifort configuration for bash resolved on Windows
# - name: Test ifort (Windows bash)
# if: runner.os == 'Windows'
# shell: bash
# run: |
# ./test/test.sh "${{ env.TEST_BINDIR }}"
- name: Test ifort (Windows pwsh)
if: runner.os == 'Windows'
shell: pwsh
run: |
./test/test.ps1 "${{ env.TEST_BINDIR }}"
- name: Test ifort (Windows cmd)
if: runner.os == 'Windows'
working-directory: modflow6
shell: cmd
run: |
export PATH="/C/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64":$PATH
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson compile -v -C builddir
meson install -C builddir
call "./test/test.bat"
92 changes: 92 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: MODFLOW 6 integration testing
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
schedule:
- cron: '0 6 * * *' # run at 6 AM UTC every day
jobs:
test_build_modflow:
name: Test build modflow6
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
env: [ pip, miniconda, micromamba ]
defaults:
run:
shell:
# necessary for miniconda and micromamba
# https://github.com/mamba-org/provision-with-micromamba#important
bash -l {0}
steps:
- name: Checkout action
uses: actions/checkout@v3
- name: Checkout modflow6
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6
path: modflow6
- name: Setup Python
if: matrix.env == 'pip'
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Python dependencies
if: matrix.env == 'pip'
run: |
pip3 install -r test/requirements.txt
- name: Install miniconda environment
if: matrix.env == 'miniconda'
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: modflow6/environment.yml
- name: Install micromamba environment
if: matrix.env == 'micromamba'
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: modflow6/environment.yml
cache-downloads: true
cache-env: true
- name: Install ifort
uses: ./
with:
path: ${{ runner.os != 'Windows' && 'bin' || 'C:\Program Files (x86)\Intel\oneAPI' }}
- name: Build modflow6 (Linux & Mac)
if: runner.os != 'Windows'
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson compile -v -C builddir
meson install -C builddir
- name: Add micromamba bindir to path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$mamba_bin = "C:\Users\runneradmin\micromamba-root\envs\modflow6\Scripts"
if (Test-Path $mamba_bin) {
# ifort/micromamba interfere with one another's PATH settings
echo $mamba_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
- name: Build modflow6 (Windows pwsh)
if: runner.os == 'Windows'
working-directory: modflow6
shell: pwsh
run: |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson compile -v -C builddir
meson install -C builddir
- name: Build modflow6 (Windows cmd)
if: runner.os == 'Windows'
working-directory: modflow6
shell: cmd /C call {0}
run: |
meson setup builddir -Ddebug=false --prefix=%CD% --libdir=bin
meson compile -v -C builddir
meson install -C builddir
49 changes: 28 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Contributing](#contributing)
- [Issues and features](#issues-and-features)
- [Pull requests](#pull-requests)
- [Commit messages](#commit-messages)
- [Commit Message Format](#commit-message-format)
- [Type](#type)
- [Subject](#subject)
- [Body](#body)
- [Footer](#footer)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Contributing

Contributions to this repository are welcome. To make a contribution we ask that you follow a few guidelines.
Expand All @@ -16,9 +32,11 @@ If `develop` changes while your work is still in progress, please rebase and fix

## Commit messages

To keep the repository's commit history consistent, commit messages must conform to the following formatting conventions.
Commit messages must conform to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This makes the commit history easier to follow and allows an automatically generated changelog.

### Commit Message Format

Each commit message consists of a **header**, a **body** and a **footer**. The header includes a **type**, a **scope** and a **subject**:
Each commit message consists of a **header**, a **body** and a **footer**. The **header** is mandatory, while **body** and **footer** are optional.

```
<type>(<scope>): <subject>
Expand All @@ -28,11 +46,13 @@ Each commit message consists of a **header**, a **body** and a **footer**. The
<footer>
```

The **header** is mandatory and its **scope** is optional. The message **body** and **footer** are also optional.
Note the header's format, which includes a **type**, a **scope** and a **subject**. Header **type** and **subject** are mandatory while header **scope** is optional.

No line of the commit message may be longer 100 characters! This makes messages easier to read on GitHub as well as in various `git` tools.

Please keep lines under 100 characters.
If a commit closes an issue, the footer should contain a [closing reference](https://help.github.com/articles/closing-issues-via-commit-messages/).

### Type
#### Type

Must be one of the following:

Expand All @@ -46,33 +66,20 @@ Must be one of the following:
* **test**: Adding missing tests or correcting existing tests
* **revert**: Reverts a previous commit

### Scope
The scope should be the name of the FloPy module/class affected (as perceived by the person reading the changelog generated from commit messages.

There are currently a few exceptions to the "use module/class name" rule:

* **release**: used when updating files prior to a release
* **releasenotes**: used for updating the release notes
* **readme**: used for updating the release notes in README.md
* **changelog**: used for updating the release notes in CHANGELOG.md
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all
packages (e.g. `style: add missing semicolons`) and for docs changes that are not related to a
specific package (e.g. `docs: fix typo in tutorial`).

### Subject
#### Subject

The subject contains a succinct description of the change:

* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* do not include a dot (.) at the end

### Body
#### Body

Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.

### Footer
#### Footer

The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**.

Expand Down
Loading

0 comments on commit 9430643

Please sign in to comment.