From 69cb07c51951dd54b22565658816079b6dcc8bfb Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 28 Mar 2023 15:57:30 -0400 Subject: [PATCH 01/23] update ubuntu image names, add `XCLIM_TESTDATA_BRANCH` to upstream.yml --- .github/workflows/bump-version.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/first_pull_request.yml | 2 +- .github/workflows/label.yml | 2 +- .github/workflows/label_on_approval.yml | 2 +- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/tag-testpypi.yml | 2 +- .github/workflows/upstream.yml | 3 +++ 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index a75adc75c..b39c61c7a 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -26,7 +26,7 @@ on: jobs: bump_patch_version: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3e9fa98f6..d15b3b928 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,7 +23,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: actions: read contents: read diff --git a/.github/workflows/first_pull_request.yml b/.github/workflows/first_pull_request.yml index 5b7adebe2..ac823fbf7 100644 --- a/.github/workflows/first_pull_request.yml +++ b/.github/workflows/first_pull_request.yml @@ -5,7 +5,7 @@ on: jobs: welcome: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/github-script@v6 with: diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 207319d15..14f5ab4a0 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -11,7 +11,7 @@ on: jobs: label: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/labeler@v4 with: diff --git a/.github/workflows/label_on_approval.yml b/.github/workflows/label_on_approval.yml index 55ca95b8d..6b11a9798 100644 --- a/.github/workflows/label_on_approval.yml +++ b/.github/workflows/label_on_approval.yml @@ -8,7 +8,7 @@ on: jobs: approved: if: github.event.review.state == 'approved' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/github-script@v6 with: diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 08bce61c4..2ff86ca4d 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -8,7 +8,7 @@ on: jobs: build-n-publish-pypi: name: Build and publish Python 🐍 distributions 📦 to PyPI - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python3 diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index 8c417cabf..bd8da44c6 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -8,7 +8,7 @@ on: jobs: build-n-publish-testpypi: name: Build and publish Python 🐍 distributions 📦 to TestPyPI - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python3 diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 7fe0c86fd..9cb81dc94 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -17,6 +17,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + XCLIM_TESTDATA_BRANCH: main + jobs: upstream-dev: name: test-upstream-dev (Python${{ matrix.python-version }}) From 10ad67d61d711642056dba4643cfd83887747de1 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 10:15:19 -0400 Subject: [PATCH 02/23] WIP add testing data workflow --- .github/workflows/testdata_version.yml | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/testdata_version.yml diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml new file mode 100644 index 000000000..c82aa0904 --- /dev/null +++ b/.github/workflows/testdata_version.yml @@ -0,0 +1,28 @@ +name: "Update Testing Data Tag" + +on: + pull_request: + types: + - opened + - reopened + - synchronize +# paths: +# - .github/workflows/main.yml +# - .github/workflows/upstream.yml + +jobs: + use-latest-tag: + name: Use Latest Testing Data + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set latest testing data tag + run: | + TAG=( \ + git -c 'versionsort.suffix=-' \ + ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/Ouranosinc/xclim '*.*.*' \ + | tail --lines=1 \ + | cut --delimiter='/' --fields=3) + echo "TAG=${TAG}" >> $GITHUB_ENV + - name: Report tag + run: echo $TAG From a2144af50e0a95d28734575d4660a60c7d8a8cc6 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 10:49:20 -0400 Subject: [PATCH 03/23] fix command call --- .github/workflows/testdata_version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index c82aa0904..03bed0b02 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -18,11 +18,11 @@ jobs: - uses: actions/checkout@v3 - name: Set latest testing data tag run: | - TAG=( \ + TAG="$( \ git -c 'versionsort.suffix=-' \ ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/Ouranosinc/xclim '*.*.*' \ | tail --lines=1 \ - | cut --delimiter='/' --fields=3) + | cut --delimiter='/' --fields=3)" echo "TAG=${TAG}" >> $GITHUB_ENV - name: Report tag run: echo $TAG From 72c1ddd79d7fcf3278dde0daff09d5eb9a89fd44 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 12:26:27 -0400 Subject: [PATCH 04/23] report testing data used in main.yml --- .github/workflows/testdata_version.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 03bed0b02..d97fb98ac 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -26,3 +26,9 @@ jobs: echo "TAG=${TAG}" >> $GITHUB_ENV - name: Report tag run: echo $TAG + - name: Gather CI Test Data Version + run: | + TESTDATA_CI="$(grep -E "XCLIM_TESTDATA_BRANCH" .github/workflows/main.yml | cut -d ' ' -f4)" + echo "TESTDATA_CI=${TESTDATA_CI}" >> $GITHUB_EN + - name: Report Testing Data in CI + run: echo $TESTDATA_CI From 67498906acc2ff0efd5609da68308d9652f2aa27 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 12:26:45 -0400 Subject: [PATCH 05/23] split run calls for legibility --- .github/workflows/bump-version.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index b39c61c7a..c5004da51 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -39,12 +39,15 @@ jobs: git config --local user.email "bumpversion[bot]@ouranos.ca" git config --local user.name "bumpversion[bot]" - name: Current Version - run: echo "current_version=$(grep -E '__version__' xclim/__init__.py | cut -d ' ' -f3)" + run: | + CURRENT_VERSION="$(grep -E '__version__' xclim/__init__.py | cut -d ' ' -f3)" + echo "current_version=${CURRENT_VERSION}" - name: Bump Patch Version run: | pip install bump2version echo "running `bump2version patch`" - echo "new_version=$(grep -E '__version__' xclim/__init__.py | cut -d ' ' -f3)" + NEW_VERSION="$(grep -E '__version__' xclim/__init__.py | cut -d ' ' -f3)" + echo "new_version=${NEW_VERSION}" - name: Push Changes uses: ad-m/github-push-action@master with: From 3d8a73c3934d8eef3eb3ec9d0a5689439a095921 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 13:49:36 -0400 Subject: [PATCH 06/23] add comment actions for testdata warnings --- .github/workflows/testdata_version.yml | 42 ++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index d97fb98ac..5b1177ff5 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -8,7 +8,6 @@ on: - synchronize # paths: # - .github/workflows/main.yml -# - .github/workflows/upstream.yml jobs: use-latest-tag: @@ -29,6 +28,45 @@ jobs: - name: Gather CI Test Data Version run: | TESTDATA_CI="$(grep -E "XCLIM_TESTDATA_BRANCH" .github/workflows/main.yml | cut -d ' ' -f4)" - echo "TESTDATA_CI=${TESTDATA_CI}" >> $GITHUB_EN + echo "TESTDATA_CI=${TESTDATA_CI}" >> $GITHUB_ENV - name: Report Testing Data in CI run: echo $TESTDATA_CI + - name: Find Comment + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: | + > **Warning** + - name: Check Versions + if: ( ${{ env.TAG }} == ${{ env.TESTDATA_CI }} ) + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Configured `xclim-testdata` tag is not the latest.') + - name: Update Failure Comment + if: ${{ failure() }} + uses: peter-evans/create-or-update-comment@v2 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + > **Warning** + > It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch to a tag that is not the latest in the repository. + + Please make sure to modify this value to match the latest tag before merging. + If this PR depends on a new testing dataset, be sure to tag a new version of `Ouranosinc/xclim-testdata` with your changes merged to `main`. + edit-mode: replace + - name: Update Success Comment + if: ${{ success() }} + uses: peter-evans/create-or-update-comment@v2 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + > **Warning** + > It appears that this PR updates the `Ouranosinc/xclim-testdata` branch to the most recent tag. + + No further action is required. + edit-mode: replace From 8d2a0bd600dce7e611737831b6dcc64b9e4892ce Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 14:01:18 -0400 Subject: [PATCH 07/23] adjustments --- .github/workflows/testdata_version.yml | 28 ++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 5b1177ff5..52d7c2004 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -19,18 +19,24 @@ jobs: run: | TAG="$( \ git -c 'versionsort.suffix=-' \ - ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/Ouranosinc/xclim '*.*.*' \ + ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/Ouranosinc/xclim-testdata '*.*.*' \ | tail --lines=1 \ | cut --delimiter='/' --fields=3)" echo "TAG=${TAG}" >> $GITHUB_ENV - - name: Report tag - run: echo $TAG - name: Gather CI Test Data Version run: | TESTDATA_CI="$(grep -E "XCLIM_TESTDATA_BRANCH" .github/workflows/main.yml | cut -d ' ' -f4)" echo "TESTDATA_CI=${TESTDATA_CI}" >> $GITHUB_ENV - - name: Report Testing Data in CI - run: echo $TESTDATA_CI + - name: Report Versions Found + run: | + echo "Latest xclim-testdata tag: ${{ env.TAG }}" + echo "Tag for xclim-testdata in CI: ${{ env.TESTDATA_CI }}" + - name: Compare Versions + if: ( ${{ env.TAG }} == ${{ env.TESTDATA_CI }} ) + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Configured `xclim-testdata` tag is not `latest`.') - name: Find Comment uses: peter-evans/find-comment@v2 id: fc @@ -39,12 +45,6 @@ jobs: comment-author: 'github-actions[bot]' body-includes: | > **Warning** - - name: Check Versions - if: ( ${{ env.TAG }} == ${{ env.TESTDATA_CI }} ) - uses: actions/github-script@v6 - with: - script: | - core.setFailed('Configured `xclim-testdata` tag is not the latest.') - name: Update Failure Comment if: ${{ failure() }} uses: peter-evans/create-or-update-comment@v2 @@ -55,7 +55,7 @@ jobs: > **Warning** > It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch to a tag that is not the latest in the repository. - Please make sure to modify this value to match the latest tag before merging. + Please make sure to modify this value to match the latest tag (`${{ env.TAG }}`) before merging. If this PR depends on a new testing dataset, be sure to tag a new version of `Ouranosinc/xclim-testdata` with your changes merged to `main`. edit-mode: replace - name: Update Success Comment @@ -66,7 +66,5 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | > **Warning** - > It appears that this PR updates the `Ouranosinc/xclim-testdata` branch to the most recent tag. - - No further action is required. + > It appears that this PR updates the `Ouranosinc/xclim-testdata` branch to the most recent tag. No further action is required. edit-mode: replace From efe14af4b735d8a8585fc9dcf48e835448199575 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 14:18:02 -0400 Subject: [PATCH 08/23] adjustments --- .github/workflows/testdata_version.yml | 36 ++++++++++++-------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 52d7c2004..345a532e0 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -15,36 +15,33 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set latest testing data tag + - name: Find xclim-testdata Tag and CI Testing Branch run: | - TAG="$( \ + XCLIM_TESTDATA_TAG="$( \ git -c 'versionsort.suffix=-' \ ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/Ouranosinc/xclim-testdata '*.*.*' \ | tail --lines=1 \ | cut --delimiter='/' --fields=3)" - echo "TAG=${TAG}" >> $GITHUB_ENV - - name: Gather CI Test Data Version - run: | - TESTDATA_CI="$(grep -E "XCLIM_TESTDATA_BRANCH" .github/workflows/main.yml | cut -d ' ' -f4)" - echo "TESTDATA_CI=${TESTDATA_CI}" >> $GITHUB_ENV + echo "XCLIM_TESTDATA_TAG=${XCLIM_TESTDATA_TAG}" >> $GITHUB_ENV + XCLIM_TESTDATA_BRANCH="$(grep -E "XCLIM_TESTDATA_BRANCH" .github/workflows/main.yml | cut -d ' ' -f4)" + echo "XCLIM_TESTDATA_BRANCH=${XCLIM_TESTDATA_BRANCH}" >> $GITHUB_ENV - name: Report Versions Found run: | - echo "Latest xclim-testdata tag: ${{ env.TAG }}" - echo "Tag for xclim-testdata in CI: ${{ env.TESTDATA_CI }}" - - name: Compare Versions - if: ( ${{ env.TAG }} == ${{ env.TESTDATA_CI }} ) - uses: actions/github-script@v6 - with: - script: | - core.setFailed('Configured `xclim-testdata` tag is not `latest`.') + echo "Latest xclim-testdata tag: ${{ env.XCLIM_TESTDATA_TAG }}" + echo "Tag for xclim-testdata in CI: ${{ env.XCLIM_TESTDATA_BRANCH }}" - name: Find Comment uses: peter-evans/find-comment@v2 id: fc with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: | - > **Warning** + body-includes: It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch + - name: Compare Versions + if: ( ${{ env.XCLIM_TESTDATA_TAG }} == ${{ env.XCLIM_TESTDATA_BRANCH }} ) + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Configured `xclim-testdata` tag is not `latest`.') - name: Update Failure Comment if: ${{ failure() }} uses: peter-evans/create-or-update-comment@v2 @@ -55,7 +52,8 @@ jobs: > **Warning** > It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch to a tag that is not the latest in the repository. - Please make sure to modify this value to match the latest tag (`${{ env.TAG }}`) before merging. + Please make sure to modify this value to match the latest tag (`${{ env.XCLIM_TESTDATA_TAG }}`) before merging. + If this PR depends on a new testing dataset, be sure to tag a new version of `Ouranosinc/xclim-testdata` with your changes merged to `main`. edit-mode: replace - name: Update Success Comment @@ -66,5 +64,5 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | > **Warning** - > It appears that this PR updates the `Ouranosinc/xclim-testdata` branch to the most recent tag. No further action is required. + > It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch to the most recent tag (`${{ env.XCLIM_TESTDATA_TAG }}`). No further action is required. edit-mode: replace From b7d2f36374b761086aeddc2c17b9b4aa33aa2d5f Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 14:20:36 -0400 Subject: [PATCH 09/23] [testing] test success --- .github/workflows/testdata_version.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 345a532e0..537578776 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -37,7 +37,8 @@ jobs: comment-author: 'github-actions[bot]' body-includes: It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch - name: Compare Versions - if: ( ${{ env.XCLIM_TESTDATA_TAG }} == ${{ env.XCLIM_TESTDATA_BRANCH }} ) +# if: ( ${{ env.XCLIM_TESTDATA_TAG }} != ${{ env.XCLIM_TESTDATA_BRANCH }} ) + if: ${{ failure() }} uses: actions/github-script@v6 with: script: | From 62eb74ef211a461aa18e5a9b21ef4678c9536ce0 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 14:27:11 -0400 Subject: [PATCH 10/23] final adjustments --- .github/workflows/testdata_version.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 537578776..1e1d0ff5d 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -35,10 +35,9 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch + body-includes: It appears that this PR modifies the `XCLIM_TESTDATA_BRANCH` environment variable - name: Compare Versions -# if: ( ${{ env.XCLIM_TESTDATA_TAG }} != ${{ env.XCLIM_TESTDATA_BRANCH }} ) - if: ${{ failure() }} + if: ( ${{ env.XCLIM_TESTDATA_TAG }} != ${{ env.XCLIM_TESTDATA_BRANCH }} ) uses: actions/github-script@v6 with: script: | @@ -51,11 +50,11 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | > **Warning** - > It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch to a tag that is not the latest in the repository. + > It appears that this PR modifies the `XCLIM_TESTDATA_BRANCH` environment variable to a tag that is not the latest in the `Ouranosinc/xclim-testdata` repository. - Please make sure to modify this value to match the latest tag (`${{ env.XCLIM_TESTDATA_TAG }}`) before merging. + Please be sure to modify this value to match the most recent tag (`${{ env.XCLIM_TESTDATA_TAG }}`) before merging. - If this PR depends on a new testing dataset, be sure to tag a new version of `Ouranosinc/xclim-testdata` with your changes merged to `main`. + If this PR depends on changes in a new testing dataset branch, be sure to tag a new version of `Ouranosinc/xclim-testdata` with your changes merged to `main`. edit-mode: replace - name: Update Success Comment if: ${{ success() }} @@ -64,6 +63,8 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - > **Warning** - > It appears that this PR modifies the `Ouranosinc/xclim-testdata` branch to the most recent tag (`${{ env.XCLIM_TESTDATA_TAG }}`). No further action is required. + > **Note** + > It appears that this PR modifies the `XCLIM_TESTDATA_BRANCH` environment variable to the most recent tag (`${{ env.XCLIM_TESTDATA_TAG }}`). + + No further action is required. edit-mode: replace From ef565dc51636d3ae509f4df6b425a967b373ef9c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 14:28:29 -0400 Subject: [PATCH 11/23] upstream builds should always test against main branch --- .github/workflows/upstream.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 9cb81dc94..7fe0c86fd 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -17,9 +17,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - XCLIM_TESTDATA_BRANCH: main - jobs: upstream-dev: name: test-upstream-dev (Python${{ matrix.python-version }}) From aea8eee23071a81ad291141133f5490218b2afd0 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:24:34 -0400 Subject: [PATCH 12/23] use xclim-testdata v0.41 --- .github/workflows/main.yml | 2 +- .github/workflows/testdata_version.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41bde7603..1c7c80e08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ on: - submitted env: - XCLIM_TESTDATA_BRANCH: main + XCLIM_TESTDATA_BRANCH: v0.41 jobs: black: diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 1e1d0ff5d..e686c65ed 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -1,4 +1,4 @@ -name: "Update Testing Data Tag" +name: "Verify Testing Data" on: pull_request: @@ -6,12 +6,12 @@ on: - opened - reopened - synchronize -# paths: -# - .github/workflows/main.yml + paths: + - .github/workflows/main.yml jobs: use-latest-tag: - name: Use Latest Testing Data + name: Check Latest xclim-testdata Tag runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From d560049be912707e4f3ea63c406526b71e667177 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:45:02 -0400 Subject: [PATCH 13/23] naming conventions on actions --- .github/workflows/bump-version.yml | 3 ++- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/first_pull_request.yml | 3 +++ .github/workflows/label_on_approval.yml | 3 ++- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/tag-testpypi.yml | 2 +- .github/workflows/testdata_version.yml | 2 +- .github/workflows/upstream.yml | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index c5004da51..82385cabf 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -1,4 +1,4 @@ -name: "Bump Patch Version" +name: Bump Patch Version on: push: @@ -26,6 +26,7 @@ on: jobs: bump_patch_version: + name: Bumpversion Patch runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d15b3b928..611b7a6c9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,4 @@ -name: "CodeQL Scan" +name: CodeQL Scan on: push: diff --git a/.github/workflows/first_pull_request.yml b/.github/workflows/first_pull_request.yml index ac823fbf7..703b1cd18 100644 --- a/.github/workflows/first_pull_request.yml +++ b/.github/workflows/first_pull_request.yml @@ -1,3 +1,5 @@ +name: First Pull Request + on: pull_request_target: types: @@ -5,6 +7,7 @@ on: jobs: welcome: + name: Welcome runs-on: ubuntu-latest steps: - uses: actions/github-script@v6 diff --git a/.github/workflows/label_on_approval.yml b/.github/workflows/label_on_approval.yml index 6b11a9798..912b748ce 100644 --- a/.github/workflows/label_on_approval.yml +++ b/.github/workflows/label_on_approval.yml @@ -1,4 +1,4 @@ -name: "Label Pull Request on Pull Request review approval" +name: Label Pull Request on Pull Request review approval on: pull_request_review: @@ -7,6 +7,7 @@ on: jobs: approved: + name: Label on Approval if: github.event.review.state == 'approved' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 2ff86ca4d..00d968e45 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,4 +1,4 @@ -name: "Publish Python 🐍 distributions 📦 to PyPI" +name: Publish Python 🐍 distributions 📦 to PyPI on: release: diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index bd8da44c6..dc3fdcf24 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -1,4 +1,4 @@ -name: "Publish Python 🐍 distributions 📦 to TestPyPI" +name: Publish Python 🐍 distributions 📦 to TestPyPI on: push: diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index e686c65ed..77fb3ed18 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -1,4 +1,4 @@ -name: "Verify Testing Data" +name: Verify Testing Data on: pull_request: diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 7fe0c86fd..4320953a8 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -1,4 +1,4 @@ -name: xclim Upstream dependencies +name: Test Upstream Dependencies on: push: branches: From b022755adb4792392874a736750bd64f2252ae06 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:45:20 -0400 Subject: [PATCH 14/23] update tag version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c7c80e08..b5ccae05d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ on: - submitted env: - XCLIM_TESTDATA_BRANCH: v0.41 + XCLIM_TESTDATA_BRANCH: v0.41.0 jobs: black: From cb91d2510301841dca872d43406220d710966015 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 16:34:20 -0400 Subject: [PATCH 15/23] fix comparison logic --- .github/workflows/testdata_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index 77fb3ed18..f1bc84bd0 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -37,7 +37,7 @@ jobs: comment-author: 'github-actions[bot]' body-includes: It appears that this PR modifies the `XCLIM_TESTDATA_BRANCH` environment variable - name: Compare Versions - if: ( ${{ env.XCLIM_TESTDATA_TAG }} != ${{ env.XCLIM_TESTDATA_BRANCH }} ) + if: ${{ env.XCLIM_TESTDATA_TAG }} != ${{ env.XCLIM_TESTDATA_BRANCH }} uses: actions/github-script@v6 with: script: | From f39ef18e7cbaf4402b6b329c67e4a28ab86bc1e0 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 16:38:59 -0400 Subject: [PATCH 16/23] fix comparison logic --- .github/workflows/testdata_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testdata_version.yml b/.github/workflows/testdata_version.yml index f1bc84bd0..88cc41108 100644 --- a/.github/workflows/testdata_version.yml +++ b/.github/workflows/testdata_version.yml @@ -37,7 +37,7 @@ jobs: comment-author: 'github-actions[bot]' body-includes: It appears that this PR modifies the `XCLIM_TESTDATA_BRANCH` environment variable - name: Compare Versions - if: ${{ env.XCLIM_TESTDATA_TAG }} != ${{ env.XCLIM_TESTDATA_BRANCH }} + if: ${{( env.XCLIM_TESTDATA_TAG != env.XCLIM_TESTDATA_BRANCH )}} uses: actions/github-script@v6 with: script: | From ca019a7ca9bb1384afa4bd23c60b090f00e2559e Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 17:23:46 -0400 Subject: [PATCH 17/23] add a warning for users of stable versions using main branch of xclim-testdata --- xclim/testing/tests/conftest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xclim/testing/tests/conftest.py b/xclim/testing/tests/conftest.py index 964896914..ff4d33792 100644 --- a/xclim/testing/tests/conftest.py +++ b/xclim/testing/tests/conftest.py @@ -3,6 +3,7 @@ import os import shutil +import warnings from functools import partial from pathlib import Path @@ -13,6 +14,7 @@ from filelock import FileLock import xclim +from xclim import __version__ as __xclim_version__ from xclim.core import indicator from xclim.core.calendar import max_doy from xclim.testing.tests.data import ( @@ -27,6 +29,17 @@ PREFETCH_TESTING_DATA = os.getenv("XCLIM_PREFETCH_TESTING_DATA") +if not __xclim_version__.endswith("-dev") and TESTDATA_BRANCH == "main": + # This is fine on GitHub Workflows and ReadTheDocs + if not os.getenv("CI") or not os.getenv("READTHEDOCS"): + warnings.warn( + f'`xclim` {__xclim_version__} is running tests against the "main" branch of `Ouranosinc/xclim-testdata`. ' + "It is possible that changes in xclim-testdata may be incompatible with tests in this version. " + "Please be sure to check https://github.com/Ouranosinc/xclim-testdata for more information.", + UserWarning, + ) + + @pytest.fixture def tmp_netcdf_filename(tmpdir) -> Path: yield Path(tmpdir).joinpath("testfile.nc") From b991ae94e0f7f66d3cebb6e9b9422811438da160 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 17:24:04 -0400 Subject: [PATCH 18/23] remove unneeded import --- xclim/testing/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/xclim/testing/utils.py b/xclim/testing/utils.py index 633052cb9..5cdaf6436 100644 --- a/xclim/testing/utils.py +++ b/xclim/testing/utils.py @@ -26,7 +26,6 @@ import pandas as pd from xarray import Dataset from xarray import open_dataset as _open_dataset -from yaml import safe_dump, safe_load _xclim_deps = [ "xclim", From 126561c616606c2f84770eaa4bb1afa434424119 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 17:45:21 -0400 Subject: [PATCH 19/23] add warning about potentially incompatible testing data --- xclim/testing/tests/conftest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xclim/testing/tests/conftest.py b/xclim/testing/tests/conftest.py index ff4d33792..b213de83c 100644 --- a/xclim/testing/tests/conftest.py +++ b/xclim/testing/tests/conftest.py @@ -2,6 +2,7 @@ from __future__ import annotations import os +import re import shutil import warnings from functools import partial @@ -12,6 +13,7 @@ import pytest import xarray as xr from filelock import FileLock +from pkg_resources import parse_version import xclim from xclim import __version__ as __xclim_version__ @@ -39,6 +41,14 @@ UserWarning, ) +if re.match(r"^v\d+\.\d+\.\d+", TESTDATA_BRANCH): + if parse_version(TESTDATA_BRANCH) > parse_version(__xclim_version__): + warnings.warn( + f"`xclim` version ({__xclim_version__}) predates `xclim-testdata` version ({TESTDATA_BRANCH}). " + f"It is very likely that the testing data is incompatible with this build of `xclim`.", + UserWarning, + ) + @pytest.fixture def tmp_netcdf_filename(tmpdir) -> Path: From 23544e50fc16800c3aedbfefd4509ff98e987654 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 17:52:54 -0400 Subject: [PATCH 20/23] and not or --- xclim/testing/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xclim/testing/tests/conftest.py b/xclim/testing/tests/conftest.py index b213de83c..42acbc666 100644 --- a/xclim/testing/tests/conftest.py +++ b/xclim/testing/tests/conftest.py @@ -33,7 +33,7 @@ if not __xclim_version__.endswith("-dev") and TESTDATA_BRANCH == "main": # This is fine on GitHub Workflows and ReadTheDocs - if not os.getenv("CI") or not os.getenv("READTHEDOCS"): + if not os.getenv("CI") and not os.getenv("READTHEDOCS"): warnings.warn( f'`xclim` {__xclim_version__} is running tests against the "main" branch of `Ouranosinc/xclim-testdata`. ' "It is possible that changes in xclim-testdata may be incompatible with tests in this version. " From 298f0d502dd564f438f5a47bfcf00c2a1c4962ff Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 18:23:09 -0400 Subject: [PATCH 21/23] update CONTRIBUTING guidelines to explain the testing data update process --- CONTRIBUTING.rst | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 1239f66eb..decbe13a2 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -4,8 +4,7 @@ Contributing ============ -Contributions are welcome, and they are greatly appreciated! Every little bit -helps, and credit will always be given. +Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: @@ -15,7 +14,7 @@ Types of Contributions Implement Features, Indices or Indicators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -xclim's structure makes it easy to create and register new user-defined indices and indicators. +`xclim`'s structure makes it easy to create and register new user-defined indices and indicators. For the general implementation of indices and their wrapping into indicators, refer to :ref:`notebooks/extendxclim:Extending xclim` and :ref:`notebooks/customize:Customizing and controlling xclim`. @@ -181,7 +180,7 @@ Pull Request Guidelines Before you submit a pull request, please follow these guidelines: 1. Open an *issue* on our `GitHub repository`_ with your issue that you'd like to fix or feature that you'd like to implement. -2. Perform the changes, commit and push them either to new a branch within Ouranosinc/xclim or to your personal fork of xclim. +2. Perform the changes, commit and push them either to new a branch within `Ouranosinc/xclim` or to your personal fork of xclim. .. warning:: Try to keep your contributions within the scope of the issue that you are addressing. @@ -223,9 +222,33 @@ Before you submit a pull request, please follow these guidelines: ^^^^^^^^^^^^^^^^ * Updated the contribution guidelines. (:issue:`868`, :pull:`869`). - If this is your first contribution to Ouranosinc/xclim, we ask that you also add your name to the `AUTHORS.rst `_, + If this is your first contribution to `Ouranosinc/xclim`, we ask that you also add your name to the `AUTHORS.rst `_, under *Contributors* as well as to the `.zenodo.json `_, at the end of the *creators* block. +Updating Testing Data +^^^^^^^^^^^^^^^^^^^^^ + +If your code changes require changes to the testing data of `xclim` (i.e.: modifications to existing datasets or new datasets), +these changes must be made via a Pull Request at https://github.com/Ouranosinc/xclim-testdata. + +`xclim` allows for developers to test specific branches/versions of `xclim-testdata` via the `XCLIM_TESTDATA_BRANCH` environment variable, e.g.:: + + $ export XCLIM_TESTDATA_BRANCH="my_new_branch_of_testing_data" + $ pytest xclim + +This will ensure that tests load the testing data from this branch before running. + +If you wish to test a specific branch using GitHub CI, this can be set in `.github/workflows/main.yml`: + +.. code-block:: yaml + + env: + XCLIM_TESTDATA_BRANCH: my_new_branch_of_testing_data + +.. warning:: + In order for a Pull Request to be allowed to merge to main development branch, this variable must match the latest tagged commit name on `Ouranosinc/xclim-testdata`. + We suggest merging changed testing data first, tagging a new version of `xclim-testdata`, then re-running tests on your Pull Request at `Ouranosinc/xclim` with the newest tag. + Tips ---- From 21596d87c13f1ca8dbc44eaa744221511efa8f17 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 29 Mar 2023 18:23:23 -0400 Subject: [PATCH 22/23] update CHANGES.rst --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7ea334334..75dc2fe97 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,10 @@ v0.42.0 (unreleased) -------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`). +Announcements +^^^^^^^^^^^^^ +* `xclim` now supports testing against tagged versions of `Ouranosinc/xclim-testdata `_ in order to support older versions of `xclim`. For more information, see the `Contributing Guide `_ for more details. (:pull:`1339`). + New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * Two previously private functions for selecting a day of year in a time series when performing calendar conversions are now exposed. (:issue:`1305`, :pull:`1317`). New functions are: From 2b38cae72cde066c8ed880e016d3689006227a67 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 30 Mar 2023 10:47:32 -0400 Subject: [PATCH 23/23] fix header level --- CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index decbe13a2..4837d229e 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -226,7 +226,7 @@ Before you submit a pull request, please follow these guidelines: under *Contributors* as well as to the `.zenodo.json `_, at the end of the *creators* block. Updating Testing Data -^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~ If your code changes require changes to the testing data of `xclim` (i.e.: modifications to existing datasets or new datasets), these changes must be made via a Pull Request at https://github.com/Ouranosinc/xclim-testdata.