Skip to content

Merge branch 'feat/GitHubAction-PythonVersions' into dev/1.2.0 #103

Merge branch 'feat/GitHubAction-PythonVersions' into dev/1.2.0

Merge branch 'feat/GitHubAction-PythonVersions' into dev/1.2.0 #103

name: Test build and publish Cobramod to PyPI
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * 1"
pull_request:
types: [ opened, synchronize, reopened, closed ]
branches:
- master
jobs:
lint-format-unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: python -m pip install .
- name: Install tox
run: python -m pip install tox-gh>=1.2
- name: Setup test suite
run: tox -vv --notest
- name: Credentials
run: echo "${{ secrets.BIOCYC_USER }}\n${{ secrets.BIOCYC_PASS }}" >> credentials.txt
- name: Run test suite
run: tox --skip-pkg-install
build-publish:
needs: [lint-format-unittest]
name: Build and publish the package to TestPyPI
if: github.event.pull_request.merged == true && github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel twine build
- name: Build package
run: python -m build
- name: Check the package
run: twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run:
twine upload --non-interactive dist/*