From 3bec0f103c3ccfc281c47cc79558794a566c90a3 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 27 Oct 2022 12:18:42 -0500 Subject: [PATCH 1/6] Try issue-from-pytest-log --- .github/workflows/upstream.yml | 75 ++++------------------- continuous_integration/scripts/install.sh | 3 + 2 files changed, 16 insertions(+), 62 deletions(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index ccea59d5540..3d80e012878 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -63,69 +63,20 @@ jobs: - name: Run tests id: run_tests + env: + XTRATESTARGS: "--report-log output-log.jsonl" run: source continuous_integration/scripts/run_tests.sh + - name: Generate and publish the report + if: | + failure() + && github.event_name != 'pull_request' + && github.repository == 'jrbourbeau/dask' + && steps.run_tests.outcome == 'failure' + uses: jrbourbeau/issue-from-pytest-log@add-more-options + with: + log-path: output-log.jsonl + issue-title: test-issue-from-pytest-log + - name: Coverage uses: codecov/codecov-action@v3 - - report: - name: report - needs: build - if: | - always() - && github.event_name != 'pull_request' - && github.repository == 'dask/dask' - && needs.build.result == 'failure' - runs-on: ubuntu-latest - defaults: - run: - shell: bash - steps: - - uses: actions/checkout@v3.1.0 - - name: Report failures - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const title = "⚠️ Upstream CI failed ⚠️" - const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}` - const issue_body = `[Workflow Run URL](${workflow_url})` - // Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures - const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){ - repository(owner: $owner, name: $name) { - issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) { - edges { - node { - body - id - number - } - } - } - } - }`; - const variables = { - owner: context.repo.owner, - name: context.repo.repo, - label: 'upstream', - creator: "github-actions[bot]" - } - const result = await github.graphql(query, variables) - // If no issue is open, create a new issue, - // else update the body of the existing issue. - if (result.repository.issues.edges.length === 0) { - github.rest.issues.create({ - owner: variables.owner, - repo: variables.name, - body: issue_body, - title: title, - labels: [variables.label] - }) - } else { - github.rest.issues.update({ - owner: variables.owner, - repo: variables.name, - issue_number: result.repository.issues.edges[0].node.number, - body: issue_body - }) - } diff --git a/continuous_integration/scripts/install.sh b/continuous_integration/scripts/install.sh index 60ac5f3d404..7a128e5c1a5 100644 --- a/continuous_integration/scripts/install.sh +++ b/continuous_integration/scripts/install.sh @@ -35,6 +35,9 @@ if [[ ${UPSTREAM_DEV} ]]; then git+https://github.com/dask/distributed \ git+https://github.com/dask/fastparquet \ git+https://github.com/zarr-developers/zarr-python + + # Used when automatically opening an issue when the `upstream` CI build fails + mamba install pytest-reportlog fi # Install dask From 405c92d583cf0245633de7c6b003a3d85189deee Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 27 Oct 2022 12:28:27 -0500 Subject: [PATCH 2/6] [test-upstream] --- continuous_integration/scripts/run_tests.sh | 2 +- dask/tests/test_config.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/continuous_integration/scripts/run_tests.sh b/continuous_integration/scripts/run_tests.sh index 05df9752377..e3223901290 100644 --- a/continuous_integration/scripts/run_tests.sh +++ b/continuous_integration/scripts/run_tests.sh @@ -11,6 +11,6 @@ if [[ $COVERAGE == 'true' ]]; then fi echo "py.test dask --runslow $XTRATESTARGS" -py.test dask --runslow $XTRATESTARGS +py.test dask/tests/test_config.py --runslow $XTRATESTARGS set +e diff --git a/dask/tests/test_config.py b/dask/tests/test_config.py index 9ce1ea1b370..65dc9408b13 100644 --- a/dask/tests/test_config.py +++ b/dask/tests/test_config.py @@ -31,6 +31,7 @@ def test_canonical_name(): + raise ValueError("asdf") c = {"foo-bar": 1, "fizz_buzz": 2} assert canonical_name("foo-bar", c) == "foo-bar" assert canonical_name("foo_bar", c) == "foo-bar" From c9c870d1ddc0bf560d7315d1234272427307bf37 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 27 Oct 2022 13:37:32 -0500 Subject: [PATCH 3/6] Use xarray-contrib [test-upstream] --- .github/workflows/upstream.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 3d80e012878..7f5f7878d14 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -67,16 +67,17 @@ jobs: XTRATESTARGS: "--report-log output-log.jsonl" run: source continuous_integration/scripts/run_tests.sh - - name: Generate and publish the report + - name: Open or update issue on failure if: | failure() && github.event_name != 'pull_request' && github.repository == 'jrbourbeau/dask' && steps.run_tests.outcome == 'failure' - uses: jrbourbeau/issue-from-pytest-log@add-more-options + uses: xarray-contrib/issue-from-pytest-log@89ca5895ebd99c09f8222234a0976e7ff8b823a7 with: log-path: output-log.jsonl - issue-title: test-issue-from-pytest-log + issue-title: ⚠️ Upstream CI failed ⚠️ + issue-label: upstream - name: Coverage uses: codecov/codecov-action@v3 From 1ff8a0975e84b8d23d18201f5d5206d725d99008 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 27 Oct 2022 13:56:15 -0500 Subject: [PATCH 4/6] Undo temporary changes --- .github/workflows/upstream.yml | 2 +- continuous_integration/scripts/run_tests.sh | 2 +- dask/tests/test_config.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 7f5f7878d14..b6b0e94b2dc 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -71,7 +71,7 @@ jobs: if: | failure() && github.event_name != 'pull_request' - && github.repository == 'jrbourbeau/dask' + && github.repository == 'dask/dask' && steps.run_tests.outcome == 'failure' uses: xarray-contrib/issue-from-pytest-log@89ca5895ebd99c09f8222234a0976e7ff8b823a7 with: diff --git a/continuous_integration/scripts/run_tests.sh b/continuous_integration/scripts/run_tests.sh index e3223901290..05df9752377 100644 --- a/continuous_integration/scripts/run_tests.sh +++ b/continuous_integration/scripts/run_tests.sh @@ -11,6 +11,6 @@ if [[ $COVERAGE == 'true' ]]; then fi echo "py.test dask --runslow $XTRATESTARGS" -py.test dask/tests/test_config.py --runslow $XTRATESTARGS +py.test dask --runslow $XTRATESTARGS set +e diff --git a/dask/tests/test_config.py b/dask/tests/test_config.py index 65dc9408b13..9ce1ea1b370 100644 --- a/dask/tests/test_config.py +++ b/dask/tests/test_config.py @@ -31,7 +31,6 @@ def test_canonical_name(): - raise ValueError("asdf") c = {"foo-bar": 1, "fizz_buzz": 2} assert canonical_name("foo-bar", c) == "foo-bar" assert canonical_name("foo_bar", c) == "foo-bar" From 93f39920cba5142fba1eb89121cf3127e85dfbda Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 27 Oct 2022 13:59:36 -0500 Subject: [PATCH 5/6] Use official release --- .github/workflows/upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index b6b0e94b2dc..634f3d7a5a0 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -73,7 +73,7 @@ jobs: && github.event_name != 'pull_request' && github.repository == 'dask/dask' && steps.run_tests.outcome == 'failure' - uses: xarray-contrib/issue-from-pytest-log@89ca5895ebd99c09f8222234a0976e7ff8b823a7 + uses: xarray-contrib/issue-from-pytest-log@1.1 with: log-path: output-log.jsonl issue-title: ⚠️ Upstream CI failed ⚠️ From df25549d587149fed8c29469bc35787d9f8a8bce Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Thu, 27 Oct 2022 14:30:32 -0500 Subject: [PATCH 6/6] Use correct version identifier Co-authored-by: Charles Blackmon-Luca <20627856+charlesbluca@users.noreply.github.com> --- .github/workflows/upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 634f3d7a5a0..97c43e60eac 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -73,7 +73,7 @@ jobs: && github.event_name != 'pull_request' && github.repository == 'dask/dask' && steps.run_tests.outcome == 'failure' - uses: xarray-contrib/issue-from-pytest-log@1.1 + uses: xarray-contrib/issue-from-pytest-log@v1.1 with: log-path: output-log.jsonl issue-title: ⚠️ Upstream CI failed ⚠️