Skip to content

Commit d0f9aef

Browse files
committed
WTF
1 parent 01a57e7 commit d0f9aef

9 files changed

+730
-0
lines changed

.github/workflows/asv-bot.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "ASV Bot"
2+
3+
on:
4+
issue_comment: # Pull requests are issues
5+
types:
6+
- created
7+
8+
env:
9+
COMMENT: ${{ github.event.comment.body }}
10+
11+
jobs:
12+
autotune:
13+
name: "Run benchmarks"
14+
# TODO: Support more benchmarking options later, against different branches, against self, etc
15+
if: startsWith(github.event.comment.body, '@github-actions benchmark')
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
shell: bash -l {0}
20+
21+
concurrency:
22+
# Set concurrency to prevent abuse(full runs are ~5.5 hours !!!)
23+
# each user can only run one concurrent benchmark bot at a time
24+
# We don't cancel in progress jobs, but if you want to benchmark multiple PRs, you're gonna have
25+
# to wait
26+
group: ${{ github.actor }}-asv
27+
cancel-in-progress: false
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
with:
33+
fetch-depth: 0
34+
35+
# Although asv sets up its own env, deps are still needed
36+
# during discovery process
37+
- name: Set up Conda
38+
uses: ./.github/actions/setup
39+
40+
- name: Run benchmarks
41+
id: bench
42+
continue-on-error: true # This is a fake failure, asv will exit code 1 for regressions
43+
run: |
44+
# extracting the regex, see https://stackoverflow.com/a/36798723
45+
REGEX=$(echo "$COMMENT" | sed -n "s/^.*-b\s*\(\S*\).*$/\1/p")
46+
cd asv_bench
47+
asv check -E existing
48+
git remote add upstream https://github.com/pandas-dev/pandas.git
49+
git fetch upstream
50+
asv machine --yes
51+
asv continuous -f 1.1 -b $REGEX upstream/main HEAD
52+
echo 'BENCH_OUTPUT<<EOF' >> $GITHUB_ENV
53+
asv compare -f 1.1 upstream/main HEAD >> $GITHUB_ENV
54+
echo 'EOF' >> $GITHUB_ENV
55+
echo "REGEX=$REGEX" >> $GITHUB_ENV
56+
57+
- uses: actions/github-script@v5
58+
env:
59+
BENCH_OUTPUT: ${{env.BENCH_OUTPUT}}
60+
REGEX: ${{env.REGEX}}
61+
with:
62+
script: |
63+
const ENV_VARS = process.env
64+
const run_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
65+
github.rest.issues.createComment({
66+
issue_number: context.issue.number,
67+
owner: context.repo.owner,
68+
repo: context.repo.repo,
69+
body: '\nBenchmarks completed. View runner logs here.' + run_url + '\nRegex used: '+ 'regex ' + ENV_VARS["REGEX"] + '\n' + ENV_VARS["BENCH_OUTPUT"]
70+
})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Update pre-commit config"
2+
3+
on:
4+
schedule:
5+
- cron: "0 7 1 * *" # At 07:00 on 1st of every month.
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-pre-commit:
10+
if: github.repository_owner == 'pandas-dev'
11+
name: Autoupdate pre-commit config
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
- name: Cache multiple paths
17+
uses: actions/cache@v2
18+
with:
19+
path: |
20+
~/.cache/pre-commit
21+
~/.cache/pip
22+
key: pre-commit-autoupdate-${{ runner.os }}-build
23+
- name: Update pre-commit config packages
24+
uses: technote-space/create-pr-action@v2
25+
with:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
EXECUTE_COMMANDS: |
28+
pip install pre-commit
29+
pre-commit autoupdate || (exit 0);
30+
pre-commit run -a || (exit 0);
31+
COMMIT_MESSAGE: "⬆️ UPGRADE: Autoupdate pre-commit config"
32+
PR_BRANCH_NAME: "pre-commit-config-update-${PR_ID}"
33+
PR_TITLE: "⬆️ UPGRADE: Autoupdate pre-commit config"

.github/workflows/code-checks.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Code Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 1.4.x
8+
pull_request:
9+
branches:
10+
- main
11+
- 1.4.x
12+
13+
env:
14+
PANDAS_CI: 1
15+
16+
jobs:
17+
pre_commit:
18+
name: pre-commit
19+
runs-on: ubuntu-latest
20+
concurrency:
21+
# https://github.saobby.my.eu.orgmunity/t/concurrecy-not-work-for-push/183068/7
22+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-pre-commit
23+
cancel-in-progress: true
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Install Python
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: '3.9.7'
32+
33+
- name: Run pre-commit
34+
uses: pre-commit/action@v2.0.3
35+
36+
typing_and_docstring_validation:
37+
name: Docstring and typing validation
38+
runs-on: ubuntu-latest
39+
defaults:
40+
run:
41+
shell: bash -l {0}
42+
43+
concurrency:
44+
# https://github.saobby.my.eu.orgmunity/t/concurrecy-not-work-for-push/183068/7
45+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-code-checks
46+
cancel-in-progress: true
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v2
51+
with:
52+
fetch-depth: 0
53+
54+
- name: Set up Conda
55+
uses: ./.github/actions/setup
56+
57+
- name: Build Pandas
58+
uses: ./.github/actions/build-pandas
59+
id: build
60+
continue-on-error: true
61+
62+
- name: Install node.js (for pyright)
63+
uses: actions/setup-node@v2
64+
with:
65+
node-version: "16"
66+
67+
- name: Install pyright
68+
# note: keep version in sync with .pre-commit-config.yaml
69+
run: npm install -g pyright@1.1.212
70+
71+
- name: Run checks on imported code
72+
run: ci/code_checks.sh code
73+
if: ${{ steps.build.outcome == 'success' }}
74+
75+
- name: Run doctests
76+
run: ci/code_checks.sh doctests
77+
if: ${{ steps.build.outcome == 'success' }}
78+
79+
- name: Run docstring validation
80+
run: ci/code_checks.sh docstrings
81+
if: ${{ steps.build.outcome == 'success' }}
82+
83+
- name: Run typing validation
84+
run: ci/code_checks.sh typing
85+
if: ${{ steps.build.outcome == 'success' }}
86+
87+
- name: Run docstring validation script tests
88+
run: pytest scripts
89+
if: ${{ steps.build.outcome == 'success' }}
90+
91+
asv-benchmarks:
92+
name: ASV Benchmarks
93+
runs-on: ubuntu-latest
94+
defaults:
95+
run:
96+
shell: bash -l {0}
97+
98+
concurrency:
99+
# https://github.saobby.my.eu.orgmunity/t/concurrecy-not-work-for-push/183068/7
100+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-asv-benchmarks
101+
cancel-in-progress: true
102+
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v2
106+
with:
107+
fetch-depth: 0
108+
109+
- name: Set up Conda
110+
uses: ./.github/actions/setup
111+
112+
- name: Build Pandas
113+
uses: ./.github/actions/build-pandas
114+
115+
- name: Run ASV benchmarks
116+
run: |
117+
cd asv_bench
118+
asv check -E existing
119+
git remote add upstream https://github.com/pandas-dev/pandas.git
120+
git fetch upstream
121+
asv machine --yes
122+
asv dev | sed "/failed$/ s/^/##[error]/" | tee benchmarks.log
123+
if grep "failed" benchmarks.log > /dev/null ; then
124+
exit 1
125+
fi
126+
127+
- name: Publish benchmarks artifact
128+
uses: actions/upload-artifact@v2
129+
with:
130+
name: Benchmarks log
131+
path: asv_bench/benchmarks.log
132+
if: failure()
133+
134+
build_docker_dev_environment:
135+
name: Build Docker Dev Environment
136+
runs-on: ubuntu-latest
137+
defaults:
138+
run:
139+
shell: bash -l {0}
140+
141+
concurrency:
142+
# https://github.saobby.my.eu.orgmunity/t/concurrecy-not-work-for-push/183068/7
143+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-build_docker_dev_environment
144+
cancel-in-progress: true
145+
146+
steps:
147+
- name: Clean up dangling images
148+
run: docker image prune -f
149+
150+
- name: Checkout
151+
uses: actions/checkout@v2
152+
with:
153+
fetch-depth: 0
154+
155+
- name: Build image
156+
run: docker build --pull --no-cache --tag pandas-dev-env .

.github/workflows/comment_bot.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Comment-bot
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
- edited
8+
9+
jobs:
10+
autotune:
11+
name: "Fixup pre-commit formatting"
12+
if: startsWith(github.event.comment.body, '@github-actions pre-commit')
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: r-lib/actions/pr-fetch@v2
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Cache multiple paths
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
~/.cache/pre-commit
24+
~/.cache/pip
25+
key: pre-commit-dispatched-${{ runner.os }}-build
26+
- uses: actions/setup-python@v2
27+
with:
28+
python-version: 3.8
29+
- name: Install-pre-commit
30+
run: python -m pip install --upgrade pre-commit
31+
- name: Run pre-commit
32+
run: pre-commit run --from-ref=origin/main --to-ref=HEAD --all-files || (exit 0)
33+
- name: Commit results
34+
run: |
35+
git config user.name "$(git log -1 --pretty=format:%an)"
36+
git config user.email "$(git log -1 --pretty=format:%ae)"
37+
git commit -a -m 'Fixes from pre-commit [automated commit]' || echo "No changes to commit"
38+
- uses: r-lib/actions/pr-push@v2
39+
with:
40+
repo-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Doc Build and Upload
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 1.4.x
8+
pull_request:
9+
branches:
10+
- main
11+
- 1.4.x
12+
13+
env:
14+
PANDAS_CI: 1
15+
16+
jobs:
17+
web_and_docs:
18+
name: Doc Build and Upload
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: bash -l {0}
23+
24+
concurrency:
25+
# https://github.saobby.my.eu.orgmunity/t/concurrecy-not-work-for-push/183068/7
26+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-web-docs
27+
cancel-in-progress: true
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Set up Conda
36+
uses: ./.github/actions/setup
37+
38+
- name: Build pandas
39+
uses: ./.github/actions/build-pandas
40+
41+
- name: Build website
42+
run: python web/pandas_web.py web/pandas --target-path=web/build
43+
44+
- name: Build documentation
45+
run: doc/make.py --warnings-are-errors
46+
47+
- name: Install ssh key
48+
run: |
49+
mkdir -m 700 -p ~/.ssh
50+
echo "${{ secrets.server_ssh_key }}" > ~/.ssh/id_rsa
51+
chmod 600 ~/.ssh/id_rsa
52+
echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE1Kkopomm7FHG5enATf7SgnpICZ4W2bw+Ho+afqin+w7sMcrsa0je7sbztFAV8YchDkiBKnWTG4cRT+KZgZCaY=" > ~/.ssh/known_hosts
53+
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
54+
55+
- name: Copy cheatsheets into site directory
56+
run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/
57+
58+
- name: Upload web
59+
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' web/build/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas
60+
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
61+
62+
- name: Upload dev docs
63+
run: rsync -az --delete doc/build/html/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas/pandas-docs/dev
64+
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
65+
66+
- name: Move docs into site directory
67+
run: mv doc/build/html web/build/docs
68+
69+
- name: Save website as an artifact
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: website
73+
path: web/build
74+
retention-days: 14

0 commit comments

Comments
 (0)