Run Tests #87
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
name: Run Tests | |
on: | |
schedule: | |
- cron: '0 8 * * 1-5' | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
code-format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.9' | |
architecture: x64 | |
- name: Install Dependencies | |
run: | | |
python -m pip install rdkit-pypi | |
python -m pip install networkx==2.1 | |
python -m pip install pycodestyle autopep8 | |
python -m pip install -r requirements.txt | |
python -m pip install -e . | |
python -m pip install sphinx sphinx-rtd-theme m2r mistune==0.8.4 | |
- name: Check Errors | |
run: | | |
pycodestyle --statistics --count --max-line-length=150 --show-source --exclude=interfaces/UI/libraries . | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} Subtest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install openpyxl | |
python -m pip install -r requirements.txt | |
python -m pip install -e . | |
python -m pip install coverage | |
- name: Run Tests | |
run: | | |
coverage run --source=. --omit=interfaces/*,aimsim/__main__.py,aimsim/tasks/__init__.py,aimsim/ops/__init__.py,aimsim/chemical_datastructures/__init__.py,aimsim/utils/__init__.py,setup.py,tests/*,aimsim/__init__.py,aimsim/utils/plotting_scripts.py -m unittest discover | |
- name: Show Coverage | |
run: | | |
coverage report -m | |
pypi: | |
name: Build and publish Python 🐍 distributions 📦 to PyPI | |
runs-on: ubuntu-latest | |
# only run if the tests pass | |
needs: build | |
# run only on pushes to master on AIMSim | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'VlachosGroup/AIMSim'}} | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: >- | |
python -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--wheel | |
--outdir dist/ | |
. | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip-existing: true | |
verbose: true |