Skip to content

fix(caching): fix/simplify cache key #65

fix(caching): fix/simplify cache key

fix(caching): fix/simplify cache key #65

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop*
paths-ignore:
- '**.md'
pull_request:
branches:
- main
- develop
paths-ignore:
- '**.md'
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
gm: [ flopy, standalone ]
owner: [ MODFLOW-USGS ]
repo: [ executables, modflow6, modflow6-nightly-build ]
path: [ absolute, relative, tilde, empty ]
cache: [ 'true', 'false' ]
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install Python dependencies
run: pip install -r test/requirements.txt
- name: Install FloPy
if: matrix.gm == 'flopy'
run: pip install git+https://github.com/modflowpy/flopy.git
- name: Set bin path
if: runner.os != 'Windows'
run: |
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
bindir=""
fi
echo "TEST_BINDIR=$bindir" >> $GITHUB_ENV
- name: Set bin path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
if ("${{ matrix.path }}" -eq "absolute") {
$bindir = "C:\Users\runneradmin\.local\bin"
} elseif ("${{ matrix.path }}" -eq "relative") {
$bindir = "bin"
} elseif ("${{ matrix.path }}" -eq "tilde") {
$bindir = "~/.local/bin"
} else {
$bindir = ""
}
echo "TEST_BINDIR=$bindir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install executables
id: install-executables
uses: ./
with:
path: ${{ env.TEST_BINDIR }}
owner: ${{ matrix.owner }}
repo: ${{ matrix.repo }}
cache: ${{ matrix.cache }}
- name: Test installation
run: |
script_path="$RUNNER_TEMP/get_modflow.py"
if [ "${{ matrix.gm }}" == "standalone" ] && [ "${{ steps.install-executables.outputs.cache-hit }}" != "true" ]
then
if [ -f "$script_path" ]
then
echo "get-modflow script exists: $script_path"
else
echo "get-modflow script missing: $script_path"
exit 1
fi
fi
python test/test.py "$TEST_BINDIR" "${{ matrix.repo }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test_subset:
name: Test subset input
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
subset: [ '', 'mf6,mf2005' ]
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install Python dependencies
run: pip install -r test/requirements.txt
- name: Install FloPy
run: pip install git+https://github.com/modflowpy/flopy.git
- name: Set bin path
if: runner.os != 'Windows'
run: |
bindir=""
echo "TEST_BINDIR=$bindir" >> $GITHUB_ENV
- name: Set bin path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$bindir = ""
echo "TEST_BINDIR=$bindir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install executables
id: install-executables
uses: ./
with:
path: ${{ env.TEST_BINDIR }}
subset: ${{ matrix.subset }}
- name: Test installation
run: |
script_path="$RUNNER_TEMP/get_modflow.py"
python test/test.py "$TEST_BINDIR" "executables" "${{ matrix.subset }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test_tag:
name: Test release tag input
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
tag: [ 'latest', '13.0' ]
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install Python dependencies
run: pip install -r test/requirements.txt
- name: Install FloPy
run: pip install git+https://github.com/modflowpy/flopy.git
- name: Set bin path
if: runner.os != 'Windows'
run: |
bindir=""
echo "TEST_BINDIR=$bindir" >> $GITHUB_ENV
- name: Set bin path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$bindir = ""
echo "TEST_BINDIR=$bindir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install executables
id: install-executables
uses: ./
with:
path: ${{ env.TEST_BINDIR }}
tag: ${{ matrix.tag }}
- name: Test installation
run: |
script_path="$RUNNER_TEMP/get_modflow.py"
python test/test.py "$TEST_BINDIR" "executables"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}