Skip to content

Updating Version for Release #585

Updating Version for Release

Updating Version for Release #585

Workflow file for this run

name: Continuous integration
on:
push:
pull_request:
jobs:
getVersionNumber:
name: Get version number
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:
- id: get-version-number
name: Get version number
env:
TAG: ${{ github.ref }}
run: |
version="${TAG/refs\/tags\//}"
echo "version=$version" >> $GITHUB_OUTPUT
build:
name: Lint, test, and compile documentation
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@v4
with:
fetch-depth: 1
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "biosimulatorsdaemon"
git config pull.rebase false
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install pip and setuptools
run: |
python -m pip install pip==23.0.0
python -m pip install pip==23.0.0
python -m pip --version
- name: Install Java # for pyNeuroML
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '15'
- name: Install Perl # for BioNetGen
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends perl
- name: Install XPP
run: |
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: 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
poetry run python scripts/zip_examples.py
- id: commit-archives
name: Commit zipped COMBINE/OMEX archives
if: startsWith(github.ref, 'refs/heads/')
env:
HEAD: ${{ github.ref }}
run: |
git stash || true
git pull
set +e
git stash pop || true
git add examples/**/*.omex
git commit -m "chore: Updated COMBINE/OMEX archives [skip ci]"
if [[ $? = 0 ]]; then
archivesChanged=1
else
archivesChanged=0
fi
echo "archivesChanged=$archivesChanged" >> $GITHUB_OUTPUT
branch="${HEAD/refs\/heads\//}"
echo "branch=$branch" >> $GITHUB_OUTPUT
- name: Push the zipped COMBINE/OMEX archives
if: steps.commit-archives.outputs.archivesChanged == '1' && startsWith(github.ref, 'refs/heads/')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.commit-archives.outputs.branch }}
# lint
- name: Lint the package
run: poetry run python -m flake8 $GITHUB_WORKSPACE/biosimulators_test_suite
- name: Run the tests
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: |
poetry run python -m pip install --upgrade setuptools
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
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
file: ./coverage.xml
# compile documentation
- name: Install the requirements for compiling the documentation
run: poetry install --with docs
- name: Compile the documentation
run: |
poetry run sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
mkdir -p docs-src/_static
poetry run sphinx-build docs-src docs
- name: Setup tmate session 3 (if failed)
uses: mxschmitt/action-tmate@v3
if: ${{ failure() }}
timeout-minutes: 40
release:
name: Release a new version
needs: [getVersionNumber, build]
runs-on: ubuntu-22.04
outputs:
docsChanged: ${{ steps.commit-docs.outputs.docsChanged }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: dev
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "biosimulatorsdaemon"
git config pull.rebase false
- name: Set up the environment
uses: ./.github/actions/setup-poetry-env
with:
python-version: ${{ matrix.python-version }}
# compile and push documentation
- name: Install the requirements for compiling the documentation
run: poetry install --with docs
- name: Compile the documentation
run: |
poetry run sphinx-apidoc . setup.py --output-dir docs-src/source --force --module-first --no-toc
mkdir -p docs-src/_static
poetry run sphinx-build docs-src docs
- id: commit-docs
name: Commit the compiled documentation
run: |
git stash
git pull
set +e
git stash pop
git add docs
git commit -m "chore: Updated compiled documentation [skip ci]"
if [[ $? = 0 ]]; then
changed=1
else
changed=0
fi
echo "changed=$changed" >> $GITHUB_OUTPUT
- name: Push the compiled documentation
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: dev
# Create GitHub release
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.getVersionNumber.outputs.version }}
release_name: Release ${{ needs.getVersionNumber.outputs.version }}
# Create PyPI release
- name: Create packages to upload to PyPI
run: |
poetry build
- name: Upload packages to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
poetry publish --no-interaction --username __token__ --password $POETRY_PYPI_TOKEN_PYPI