Skip to content

Commit cf24100

Browse files
authored
Add upstream CI build (#882)
1 parent 2f028b5 commit cf24100

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

.github/workflows/upstream.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Upstream
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 * * *"
6+
push:
7+
pull_request:
8+
9+
jobs:
10+
11+
check:
12+
runs-on: ubuntu-latest
13+
if: github.event_name == 'push' || github.event_name == 'pull_request'
14+
outputs:
15+
test-upstream: ${{ steps.detect-trigger.outputs.trigger-found }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 2
20+
- uses: xarray-contrib/ci-trigger@v1
21+
id: detect-trigger
22+
with:
23+
keyword: "test-upstream"
24+
25+
build:
26+
needs: check
27+
runs-on: ubuntu-latest
28+
if: |
29+
always()
30+
&& (
31+
needs.check.outputs.test-upstream == 'true'
32+
|| (github.repository == 'dask/dask-ml' && github.event_name != 'pull_request')
33+
)
34+
35+
env:
36+
COVERAGE: "true"
37+
38+
steps:
39+
- name: Checkout source
40+
uses: actions/checkout@v2
41+
42+
- name: Setup Conda Environment
43+
uses: conda-incubator/setup-miniconda@v2
44+
with:
45+
miniforge-variant: Mambaforge
46+
miniforge-version: latest
47+
use-mamba: true
48+
channel-priority: strict
49+
python-version: "3.9"
50+
environment-file: ci/environment-3.9.yaml
51+
activate-environment: test-environment
52+
auto-activate-base: false
53+
54+
- name: Install
55+
shell: bash -l {0}
56+
env:
57+
UPSTREAM_DEV: 1
58+
run: source ci/install.sh
59+
60+
- name: Run tests
61+
shell: bash -l {0}
62+
run: pytest -v
63+
64+
report:
65+
name: report
66+
needs: build
67+
if: |
68+
always()
69+
&& github.event_name != 'pull_request'
70+
&& github.repository == 'dask/dask-ml'
71+
&& needs.build.result == 'failure'
72+
runs-on: ubuntu-latest
73+
defaults:
74+
run:
75+
shell: bash
76+
steps:
77+
- uses: actions/checkout@v2
78+
- name: Report failures
79+
uses: actions/github-script@v3
80+
with:
81+
github-token: ${{ secrets.GITHUB_TOKEN }}
82+
script: |
83+
const title = "⚠️ Upstream CI failed ⚠️"
84+
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
85+
const issue_body = `[Workflow Run URL](${workflow_url})`
86+
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
87+
const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
88+
repository(owner: $owner, name: $name) {
89+
issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
90+
edges {
91+
node {
92+
body
93+
id
94+
number
95+
}
96+
}
97+
}
98+
}
99+
}`;
100+
const variables = {
101+
owner: context.repo.owner,
102+
name: context.repo.repo,
103+
label: 'upstream',
104+
creator: "github-actions[bot]"
105+
}
106+
const result = await github.graphql(query, variables)
107+
// If no issue is open, create a new issue,
108+
// else update the body of the existing issue.
109+
if (result.repository.issues.edges.length === 0) {
110+
github.issues.create({
111+
owner: variables.owner,
112+
repo: variables.name,
113+
body: issue_body,
114+
title: title,
115+
labels: [variables.label]
116+
})
117+
} else {
118+
github.issues.update({
119+
owner: variables.owner,
120+
repo: variables.name,
121+
issue_number: result.repository.issues.edges[0].node.number,
122+
body: issue_body
123+
})
124+
}

ci/install.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2+
# Optionally, install development versions of dependenies
3+
if [[ ${UPSTREAM_DEV} ]]; then
4+
# FIXME https://github.com/mamba-org/mamba/issues/412
5+
# mamba uninstall --force dask distributed scikit-learn
6+
conda uninstall --force dask distributed scikit-learn
7+
8+
python -m pip install --no-deps --pre \
9+
-i https://pypi.anaconda.org/scipy-wheels-nightly/simple \
10+
scikit-learn
11+
12+
python -m pip install \
13+
--upgrade \
14+
git+https://github.com/dask/dask \
15+
git+https://github.com/dask/distributed
16+
fi
17+
18+
# Install dask-ml
119
python -m pip install --quiet --no-deps -e .
220

321
echo mamba list

0 commit comments

Comments
 (0)