Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autotest failures on main #1627

Merged
merged 12 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 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 @@ -50,9 +50,9 @@ jobs:
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 @@ -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 @@ -127,27 +127,27 @@ jobs:
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,7 +162,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 @@ -196,9 +196,9 @@ jobs:
- name: Check long description with twine
run: twine check $(find dist -name "natcap[._-]invest*")

- uses: actions/upload-artifact@v3
- 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 @@ -207,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 @@ -224,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 Down Expand Up @@ -255,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 Down Expand Up @@ -312,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 Down Expand Up @@ -369,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 @@ -444,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 @@ -476,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 @@ -486,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 @@ -501,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
2 changes: 1 addition & 1 deletion constraints_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ GDAL<3.8.5
# Pyinstaller 6.10 breaks our windows builds. Until we can figure out the
# root cause, let's cap the versions to those that work.
# https://github.com/natcap/invest/issues/1622
pyinstaller<6.10
#pyinstaller<6.10
5 changes: 1 addition & 4 deletions exe/hooks/rthook.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import sys
import os
import multiprocessing
import platform

multiprocessing.freeze_support()
import sys

os.environ['PROJ_LIB'] = os.path.join(sys._MEIPASS, 'proj')

Expand Down
6 changes: 6 additions & 0 deletions src/natcap/invest/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import multiprocessing
import sys

# We want to guarantee that this is called BEFORE any other processes start,
# which could happen at import time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If another process was starting at import time, would that be an indication that the code starting that process belongs under an if __name__ == '__main__' ? Maybe it's outside of our control though?

if __name__ == '__main__':
multiprocessing.freeze_support()

from . import cli

if __name__ == '__main__':
Expand Down
Loading