This repository was archived by the owner on Jun 9, 2025. It is now read-only.
ci: fix pypi publish #602
Workflow file for this run
This file contains hidden or 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
# Run test suite using tox. | |
name: ci | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "main" | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.3 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Bump Version | |
run: poetry version ${{ github.event.release.tag_name }} && poetry lock | |
- name: Build | |
run: poetry build | |
mypy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.3 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load Cached Packages | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install Packages | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
- name: Install Stubs | |
run: poetry run mypy --install-types . --non-interactive | |
- name: Run | |
run: poetry run mypy . | |
test: | |
runs-on: ubuntu-22.04 | |
services: | |
redis: | |
image: bitnami/redis:6.0 | |
env: | |
ALLOW_EMPTY_PASSWORD: 'no' | |
REDIS_PASSWORD: 'virtool' | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.3 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load Cached Packages | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install Packages | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
- name: Test | |
run: poetry run pytest --redis-connection-string redis://:virtool@localhost:6379 | |
release: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' | |
needs: | |
- test | |
- build | |
- mypy | |
outputs: | |
git-tag: ${{ steps.semantic.outputs.git-tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install semantic-release | |
run: npm i semantic-release@^v24.0.0 conventional-changelog-conventionalcommits@^8.0.0 | |
- name: Run semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: semantic | |
run: npx semantic-release | |
pypi: | |
runs-on: ubuntu-22.04 | |
if: github.repository_owner == 'Virtool' && github.event_name == 'push' && needs.release.outputs.git-tag != '' | |
needs: | |
- release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.release.outputs.git-tag }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.3 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Bump Version | |
run: poetry version ${{ needs.release.outputs.git-tag }} && poetry lock | |
- name: Build | |
run: poetry build | |
- name: Publish | |
run: poetry publish -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_TOKEN }} |