Skip to content

Commit

Permalink
Merge branch 'feature/routing-refactor' into feature/d8-routing
Browse files Browse the repository at this point in the history
  • Loading branch information
emlys committed Dec 16, 2024
2 parents 274e61d + 4be31bf commit 8769f9d
Show file tree
Hide file tree
Showing 113 changed files with 16,284 additions and 8,863 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ runs:
cat environment.yml
- name: Setup conda environment
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
environment-name: env
Expand Down
79 changes: 41 additions & 38 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
name: Check for syntax errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.LATEST_SUPPORTED_PYTHON_VERSION }}

Expand All @@ -46,13 +46,13 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
python -m flake8 src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
check-history-rst-syntax:
name: Check HISTORY RST syntax
check-rst-syntax:
name: Check RST syntax
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Set up python
with:
python-version: ${{ env.LATEST_SUPPORTED_PYTHON_VERSION }}
Expand All @@ -63,7 +63,7 @@ jobs:
- name: Lint with doc8
run: |
# Skip line-too-long errors (D001)
python -m doc8 --ignore D001 HISTORY.rst
python -m doc8 --ignore D001 HISTORY.rst README_PYTHON.rst
run-model-tests:
name: Run model tests
Expand All @@ -75,7 +75,7 @@ jobs:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
os: [windows-latest, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for accurate versioning

Expand Down Expand Up @@ -119,35 +119,35 @@ jobs:
run: |
# uninstall InVEST if it was already in the restored cache
python -m pip uninstall -y natcap.invest
python -m build --wheel
NATCAP_INVEST_GDAL_LIB_PATH="$CONDA_PREFIX/Library" python -m build --wheel
ls -la dist
pip install $(find dist -name "natcap.invest*.whl")
- name: Run model tests
run: make test

- name: Upload wheel artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Wheel for ${{ matrix.os }} ${{ matrix.python-version }}
path: dist

- name: Upload conda env artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Conda Env for ${{ matrix.os }} ${{ matrix.python-version }}
path: conda-env.txt

- name: Authenticate GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }}

- name: Set up GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2

- name: Deploy artifacts to GCS
if: github.event_name != 'pull_request'
Expand All @@ -162,15 +162,15 @@ jobs:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
os: [windows-latest, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for accurate versioning

- uses: ./.github/actions/setup_env
with:
python-version: ${{ matrix.python-version }}
requirements-files: requirements.txt
requirements: ${{ env.CONDA_DEFAULT_DEPENDENCIES }}
requirements: ${{ env.CONDA_DEFAULT_DEPENDENCIES }} twine

- name: Build source distribution
run: |
Expand All @@ -180,22 +180,25 @@ jobs:
# .cpp files in addition to the .pyx files.
#
# Elevating any python warnings to errors to catch build issues ASAP.
python -W error -m build --sdist
NATCAP_INVEST_GDAL_LIB_PATH="$CONDA_PREFIX/Library" python -W error -m build --sdist
- name: Install from source distribution
run : |
# Install natcap.invest from the sdist in dist/
pip install $(find dist -name "natcap[._-]invest*")
NATCAP_INVEST_GDAL_LIB_PATH="$CONDA_PREFIX/Library" pip install $(find dist -name "natcap[._-]invest*")
# Model tests should cover model functionality, we just want
# to be sure that we can import `natcap.invest` here.
# The point here is to make sure that we can build
# natcap.invest from source and that it imports.
python -c "from natcap.invest import *"
- uses: actions/upload-artifact@v3
- name: Check long description with twine
run: twine check $(find dist -name "natcap[._-]invest*")

- uses: actions/upload-artifact@v4
with:
name: Source distribution
name: Source distribution ${{ matrix.os }} ${{ matrix.python-version }}
path: dist

# Secrets not available in PR so don't use GCP.
Expand All @@ -204,13 +207,13 @@ jobs:
# different extensions)
- name: Authenticate GCP
if: github.event_name != 'pull_request' && matrix.os == 'macos-13' && matrix.python-version == env.LATEST_SUPPORTED_PYTHON_VERSION
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }}

- name: Set up GCP
if: github.event_name != 'pull_request' && matrix.os == 'macos-13' && matrix.python-version == env.LATEST_SUPPORTED_PYTHON_VERSION
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2

- name: Deploy artifacts to GCS
if: github.event_name != 'pull_request' && matrix.os == 'macos-13' && matrix.python-version == env.LATEST_SUPPORTED_PYTHON_VERSION
Expand All @@ -221,7 +224,7 @@ jobs:
runs-on: windows-latest
needs: check-syntax-errors
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for accurate versioning

Expand All @@ -232,7 +235,7 @@ jobs:
requirements: ${{ env.CONDA_DEFAULT_DEPENDENCIES }} pytest

- name: Make install
run: make install
run: NATCAP_INVEST_GDAL_LIB_PATH="$CONDA_PREFIX/Library" make install

- name: Validate sample data
run: make validate_sampledata
Expand All @@ -252,7 +255,7 @@ jobs:

steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for accurate versioning

Expand All @@ -264,7 +267,7 @@ jobs:
requirements: ${{ env.CONDA_DEFAULT_DEPENDENCIES }}

- name: Make install
run: make install
run: NATCAP_INVEST_GDAL_LIB_PATH="$CONDA_PREFIX/Library" make install

- name: Set up node
uses: actions/setup-node@v3
Expand Down Expand Up @@ -309,7 +312,7 @@ jobs:
workspace-path: ${{ github.workspace }}
binary-extension: exe
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for accurate versioning

Expand All @@ -325,7 +328,7 @@ jobs:
requirements: ${{ env.CONDA_DEFAULT_DEPENDENCIES }} pandoc

- name: Make install
run: make install
run: NATCAP_INVEST_GDAL_LIB_PATH="$CONDA_PREFIX/Library" make install

# Not caching chocolatey packages because the cache may not be reliable
# https://github.com/chocolatey/choco/issues/2134
Expand Down Expand Up @@ -366,13 +369,13 @@ jobs:
- name: Authenticate GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }}

- name: Set up GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2

- name: Build Workbench (PRs)
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -441,20 +444,20 @@ jobs:

- name: Upload workbench binary artifact
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Workbench-${{ runner.os }}-binary
path: workbench/dist/*.${{ matrix.binary-extension }}

- name: Upload user's guide artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InVEST-user-guide
path: dist/InVEST_*_userguide.zip

- name: Upload workbench logging from puppeteer
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ runner.os }}_puppeteer_log.zip'
Expand All @@ -473,7 +476,7 @@ jobs:

- name: Upload workspace on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InVEST-failed-${{ runner.os }}-workspace
path: ${{ matrix.workspace-path}}
Expand All @@ -483,11 +486,11 @@ jobs:
needs: check-syntax-errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch complete history for accurate versioning

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.LATEST_SUPPORTED_PYTHON_VERSION }}

Expand All @@ -498,20 +501,20 @@ jobs:
- run: make sampledata sampledata_single

- name: Upload sample data artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InVEST-sample-data
path: dist/*.zip

- name: Authenticate GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }}

- name: Set up GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2

- name: Deploy artifacts to GCS
if: github.event_name != 'pull_request'
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/release-part-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,24 @@ jobs:
perl -0777 -i -pe \
"s/Unreleased Changes\n------------------/..\n Unreleased Changes\n ------------------\n\n${HEADER}\n${UNDERLINE}/g" \
HISTORY.rst
- name: Install dependencies
run: pip install rst2html5

- name: Generate changelog.html
run: rst2html5 HISTORY.rst workbench/changelog.html

- name: Update package.json version
uses: BellCubeDev/update-package-version-by-release-tag@v2
with:
version: ${{ inputs.version }}
package-json-path: workbench/package.json

- name: Commit updated HISTORY.rst, changelog.html, and package.json
run: |
git add HISTORY.rst
git add workbench/changelog.html
git add workbench/package.json
git commit -m "Committing the $VERSION release."
- name: Tag and push
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-part-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
twine upload \
--username="__token__" \
--password=${{ secrets.PYPI_NATCAP_INVEST_TOKEN }} \
artifacts/natcap.invest*
artifacts/natcap.invest* artifacts/natcap_invest*
- name: Roll back on failure
if: failure()
Expand Down
Loading

0 comments on commit 8769f9d

Please sign in to comment.