From aa272cf5dc55dd875d31003a226920c7502e169a Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:23:47 +0100 Subject: [PATCH] CI: add scheduled testing against nightlies --- .github/workflows/ci-testing.yml | 62 +++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 88368e4e0..b5d59cbd4 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -1,6 +1,12 @@ name: Tests -on: [push, pull_request] +on: + push: + pull_request: + schedule: + # 10th of each month + - cron: "0 0 10 * *" + workflow_dispatch: jobs: build: @@ -12,13 +18,8 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [3.9, '3.10', '3.11', '3.12'] - shapely-dev: [false] use-network: [true] include: - - os: ubuntu-latest - python-version: '3.11' - shapely-dev: true - use-network: true - os: ubuntu-latest python-version: '3.11' use-network: false @@ -35,28 +36,30 @@ jobs: cache: 'pip' - name: Minimum packages - if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' + if: | + matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' && + (github.event_name == 'push' || github.event_name == 'pull_request') id: minimum-packages run: | pip install cython==0.29.24 matplotlib==3.5.3 numpy==1.21 owslib==0.24.1 pyproj==3.3.1 scipy==1.6.3 shapely==1.7.1 pyshp==2.3.1 - name: Coverage packages id: coverage - # only want the coverage to be run on the latest ubuntu - if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' + # only want the coverage to be run on the latest ubuntu and for code changes i.e. push and pr + if: | + matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && + (github.event_name == 'push' || github.event_name == 'pull_request') run: | echo "CYTHON_COVERAGE=1" >> $GITHUB_ENV # Also add doctest here to avoid windows runners which expect a different path separator echo "EXTRA_TEST_ARGS=--cov=cartopy -ra --doctest-modules" >> $GITHUB_ENV pip install cython - - name: Install Shapely dev - if: matrix.shapely-dev + - name: Install Nightlies + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' run: | - # Install Shapely from source on ubuntu - sudo apt-get update - sudo apt-get install -yy libgeos-dev - pip install git+https://github.com/shapely/shapely.git@main + # Install Nightly builds from Scientific Python + python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple matplotlib scipy shapely - name: Install Cartopy id: install @@ -108,5 +111,30 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: image-failures-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.shapely-dev }} - path: cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.shapely-dev }} + name: image-failures-${{ matrix.os }}-${{ matrix.python-version }} + path: cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }} + + # Separate dependent job to only upload one issue from the matrix of jobs + create-issue: + if: ${{ failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} + needs: [build] + permissions: + issues: write + runs-on: ubuntu-latest + name: Create issue on failure + + steps: + - name: Create issue on failure + uses: imjohnbo/issue-bot@v3 + with: + title: "[TST] Upcoming dependency test failures" + body: | + The build with nightly wheels from matplotlib, scipy, shapely and their + dependencies has failed. Check the logs for any updates that need to be + made in cartopy. + https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + + pinned: false + close-previous: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}