-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docs and release to github actions
- Loading branch information
Showing
4 changed files
with
138 additions
and
110 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Build package | ||
run: | | ||
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools build setuptools setuptools_scm wheel | ||
python${{ matrix.python-version }} -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1.5 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9"] | ||
needs: | ||
- deploy | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools setuptools_scm | ||
python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt | ||
# Using non-editable install for testing building of MANIFEST files | ||
python${{ matrix.python-version }} -m pip install --no-deps . | ||
- name: Build | ||
run: | | ||
cd docs_rst | ||
python${{ matrix.python-version }} featurizer_summary.py > featurizer_summary.rst | ||
python${{ matrix.python-version }} dataset_summary.py > dataset_summary.rst | ||
sphinx-apidoc -o . -f ../matminer | ||
make html | ||
cp _static/* ../docs/html/_static | ||
cd ../docs | ||
cp -r html/* . | ||
rm -r html | ||
rm -r doctrees | ||
touch .nojekyll | ||
git add . | ||
git commit -a -m "update docs" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,27 @@ | |
# The ext package is also only tested in this workflow. Coverage is also computed based on this platform. | ||
name: Testing | ||
|
||
on: [ push, pull_request ] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
workflow_dispatch: | ||
inputs: | ||
fullTest: | ||
description: "run full test" | ||
required: true | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
|
||
test: | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ["3.8", "3.9"] | ||
mongodb-version: ['4.0'] | ||
|
@@ -20,9 +34,9 @@ jobs: | |
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }} | ||
MPDS_KEY: ${{ secrets.MPDS_KEY }} | ||
CITRINATION_API_KEY: ${{ secrets.CITRINATION_API_KEY }} | ||
MATMINER_DATASET_FULL_TEST: False | ||
RUNNING_ON_GHACTIONS: "True" | ||
MPLBACKEND: "Agg" | ||
MATMINER_DATASET_FULL_TEST: ${{ inputs.fullTest }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -33,23 +47,59 @@ jobs: | |
cache: "pip" | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: ${{ matrix.mongodb-version }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools | ||
python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools build setuptools setuptools_scm wheel | ||
python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt | ||
# Using non-editable install for testing building of MANIFEST files | ||
python${{ matrix.python-version }} -m pip install --no-deps . | ||
- name: linting | ||
run: | | ||
black --version | ||
black --check --diff --color matminer | ||
flake8 --version | ||
flake8 --count --show-source --statistics matminer | ||
# exit-zero treats all errors as warnings. | ||
flake8 --count --exit-zero --max-complexity=20 --statistics matminer | ||
# mypy --version | ||
# rm -rf .mypy_cache | ||
# mypy matminer | ||
# pydocstyle --count matminer | ||
# pylint matminer | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: ${{ matrix.mongodb-version }} | ||
|
||
- name: Run tests | ||
run: | | ||
# Sleeping to allow mongo a bit more time to boot, avoiding connect errors | ||
sleep 10 | ||
echo "start mongo ..." | ||
mongo localhost/admin --eval 'db.createUser({user: "admin",pwd: "password",roles: [ { role: "root", db: "admin" } ]})' | ||
echo "run tests ..." | ||
python${{ matrix.python-version }} -m pytest --cov=matminer matminer | ||
- name: Build package | ||
if: matrix.python-version == "3.9" | ||
run: python${{ matrix.python-version }} -m build | ||
|
||
- name: Publish distribution 📦s to Test PyPI | ||
if: matrix.python-version == "3.9" | ||
uses: pypa/gh-action-pypi-publish@release/v1.5 | ||
with: | ||
skip_existing: true | ||
repository_url: https://test.pypi.org/legacy/ | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_TOKEN }} | ||
|
||
auto-gen-release: | ||
needs: | ||
- test | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
steps: | ||
- uses: rymndhng/[email protected] | ||
with: | ||
bump_version_scheme: norelease |