Skip to content

Amend upstream-dev GitHub action + Bug fixes #4604

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

Merged
merged 14 commits into from
Dec 5, 2020
Merged
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.8"]
outputs:
artifacts_availability: ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
Expand All @@ -30,6 +32,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
channel-priority: strict
mamba-version: "*"
activate-environment: xarray-tests
auto-update-conda: false
Expand All @@ -40,12 +43,17 @@ jobs:
bash ci/install-upstream-wheels.sh
conda list
- name: Run Tests
id: status
run: |
set -o pipefail
python -m pytest -rf | tee output-${{ matrix.python-version }}-log

set -euo pipefail
python -m pytest -rf | tee output-${{ matrix.python-version }}-log || (
echo '::set-output name=ARTIFACTS_AVAILABLE::true' && false
)
- name: Upload artifacts
if: "failure()&&(github.event_name == 'schedule')&&(github.repository == 'pydata/xarray')" # Check the exit code of previous step
if: |
failure()
&& github.event_name == 'schedule'
&& github.repository == 'pydata/xarray'
uses: actions/upload-artifact@v2
with:
name: output-${{ matrix.python-version }}-log
Expand All @@ -55,7 +63,11 @@ jobs:
report:
name: report
needs: upstream-dev
if: "always()&&(github.event_name == 'schedule')&&(github.repository == 'pydata/xarray')"
if: |
always()
&& github.event_name == 'schedule'
&& github.repository == 'pydata/xarray'
&& needs.upstream-dev.outputs.artifacts_availability =='true'
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -86,7 +98,7 @@ jobs:
const title = "⚠️ Nightly upstream-dev 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})\n${pytest_logs}`

// 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) {
Expand All @@ -109,11 +121,10 @@ jobs:
creator: "github-actions[bot]"
}
const result = await github.graphql(query, variables)
const issue_info = result.repository.issues.edges[0].node

// If no issue is open, create a new issue, else update the
// body of the existing issue.
if (typeof issue_info.number === 'undefined') {
// 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.issues.create({
owner: variables.owner,
repo: variables.name,
Expand All @@ -125,7 +136,7 @@ jobs:
github.issues.update({
owner: variables.owner,
repo: variables.name,
issue_number: issue_info.number,
issue_number: result.repository.issues.edges[0].node.number,
body: issue_body
})
}