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

Improve upstream CI report #9603

Merged
merged 6 commits into from Oct 27, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 14 additions & 62 deletions .github/workflows/upstream.yml
Expand Up @@ -63,69 +63,21 @@ jobs:

- name: Run tests
id: run_tests
env:
XTRATESTARGS: "--report-log output-log.jsonl"
run: source continuous_integration/scripts/run_tests.sh

- name: Open or update issue on failure
if: |
failure()
&& github.event_name != 'pull_request'
&& github.repository == 'dask/dask'
&& steps.run_tests.outcome == 'failure'
uses: xarray-contrib/issue-from-pytest-log@v1.1
with:
log-path: output-log.jsonl
issue-title: ⚠️ Upstream CI failed ⚠️
issue-label: upstream

- 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
})
}
3 changes: 3 additions & 0 deletions continuous_integration/scripts/install.sh
Expand Up @@ -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
Expand Down