Skip to content

Commit d46e833

Browse files
authored
[INF] Switching from Azure Pipelines to GitHub Actions (pyjanitor-devs#787)
* First pass switching to GitHub actions * fix installation commands * Change black to explicitly reference config * Removed netlify config * Fixed version of black to 19.10b0 * Add parallel builds for docs, tests etc. * Add dependence on build environment * Fix build file * Fixed downstream step to use cached env tarball * Skip conda-pack step if environment not changed * Install source before running code checks * Trying out a Netlify preview * Move environment to /tmp dir * Adding test speed to output * Fix test unpack step * Fix unpack step * Refactor out unpack script * Fix build script * Switched to editable installs * Fix Py version (for pyup security) * Remove runtime file for Netlify * CI trigger * Remove Travis build config * Remove pytest-azurepipelines from environment specs * Add cov report xml to pytest * Add auto-release template
1 parent c20e497 commit d46e833

15 files changed

+519
-189
lines changed
File renamed without changes.

.github/workflows/auto-release.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# For @loganthomas!
2+
# Some hints for you :)
3+
4+
# Give it an informative name.
5+
name: Some not so informative name
6+
7+
# Decide what git events trigger this workflow.
8+
# One of the two entries below shouldn't be used (logically) for a release workflow.
9+
on:
10+
push: [master]
11+
pull_request: [master]
12+
13+
# Define the jobs
14+
jobs:
15+
# Give the job an informative "key"
16+
release:
17+
# Give the job an informative "name"
18+
name: Some informative name
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
# Usually, the very first thing we'll need is to checkout the repository.
23+
# See the "code-checks.yml" file to see the syntax.
24+
25+
# Now we build the package. You can either choose to run arbitrary commands,
26+
# or use someone else's pre-built action.
27+
# The filesystem state is passed on from build step to build step,
28+
# but the environment variables are not necessarily so.
29+
30+
# Once the package is built, we can use this action:
31+
# https://github.com/pypa/gh-action-pypi-publish
32+
# to do the final publishing.
33+
# I have already added the PYPI_API_TOKEN in as one of the repository secrets,
34+
# so you don't have to worry about it.

.github/workflows/code-checks.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Code style checks
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
black:
7+
name: Check black compliance.
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2
13+
14+
- name: Setup Python
15+
uses: actions/setup-python@v2
16+
17+
- name: Install black
18+
run: python -m pip install black==19.10b0
19+
20+
- name: Run black
21+
run: black --config pyproject.toml --check .
22+
23+
interrogate:
24+
name: Check interrogate compliance.
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
31+
- name: Setup Python
32+
uses: actions/setup-python@v2
33+
34+
- name: Install interrogate
35+
run: python -m pip install interrogate
36+
37+
- name: Run interrogate
38+
run: interrogate .
39+
40+
darglint:
41+
name: Check darglint compliance.
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v2
47+
48+
- name: Setup Python
49+
uses: actions/setup-python@v2
50+
51+
- name: Install darglint
52+
run: python -m pip install darglint
53+
54+
- name: Run darglint
55+
run: darglint janitor -v 2
56+
57+
flake8:
58+
name: Check flake8 compliance.
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v2
64+
65+
- name: Setup Python
66+
uses: actions/setup-python@v2
67+
68+
- name: Install flake8
69+
run: python -m pip install flake8
70+
71+
- name: Run flake8
72+
run: flake8 . --exclude ./nbconvert_config.py

.github/workflows/tests.yml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: pyjanitor tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build-environment:
7+
name: Build environment
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2
13+
14+
# See: https://github.com/marketplace/actions/setup-conda
15+
- name: Setup anaconda
16+
uses: s-weigand/setup-conda@v1
17+
with:
18+
conda-channels: "conda-forge"
19+
20+
# Build cache of environment
21+
- name: Cache conda environment
22+
id: cache-environment
23+
uses: actions/cache@v2
24+
# Conda environment build step depends on two files,
25+
# so we ensure that the hash key contains both their hashes.
26+
with:
27+
path: |
28+
pyjanitor-dev.tar.gz
29+
key: ${{ runner.os }}-env.${{ hashFiles('environment-dev.yml') }}
30+
31+
- name: Build environment
32+
if: steps.cache-environment.outputs.cache-hit != 'true'
33+
run: |
34+
conda env create -f environment-dev.yml
35+
python -m pip install .
36+
37+
- name: Install conda-pack
38+
if: steps.cache-environment.outputs.cache-hit != 'true'
39+
run: conda install -c conda-forge conda-pack
40+
41+
- name: Run conda-pack
42+
if: steps.cache-environment.outputs.cache-hit != 'true'
43+
run: conda pack -n pyjanitor-dev -o pyjanitor-dev.tar.gz
44+
45+
# See: https://github.com/actions/upload-artifact
46+
- name: Upload environment
47+
uses: actions/upload-artifact@v2
48+
with:
49+
name: pyjanitor-dev-tarball
50+
path: pyjanitor-dev.tar.gz
51+
52+
unit-tests:
53+
name: Run unit tests
54+
runs-on: ubuntu-latest
55+
needs: build-environment
56+
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v2
60+
61+
# https://github.com/actions/download-artifact
62+
- name: Download environment tarball
63+
uses: actions/download-artifact@v2
64+
with:
65+
name: pyjanitor-dev-tarball
66+
67+
- name: Unpack environment and activate it
68+
run: bash scripts/ci/unpack_environment.sh
69+
70+
- name: Run tests
71+
run: |
72+
source /tmp/pyjanitor-dev_env/bin/activate
73+
python -m pip install -e .
74+
pytest
75+
76+
- name: Inspect coverage
77+
run: |
78+
cat coverage.xml
79+
80+
- name: Upload code coverage
81+
run: |
82+
source /tmp/pyjanitor-dev_env/bin/activate
83+
bash <(curl -s https://codecov.io/bash)
84+
85+
jupyter-notebook:
86+
name: Execute all Jupyter notebooks
87+
runs-on: ubuntu-latest
88+
needs: build-environment
89+
90+
steps:
91+
- name: Checkout repository
92+
uses: actions/checkout@v2
93+
94+
# https://github.com/actions/download-artifact
95+
- name: Download environment tarball
96+
uses: actions/download-artifact@v2
97+
with:
98+
name: pyjanitor-dev-tarball
99+
100+
- name: Unpack environment and activate it
101+
run: bash scripts/ci/unpack_environment.sh
102+
103+
- name: Execute Jupyter notebooks
104+
run: |
105+
source /tmp/pyjanitor-dev_env/bin/activate
106+
python -m pip install -e .
107+
python -m ipykernel install --user --name pyjanitor-dev
108+
jupyter nbconvert --to notebook --config nbconvert_config.py --execute --template full
109+
110+
docs:
111+
name: Build docs
112+
runs-on: ubuntu-latest
113+
needs: build-environment
114+
115+
steps:
116+
- name: Checkout repository
117+
uses: actions/checkout@v2
118+
119+
# https://github.com/actions/download-artifact
120+
- name: Download environment tarball
121+
uses: actions/download-artifact@v2
122+
with:
123+
name: pyjanitor-dev-tarball
124+
125+
- name: Unpack environment and activate it
126+
run: bash scripts/ci/unpack_environment.sh
127+
128+
129+
- name: Build docs
130+
run: |
131+
source /tmp/pyjanitor-dev_env/bin/activate
132+
python -m pip install -e .
133+
cd docs && make html
134+
135+
- name: Netlify PR preview
136+
uses: netlify/actions/cli@master
137+
with:
138+
args: deploy --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} --dir=docs/_build/html/

0 commit comments

Comments
 (0)