pyemu continuous integration #1472
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pyemu continuous integration | |
on: | |
schedule: | |
- cron: '0 8 * * *' # run at 8 AM UTC (12 AM PST, 8 PM NZST) | |
push: | |
pull_request: | |
jobs: | |
pyemuCI: | |
name: autotests | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] # , macos-latest] | |
python-version: [3.8, 3.9, "3.10", "3.11"] | |
run-type: [std] | |
test-path: ["."] | |
include: | |
- os: macos-latest | |
python-version: 3.9 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 # checksout this repo | |
- name: Setup Ninja | |
# if: ${{ runner.os == 'Windows' }} | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Set Windows ENV | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
# Setup conda env | |
- name: Install Conda environment using micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: etc/environment.yml | |
environment-name: pyemu | |
create-args: >- | |
python=${{ matrix.python-version }} | |
cache-downloads: true | |
cache-environment: true | |
# Install PEST++ executables TODO: got to be a way of speeding this up/cacheing... | |
- name: PESTPP exe install | |
shell: bash -l {0} | |
run: | | |
if [[ ! -d "$HOME/.local/bin" ]]; then | |
mkdir -p "$HOME/.local/bin"; | |
fi | |
git clone -b develop --depth 1 https://github.com/usgs/pestpp | |
cd pestpp | |
mkdir build && cd build | |
if [[ "$RUNNER_OS" == "Windows" ]]; then | |
cmake -GNinja -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_BUILD_TYPE=Release .. | |
ninja | |
else | |
cmake -DCMAKE_BUILD_TYPE=Release .. | |
make -j2 | |
fi | |
cd .. | |
# do we also need to cp to os specific within .local/bin/? probs... | |
find bin -maxdepth 1 -type f -exec cp {} $HOME/.local/bin/. \; | |
cd .. | |
- name: Install Flopy & pyemu? | |
shell: bash -l {0} | |
run: | | |
pip install https://github.com/modflowpy/flopy/zipball/develop | |
pip install -e . | |
micromamba list | |
- name: Install Modflow executables | |
uses: modflowpy/install-modflow-action@v1 | |
- name: Add executables directory to path | |
shell: bash | |
run: | | |
echo "$MODFLOW_BIN_PATH" >> $GITHUB_PATH | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo $GITHUB_PATH | |
- name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.test-path }} | |
shell: bash -l {0} | |
working-directory: ./autotest | |
run: | | |
pytest -v -n=auto --tb=native --cov=pyemu --cov-report=lcov ${{ matrix.test-path }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test Notebooks | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 }} | |
shell: bash -l {0} | |
working-directory: ./examples | |
run: | | |
micromamba install --name pyemu jupyter jupytext | |
pytest -v -n=auto --nbmake --cov=pyemu --cov-report=lcov:../autotest/coverage.lcov \ | |
--cov-config=../autotest/.coveragerc *.ipynb | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
flag-name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.test-path }} | |
parallel: true | |
path-to-lcov: autotest/coverage.lcov | |
coveralls_finish: | |
needs: pyemuCI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true | |
path-to-lcov: autotest/coverage.lcov |