Skip to content

Commit

Permalink
add docs and release to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Nov 10, 2022
1 parent e59bb20 commit cb8634d
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 110 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/full_test.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/lint.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/release.yml
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
72 changes: 61 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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
Expand All @@ -33,23 +47,59 @@ jobs:
cache: "pip"
cache-dependency-path: '**/setup.py'

- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.6.0
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/mongodb-github-action@1.6.0
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/release-on-push-action@v0.25.0
with:
bump_version_scheme: norelease

0 comments on commit cb8634d

Please sign in to comment.