Skip to content

Commit 1db3996

Browse files
committed
Try again
Signed-off-by: Adam Li <adam2392@gmail.com>
1 parent 72a9b6d commit 1db3996

18 files changed

+2004
-100
lines changed

.circleci/config.yml

+256-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,262 @@
1-
# Use the latest 2.1 version of CircleCI pipeline process engine.
2-
# See: https://circleci.com/docs/2.0/configuration-reference
31
version: 2.1
42

5-
# Define a job to be invoked later in a workflow.
6-
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
73
jobs:
8-
say-hello:
9-
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
10-
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
11-
docker:
12-
- image: cimg/base:stable
13-
# Add steps to the job
14-
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
15-
steps:
16-
- checkout
17-
- run:
18-
name: "Say hello"
19-
command: "echo Hello, World!"
4+
build_doc:
5+
docker:
6+
- image: cimg/base:stable-20.04
7+
steps:
8+
- restore_cache:
9+
name: Restore .git
10+
keys:
11+
- source-cache-graphs
12+
- checkout
13+
- run:
14+
name: Complete checkout
15+
command: |
16+
if ! git remote -v | grep upstream; then
17+
git remote add upstream https://github.com/py-why/dodiscover.git
18+
fi
19+
git remote set-url upstream https://github.com/py-why/dodiscover.git
20+
git fetch upstream
21+
- save_cache:
22+
name: Save .git
23+
key: source-cache-graphs
24+
paths:
25+
- ".git"
26+
- run:
27+
name: Check-skip
28+
command: |
29+
set -e
30+
export COMMIT_MESSAGE=$(git log --format=oneline -n 1);
31+
if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then
32+
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
33+
circleci-agent step halt;
34+
fi
35+
- run:
36+
name: Merge with upstream
37+
command: |
38+
echo $(git log -1 --pretty=%B) | tee gitlog.txt
39+
echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt
40+
if [[ $(cat merge.txt) != "" ]]; then
41+
echo "Merging $(cat merge.txt)";
42+
git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge";
43+
fi
44+
- run:
45+
name: Set BASH_ENV
46+
command: |
47+
set -e
48+
sudo apt install -qq graphviz optipng python3.8-venv python3-venv libxft2
49+
python3.8 -m venv ~/python_env
50+
echo "set -e" >> $BASH_ENV
51+
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV
52+
echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV
53+
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
54+
echo "export DISPLAY=:99" >> $BASH_ENV
55+
echo "source ~/python_env/bin/activate" >> $BASH_ENV
56+
mkdir -p ~/.local/bin
57+
ln -s ~/python_env/bin/python ~/.local/bin/python
58+
echo "BASH_ENV:"
59+
cat $BASH_ENV
60+
- run:
61+
name: Setup pandoc
62+
command: sudo apt update && sudo apt install -y pandoc optipng
63+
- restore_cache:
64+
name: Restore pip cache
65+
keys:
66+
- pip-cache
67+
- restore_cache:
68+
name: Restore install-bin-cache
69+
keys:
70+
- user-install-bin-cache
71+
- run:
72+
name: Get Python running and install dependencies
73+
command: |
74+
python -m pip install --progress-bar off --upgrade pip setuptools wheel poetry
75+
poetry install
76+
- save_cache:
77+
name: Save pip cache
78+
key: pip-cache
79+
paths:
80+
- ~/.cache/pip
81+
- save_cache:
82+
name: Save install-bin-cache
83+
key: user-install-bin-cache
84+
paths:
85+
- ~/.local/lib/python3.8/site-packages
86+
- ~/.local/bin
87+
- run:
88+
name: Check pip package versions
89+
command: pip freeze
90+
- run:
91+
name: Check installation
92+
command: |
93+
LIBGL_DEBUG=verbose python -c "import matplotlib.pyplot as plt; plt.figure()"
94+
python -c "import dodiscover;"
95+
python -c "import numpy; numpy.show_config()"
96+
- run:
97+
name: Build documentation
98+
command: |
99+
cd doc
100+
make html
101+
# Save the example test results
102+
- store_test_results:
103+
path: doc/_build/test-results
104+
- store_artifacts:
105+
path: doc/_build/test-results
106+
destination: test-results
107+
# Save the SG RST
108+
- store_artifacts:
109+
path: doc/auto_examples.zip
110+
- store_artifacts:
111+
path: doc/generated.zip
112+
# Save the outputs
113+
- store_artifacts:
114+
path: doc/_build/html/
115+
destination: dev
116+
- store_artifacts:
117+
path: doc/_build/html_stable/
118+
destination: stable
119+
- persist_to_workspace:
120+
root: doc/_build
121+
paths:
122+
- html
123+
- html_stable
124+
125+
linkcheck:
126+
parameters:
127+
scheduled:
128+
type: string
129+
default: "false"
130+
docker:
131+
- image: cimg/python:3.9.2
132+
steps:
133+
- restore_cache:
134+
keys:
135+
- source-cache-graphs
136+
- checkout
137+
- run:
138+
name: Check-skip
139+
command: |
140+
export COMMIT_MESSAGE=$(git log --format=oneline -n 1);
141+
if [[ "$COMMIT_MESSAGE" != *"[circle linkcheck]"* ]] && [ "<< parameters.scheduled >>" != "true" ]; then
142+
echo "Skip detected, exiting job ${CIRCLE_JOB}."
143+
circleci-agent step halt;
144+
fi
145+
- run:
146+
name: Set BASH_ENV
147+
command: |
148+
set -e
149+
echo "set -e" >> $BASH_ENV
150+
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
151+
- restore_cache:
152+
keys:
153+
- pip-cache
154+
- run:
155+
name: Get Python running
156+
command: |
157+
python -m pip install --progress-bar off --upgrade pip setuptools wheel
158+
python -m pip install --progress-bar off .[doc]
159+
- run:
160+
name: make linkcheck
161+
command: |
162+
make -C doc linkcheck
163+
- run:
164+
name: make linkcheck-grep
165+
when: always
166+
command: |
167+
make -C doc linkcheck-grep
168+
- store_artifacts:
169+
path: doc/_build/linkcheck
170+
destination: linkcheck
171+
172+
deploy:
173+
docker:
174+
- image: cimg/node:lts
175+
steps:
176+
- checkout
177+
178+
- attach_workspace:
179+
at: doc/_build
180+
- run:
181+
name: Set BASH_ENV
182+
command: |
183+
set -e
184+
echo "set -e" >> $BASH_ENV
185+
# Don't try to deploy if nothing is there or not on the right branch
186+
- run:
187+
name: Check docs
188+
command: |
189+
if [ ! -f doc/_build/html/index.html ] && [ ! -f doc/_build/html_stable/index.html ]; then
190+
echo "No files found to upload (build: ${CIRCLE_BRANCH}).";
191+
circleci-agent step halt;
192+
fi;
193+
- run:
194+
name: Install and configure dependencies
195+
# do not update gh-pages above 3.0.0
196+
# see: https://github.com/tschaub/gh-pages/issues/354
197+
command: |
198+
npm install gh-pages@3.0
199+
git config --global user.email "circle@pywhy.com"
200+
git config --global user.name "Circle Ci"
201+
- add_ssh_keys:
202+
fingerprints:
203+
- "b5:1e:a1:6d:8d:48:f2:8f:dd:bd:2d:66:a9:30:fe:b9"
204+
- run:
205+
# push built doc into the `dev` directory on the `gh-pages` branch
206+
name: Deploy doc to gh-pages branch
207+
command: |
208+
if [ "${CIRCLE_BRANCH}" == "main" ]; then
209+
echo "Deploying dev doc for ${CIRCLE_BRANCH}.";
210+
node_modules/gh-pages/bin/gh-pages.js --dotfiles --message "doc updates [skip ci]" --dist doc/_build/html --dest ./dev
211+
else
212+
echo "Deploying stable doc for ${CIRCLE_BRANCH}.";
213+
node_modules/gh-pages/bin/gh-pages.js --dotfiles --message "doc updates [skip ci]" --dist doc/_build/html_stable --dest ./stable
214+
fi;
20215
21-
# Invoke jobs via workflows
22-
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
23216
workflows:
24-
say-hello-workflow:
217+
default:
218+
jobs:
219+
- build_doc:
220+
name: build_doc
221+
- linkcheck:
222+
name: linkcheck
223+
- deploy:
224+
requires:
225+
- build_doc
226+
filters:
227+
branches:
228+
only:
229+
- main
230+
- maint/0.2
231+
232+
main:
233+
jobs:
234+
- build_doc:
235+
name: build_doc_main
236+
- deploy:
237+
name: deploy_main
238+
requires:
239+
- build_doc_main
240+
triggers:
241+
- schedule:
242+
# "At 00:00" (once a day) should be enough "0 0 * * *",
243+
# But for testing at first, let's do once an hour (6 AM GMT)
244+
cron: "0 6 * * *"
245+
filters:
246+
branches:
247+
only:
248+
- main
249+
250+
weekly:
25251
jobs:
26-
- say-hello
252+
- linkcheck:
253+
name: linkcheck_weekly
254+
scheduled: "true"
255+
triggers:
256+
- schedule:
257+
# "At 00:00 on Sunday" should be often enough
258+
cron: "0 0 * * 0"
259+
filters:
260+
branches:
261+
only:
262+
- main

.codespellignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
raison

.flake8

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[flake8]
2+
max-line-length = 100
3+
4+
ignore =
5+
# these rules don't play well with black
6+
# whitespace before ':'
7+
E203
8+
# line break before binary operator
9+
W503
10+
E241,E305,W504,W605,E731
11+
12+
exclude =
13+
.git
14+
.github
15+
.venv
16+
.mypy_cache
17+
.pytest_cache
18+
.circleci
19+
paper
20+
setup.py
21+
docs
22+
23+
per-file-ignores =
24+
# __init__.py files are allowed to have unused imports
25+
*/__init__.py:F401
26+
*/**/__init__.py:F401

.github/ISSUE_TEMPLATE/bug_report.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Please fill this template entirely and do not erase any of it.
12+
We reserve the right to close without a response bug reports which are incomplete.
13+
-->
14+
15+
## Checklist
16+
17+
<!-- To check an item on the list replace [ ] with [x]. -->
18+
19+
- [ ] I have verified that the issue exists against the `main` branch.
20+
- [ ] I have read the relevant section in the [contribution guide](https://github.com/py-why/dodiscover/blob/main/CONTRIBUTING.md#bug-reports-and-feature-requests) on reporting bugs.
21+
- [ ] I have checked the [issues list](https://github.com/py-why/dodiscover/issues) for similar or identical bug reports.
22+
- [ ] I have checked the [pull requests list](https://github.com/py-why/dodiscover/pulls) for existing proposed fixes.
23+
- [ ] I have checked the [CHANGELOG](https://github.com/py-why/dodiscover/blob/main/CHANGELOG.md) and the [commit log](https://github.com/py-why/dodiscover/commits/main) to find out if the bug was already fixed in the main branch.
24+
- [ ] I have included in the "Description" section below a traceback from any exceptions related to this bug.
25+
- [ ] I have included in the "Related issues or possible duplicates" section beloew all related issues and possible duplicate issues (If there are none, check this box anyway).
26+
- [ ] I have included in the "Environment" section below the name of the operating system and Python version that I was using when I discovered this bug.
27+
- [ ] I have included in the "Environment" section below the output of `pip freeze`.
28+
- [ ] I have included in the "Steps to reproduce" section below a minimally reproducible example.
29+
30+
31+
## Description
32+
33+
<!-- Please provide a clear and concise description of what the bug is here. -->
34+
35+
<details>
36+
<summary><b>Python traceback:</b></summary>
37+
<p>
38+
39+
<!-- Paste the traceback from any exception (if there was one) in between the next two lines below -->
40+
```
41+
```
42+
43+
</p>
44+
</details>
45+
46+
47+
## Related issues or possible duplicates
48+
49+
- None
50+
51+
52+
## Environment
53+
54+
<!-- Provide the name of operating system below (e.g. OS X, Linux) -->
55+
OS:
56+
57+
<!-- Provide the Python version you were using (e.g. 3.7.1) -->
58+
Python version:
59+
60+
<details>
61+
<summary><b>Output of <code>pip freeze</code>:</b></summary>
62+
<p>
63+
64+
<!-- Paste the output of `pip freeze` in between the next two lines below -->
65+
```
66+
```
67+
68+
</p>
69+
</details>
70+
71+
72+
## Steps to reproduce
73+
74+
75+
<details>
76+
<summary><b>Example source:</b></summary>
77+
<p>
78+
79+
<!-- Add a fully runnable example in between the next two lines below that will reproduce the bug -->
80+
```
81+
```
82+
83+
</p>
84+
</details>

0 commit comments

Comments
 (0)