forked from modflowpy/flopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: test without optional dependencies (modflowpy#1918)
* add nightly matrix to test with some and no optional dependencies * randomly select 3 optional dependencies to test without per day * check crs-related deprecation warnings only if pyproj available * fix markers in test_grid.py and test_export.py * use strict=True with has_pkg()
- Loading branch information
Showing
8 changed files
with
127 additions
and
30 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: FloPy optional dependency testing | ||
on: | ||
schedule: | ||
- cron: '0 8 * * *' # run at 8 AM UTC (12 am PST) | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
timeout-minutes: 10 | ||
env: | ||
PYTHON_VERSION: 3.8 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
optdeps: | ||
# - "all optional dependencies" | ||
- "no optional dependencies" | ||
- "some optional dependencies" | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: 'pip' | ||
cache-dependency-path: pyproject.toml | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install . | ||
pip install ".[test]" | ||
# Install optional dependencies according to matrix.optdeps. | ||
# If matrix.optdeps is "some" remove 3 optional dependencies | ||
# selected randomly using the current date as the seed. | ||
if [[ ! "${{ matrix.optdeps }}" == *"no"* ]]; then | ||
pip install ".[optional]" | ||
fi | ||
if [[ "${{ matrix.optdeps }}" == *"some"* ]]; then | ||
deps=$(sed '/optional =/,/]/!d' pyproject.toml | sed -e '1d;$d' -e 's/\"//g' -e 's/,//g' | tr -d ' ' | cut -f 1 -d ';') | ||
rmvd=$(echo $deps | tr ' ' '\n' | shuf --random-source <(yes date +%d.%m.%y) | head -n 3) | ||
echo "Removing optional dependencies: $rmvd" >> removed_dependencies.txt | ||
cat removed_dependencies.txt | ||
pip uninstall --yes $rmvd | ||
fi | ||
- name: Upload removed dependencies log | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: smoke-test-removed-dependencies | ||
path: ./removed_dependencies.txt | ||
|
||
- name: Install Modflow executables | ||
uses: modflowpy/install-modflow-action@v1 | ||
|
||
- name: Smoke test (${{ matrix.optdeps }}) | ||
working-directory: autotest | ||
run: pytest -v -n=auto --smoke --cov=flopy --cov-report=xml --durations=0 --keep-failed=.failed | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload failed test outputs | ||
uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: failed-smoke-${{ runner.os }}-${{ env.PYTHON_VERSION }} | ||
path: ./autotest/.failed/** | ||
|
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
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
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
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
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
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