Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry build #72

Merged
merged 43 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
28ab1ec
starting to document
CodeByDrescher Dec 16, 2022
4f23c2a
More documenting
CodeByDrescher Dec 19, 2022
8c43797
getting deeper now!
CodeByDrescher Dec 19, 2022
901fd6f
small change
CodeByDrescher Dec 20, 2022
c94e548
hunting down differences
CodeByDrescher Dec 20, 2022
3533f7c
more documentation fixes
CodeByDrescher Dec 21, 2022
b4d1e19
locked down reqs
CodeByDrescher Jan 9, 2023
edd273a
version bugfix
CodeByDrescher Jan 9, 2023
6bcb3ef
added hdf5 fixed string handling
CodeByDrescher Feb 9, 2023
34150b4
upgrading minimum biosimulators utils version
CodeByDrescher Apr 24, 2023
d5067ec
added pipfile and lock file
CodeByDrescher Apr 24, 2023
d0b21c3
added pipenv lock file
CodeByDrescher Apr 25, 2023
8b318f6
Unlimiting biosimulators_utils
CodeByDrescher Sep 1, 2024
3e661a9
restoring lockdown
CodeByDrescher Sep 1, 2024
0008836
locking down dependencies
CodeByDrescher Sep 1, 2024
9b39272
allowing earlier versions of BSU
CodeByDrescher Sep 1, 2024
c83dd04
Added pyproject.toml
CodeByDrescher Sep 4, 2024
1f10a14
updated git ignore file
CodeByDrescher Sep 5, 2024
ef80fcd
tweaked dependencies
CodeByDrescher Sep 5, 2024
5ee42ea
Locked down python version & new lock file
CodeByDrescher Sep 5, 2024
9f99b61
updaing lock file
CodeByDrescher Sep 6, 2024
4108768
Attempting to get clearer error message
CodeByDrescher Sep 6, 2024
1869f11
Added "containall" parameter to singularity
CodeByDrescher Sep 17, 2024
388cc35
Change relative paths to absolute
CodeByDrescher Sep 17, 2024
cc58564
Fixes to CI and syntaxes
CodeByDrescher Sep 18, 2024
04065f7
Temporarily removing RBA support
CodeByDrescher Sep 18, 2024
cd4cab0
Updated to use correct version of BSU
CodeByDrescher Sep 18, 2024
3f69ca7
Fixed bug where all simulations caused error
CodeByDrescher Sep 18, 2024
2202817
Merge remote-tracking branch 'origin/dev' into poetry-build
CodeByDrescher Sep 18, 2024
b77ca4f
Attempting to specify repository to investigate
CodeByDrescher Sep 18, 2024
e508220
wrong env var
CodeByDrescher Sep 18, 2024
0f66753
Attempting to narrow linting
CodeByDrescher Sep 18, 2024
e2b47ed
attempting to enforce pytest coverage
CodeByDrescher Sep 18, 2024
b856324
attempting to solve cov problem with setuptools
CodeByDrescher Sep 18, 2024
a60a2ab
Attempting to force setuptools upgrade
CodeByDrescher Sep 18, 2024
3917709
Adding tmate
CodeByDrescher Sep 19, 2024
bb1ac56
Fixed bug where 'id' not a key was not handled
CodeByDrescher Sep 19, 2024
a0c67ec
Added missing dev dependencies
CodeByDrescher Sep 19, 2024
963b0a3
Forgot lock file + dependency collision
CodeByDrescher Sep 19, 2024
44e48c6
Fixed and added testing
CodeByDrescher Sep 19, 2024
8543395
Restoring hard-coded skip
CodeByDrescher Sep 19, 2024
dc1d236
Linting fix
CodeByDrescher Sep 19, 2024
3b16e88
Updating Version for Release
CodeByDrescher Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/actions/setup-poetry-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "setup-poetry-env"
description: "Composite action to setup the Python and poetry environment."

inputs:
python-version:
required: false
description: "The python version to use"
default: "3.11"

runs:
using: "composite"
steps:
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Install Poetry
env:
POETRY_VERSION: "1.7.1"
run: curl -sSL https://install.python-poetry.org | python - -y
shell: bash

- name: Add Poetry to Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash

- name: Configure Poetry virtual environment in project
run: poetry config virtualenvs.in-project true
shell: bash

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
shell: bash
146 changes: 50 additions & 96 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Continuous integration

on:
- push
push:
pull_request:

jobs:
getVersionNumber:
name: Get version number
if: startsWith(github.ref, 'refs/tags/') && github.actor != 'biosimulators-daemon' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-20.04
if: "startsWith(github.ref, 'refs/tags/') && github.actor != 'allcontributors' && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get-version-number.outputs.version }}
steps:
Expand All @@ -18,15 +19,21 @@ jobs:
run: |
version="${TAG/refs\/tags\//}"
echo "version=$version" >> $GITHUB_OUTPUT
echo "version=$version"

build:
name: Lint, test, and compile documentation
if: github.actor != 'biosimulators-daemon' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'allcontributors'"
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [ "3.10" ]
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -39,17 +46,9 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'

- name: Setup pip cache
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/Python
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.optional.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install pip
- name: Install pip and setuptools
run: |
python -m pip install pip==23.0.0
python -m pip install pip==23.0.0
Expand All @@ -68,23 +67,23 @@ jobs:

- name: Install XPP
run: |
sudo apt-get install -y --no-install-recommends xppaut
sudo apt-get install -y --no-install-recommends wget make gcc libx11-dev libc6-dev xppaut

- name: Install Singularity # to validate that the Docker image can be converted into a Singularity image
uses: eWaterCycle/setup-singularity@v6

# install package
- name: Install the package
run: |
python -m pip install git+https://github.com/biosimulators/RBApy.git#egg=rbapy
python -m pip install .[all]
- name: Set up the environment
uses: ./.github/actions/setup-poetry-env
with:
python-version: ${{ matrix.python-version }}

# zip COMBINE/OMEX archives
- name: Zip COMBINE/OMEX archives
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends zipcmp
python scripts/zip_examples.py
poetry run python scripts/zip_examples.py

- id: commit-archives
name: Commit zipped COMBINE/OMEX archives
Expand Down Expand Up @@ -116,25 +115,16 @@ jobs:
branch: ${{ steps.commit-archives.outputs.branch }}

# lint
- name: Install flake8
run: python -m pip install flake8

- name: Lint the package
run: python -m flake8

# test and upload coverage report to Codecov
- name: Install pytest
run: python -m pip install pytest pytest-cov

- name: Install the requirements for the tests
run: python -m pip install .[tests]
run: poetry run python -m flake8

- name: Run the tests
# env:
# BIOSIMULATORS_API_ENDPOINT: https://api.biosimulators.dev/ # uncomment to run tests using the dev deployment
uses: GabrielBB/xvfb-action@v1
env:
MPLBACKEND: PDF
# BIOSIMULATORS_API_ENDPOINT: https://api.biosimulators.dev/ # uncomment to execute tests with the dev deployment
with:
run: python -m pytest tests/ --cov=./biosimulators_test_suite --cov-report=xml
run: poetry run python -m pytest tests/ --cov=./biosimulators_test_suite --cov-report=xml

- name: Upload the coverage report to Codecov
uses: codecov/codecov-action@v2
Expand All @@ -145,92 +135,70 @@ jobs:

# compile documentation
- name: Install the requirements for compiling the documentation
run: python -m pip install -r docs-src/requirements.txt
run: poetry install --with docs

- name: Compile the documentation
run: |
sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
poetry run sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
mkdir -p docs-src/_static
sphinx-build docs-src docs
poetry run sphinx-build docs-src docs

release:
name: Release a new version
needs: [getVersionNumber, build]
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
docsChanged: ${{ steps.commit-docs.outputs.docsChanged }}
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1
branch: deploy
ref: dev

- name: Configure Git
run: |
git config --local user.email "biosimulators.daemon@gmail.com"
git config --local user.name "biosimulatorsdaemon"
git config pull.rebase false

- name: Install Python
uses: actions/setup-python@v2
- name: Set up the environment
uses: ./.github/actions/setup-poetry-env
with:
python-version: '3.9'

- name: Setup pip cache
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/Python
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.optional.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install pip and setuptools
run: |
#python -m pip install --upgrade pip
python -m pip install --upgrade setuptools

# install package
- name: Install the package
run: |
python -m pip install git+https://github.com/biosimulators/RBApy.git#egg=rbapy
python -m pip install .[all]
python-version: ${{ matrix.python-version }}

# compile and push documentation
- name: Install the requirements for compiling the documentation
run: python -m pip install -r docs-src/requirements.txt
run: poetry install --with docs

- name: Compile the documentation
run: |
sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
poetry run sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
mkdir -p docs-src/_static
sphinx-build docs-src docs
poetry run sphinx-build docs-src docs

- id: commit-docs
name: Commit the compiled documentation
run: |
git stash || true
git stash
git pull
set +e
git stash pop || true
git stash pop
git add docs
git add docs-src
git commit -m "chore: Updating compiled documentation [skip ci]"
git checkout .
git clean -f -d
git commit -m "chore: Updated compiled documentation [skip ci]"
if [[ $? = 0 ]]; then
docsChanged=1
changed=1
else
docsChanged=0
changed=0
fi
echo "docsChanged=$docsChanged" >> $GITHUB_OUTPUT
echo "changed=$changed" >> $GITHUB_OUTPUT

- name: Push the compiled documentation
if: steps.commit-docs.outputs.docsChanged == '1'
if: steps.commit-identifiers-namespaces.outputs.changed == '1' || steps.commit-docs.outputs.changed == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: deploy
branch: dev

# Create GitHub release
- name: Create GitHub release
Expand All @@ -242,26 +210,12 @@ jobs:
release_name: Release ${{ needs.getVersionNumber.outputs.version }}

# Create PyPI release
- name: Install pandoc
run: |
sudo apt-get update -y
sudo apt-get install -y pandoc

- name: Convert README to .rst format
run: pandoc --from=gfm --output=README.rst --to=rst README.md

- name: Install twine
run: |
python -m pip install wheel twine

- name: Create packages to upload to PyPI
run: |
python setup.py sdist
python setup.py bdist_wheel
poetry build

- name: Upload packages to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*
poetry publish --no-interaction --username __token__ --password $POETRY_PYPI_TOKEN_PYPI
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ docs/.buildinfo
docs/.doctrees/
docs/_raw_sources/
docs/_sources/

# Development IDEs
.idea
.idea/*
20 changes: 20 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
biosimulators-utils = {version = ">=0.1.175", extras = ["bngl", "cellml", "containers", "lems", "neuroml", "sbml", "smoldyn"]}
cement = "<=3.0.6"
docker = "<=5.0.3"
natsort = "<=8.1.0"
pypdf2 = "<=2.8.1"
python-dateutil = "<=2.8.2"
pyyaml = "<=5.3.1"
simplejson = "<=3.16.0"
termcolor = "<=1.1.0"

[dev-packages]

[requires]
python_version = "3.9"
Loading
Loading