Skip to content

Commit

Permalink
Pull request #153: Infra update
Browse files Browse the repository at this point in the history
Merge in HYP/hypernetx from infra-update to develop

* commit '50129418bbad8a6c3aad98d554cae45c772d54e3':
  Move pytest config into pyproject
  Fix make targets
  Add poetry
  • Loading branch information
bonicim committed Apr 9, 2024
2 parents 9d3d22a + 5012941 commit 370e671
Show file tree
Hide file tree
Showing 16 changed files with 4,748 additions and 368 deletions.
2 changes: 1 addition & 1 deletion .cz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "cz_conventional_commits"
version = "2.2.0"
version_files = [
"setup.py",
"pyproject.toml",
"docs/source/conf.py",
"hypernetx/__init__.py"
]
Expand Down
54 changes: 28 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Continuous Integration

name: Run tests, linters, formatters

on:
push:
Expand All @@ -21,18 +20,14 @@ env:
LC_ALL: en_US.utf-8

jobs:

run-tests:

strategy:
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
os: [ubuntu-latest, macos-latest]
python: ['3.8', '3.9', '3.10', '3.11']

runs-on: ${{ matrix.os }}

steps:

- run: |
echo "This workflow was triggered by: $TRIGGER_PERSON"
env:
Expand All @@ -41,28 +36,35 @@ jobs:
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

- name: Checkout
uses: actions/checkout@v3
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Pylint
run: pip install pylint

# https://github.com/pre-commit/action
- name: Run pre-commit hooks
uses: pre-commit/[email protected]

- name: Run tests
run: |
make test-ci-github
- name: Install documentation dependencies
run: |
pip install sphinx sphinx_rtd_theme
pip install .'[documentation]'
- name: Check documentation build
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# install other testing dependencies
#----------------------------------------------
- name: Install tox, pytest-github, tox-gh-actions
run: pip install 'tox>=4.4.11' 'pytest-github-actions-annotate-failures>=0.1.7' 'tox-gh-actions'
#----------------------------------------------
# Run tests, linters defined in Tox
#----------------------------------------------
- name: Run tests, linters
run: |
sphinx-build docs/source _build
tox
53 changes: 47 additions & 6 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
name: Docs

on: [push, workflow_dispatch]

permissions:
contents: write

jobs:
docs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11.8'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: |
pip install .'[documentation]'
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --all-extras --no-interaction --with docs
#----------------------------------------------
# publish documentation
#----------------------------------------------
- name: Sphinx build
run: |
sphinx-build docs/source _build
poetry run sphinx-build docs/source _build
- name: Deploy
if: github.head_ref == 'master'
uses: peaceiris/actions-gh-pages@v3
Expand Down
44 changes: 11 additions & 33 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,25 @@ permissions:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "Building wheel from tag ${{ github.ref_name }}"
- uses: actions/checkout@v4

- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python3 -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Build and publish distribution 📦 to Test PyPI
uses: JRubics/[email protected]
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
python_version: "3.11.8"
pypi_token: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_name: "testpypi"
repository_url: "https://test.pypi.org/legacy/"

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Build and publish distribution 📦 to PyPI
uses: JRubics/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
print-hash: true
python_version: "3.11.18"
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.github/
.DS_Store
gitmerge.sh
dist
Expand Down Expand Up @@ -41,3 +40,4 @@ coverage.xml
cov.syspath.txt
*.whl
*dogsAndcats*
pytest_notebooks.xml
Loading

0 comments on commit 370e671

Please sign in to comment.