From 215fd799e398ebba5ddaae79fd1d10e9e0eb8ab0 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 31 Oct 2024 15:35:36 -0600 Subject: [PATCH 1/4] CI: Make run-tests accept addtional PyTest arguments Allows us to re-use this action in Siphon. Defaults to what MetPy was using before. --- .github/actions/run-tests/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index ad11c9aa53f..0098a14d040 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -12,6 +12,10 @@ inputs: description: 'Whether to upload coverage report' required: false default: 'true' + pytest-args: + description: 'Additional arguments to pass to pytest' + required: false + default: '-W error::metpy.deprecation.MetpyDeprecationWarning' runs: using: composite steps: @@ -26,7 +30,7 @@ runs: # By running coverage in "parallel" mode and "combining", we can clean up the path names run: | set -e -o pipefail - python -m coverage run -p -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning tests/ 2>&1 | tee tests-${{ inputs.key }}.log + python -m coverage run -p -m pytest --mpl ${{ inputs.pytest-args }} tests/ 2>&1 | tee tests-${{ inputs.key }}.log python -m coverage combine python -m coverage report python -m coverage xml From 329b5475a1576f8ca7ac1b706350f11b8e516335 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 31 Oct 2024 15:49:12 -0600 Subject: [PATCH 2/4] CI: Add support for extra make targets in doc-build This allows us to re-use the action in Siphon. Defaults to what MetPy was doing previously. --- .github/actions/build-docs/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index 824c1767905..bf9ed508b22 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -9,6 +9,10 @@ inputs: description: 'Key to use for artifacts' required: false default: '' + make-targets: + description: 'Extra Makefile targets to build' + required: false + default: 'overridecheck' outputs: doc-version: description: 'What version the docs correspond to' @@ -35,7 +39,7 @@ runs: run: | set -e -o pipefail pushd docs - make overridecheck html O=-W 2>&1 | tee ../build.log && popd || (popd && false) + make ${{ inputs.make-targets }} html O=-W 2>&1 | tee ../build.log && popd || (popd && false) - name: Run link checker # Running linkchecker separately so that we avoid problems with vendored LICENSE From bb4aaac4fec678801d589d86075f9d450c2d8e6c Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 31 Oct 2024 15:57:15 -0600 Subject: [PATCH 3/4] CI: Separate out Cartopy from extras in PyPI setup This allows Siphon to reuse the action. --- .github/actions/install-pypi/action.yml | 6 +++++- .github/workflows/docs.yml | 1 + .github/workflows/tests-pypi.yml | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/actions/install-pypi/action.yml b/.github/actions/install-pypi/action.yml index db05ba94a75..64ddc64eadb 100644 --- a/.github/actions/install-pypi/action.yml +++ b/.github/actions/install-pypi/action.yml @@ -19,6 +19,10 @@ inputs: description: 'Whether to enable old builds for shapely and cartopy' required: false default: 'false' + need-cartopy: + description: 'Whether Cartopy support is needed' + required: false + default: 'false' runs: using: composite @@ -74,7 +78,7 @@ runs: -c ci/${{ inputs.version-file }} -c ci/${{ inputs.type }}_requirements.txt -c ci/extra_requirements.txt - name: Download Cartopy Maps - if: ${{ inputs.need-extras == 'true' }} + if: ${{ inputs.need-cartopy == 'true' }} shell: bash run: ci/download_cartopy_maps.py diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5eca0ec8f94..8806e70b383 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -50,6 +50,7 @@ jobs: type: 'doc' python-version: ${{ matrix.python-version }} need-extras: true + need-cartopy: true - name: Build docs id: build-docs diff --git a/.github/workflows/tests-pypi.yml b/.github/workflows/tests-pypi.yml index fcc1657779d..788d1a66658 100644 --- a/.github/workflows/tests-pypi.yml +++ b/.github/workflows/tests-pypi.yml @@ -76,6 +76,7 @@ jobs: type: 'test' python-version: ${{ matrix.python-version }} old-build: ${{ matrix.no-extras != 'No Extras' && matrix.dep-versions == 'Minimum' }} + need-cartopy: ${{ matrix.no-extras != 'No Extras' }} - name: Run tests uses: ./.github/actions/run-tests From 3e804623ceab6f15d192413dc2c41699670ab31c Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 31 Oct 2024 16:19:14 -0600 Subject: [PATCH 4/4] CI: Make version finding more flexible Use repository name rather than hard-coding MetPy, which allows this action to be re-used in Siphon. Also print out the value since this is often needed in debugging. --- .github/actions/build-docs/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.yml index bf9ed508b22..2a666c2daf4 100644 --- a/.github/actions/build-docs/action.yml +++ b/.github/actions/build-docs/action.yml @@ -27,7 +27,11 @@ runs: - name: Set doc version id: docversion shell: bash -l {0} - run: echo "doc_version=$(python -c 'import metpy,re; print(re.search(r"(\d+\.\d+)", metpy.__version__)[0])')" >> $GITHUB_OUTPUT + run: echo "doc_version=$(python -c 'import importlib.metadata,os,re; print(re.search(r"(\d+\.\d+)", importlib.metadata.version(os.environ["GITHUB_REPOSITORY"].split("/")[-1].lower()))[0])')" >> $GITHUB_OUTPUT + + - name: Show doc version + shell: bash -l {0} + run: echo Building docs for version ${{ steps.docversion.outputs.doc_version }} - name: Build docs shell: bash -l {0}