Skip to content

CI Publish Package

CI Publish Package #6

Workflow file for this run

name: Python Package Dispatch
on:
workflow_dispatch: # Allows manual triggering of the workflow
pull_request:
branches:
- main
jobs:
build-and-publish:
runs-on: ubuntu-latest
env:
POETRY_HOME: /opt/poetry
VENV_PATH: venv
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Cache Poetry and virtual environment
id: cache-poetry
uses: actions/cache@v4
with:
path: |
/opt/poetry
~/.cache/pypoetry
.venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml') }}
# Install Poetry manually if not cached
- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
# Add Poetry to PATH
- name: Add Poetry to PATH
run: echo "/opt/poetry/bin" >> $GITHUB_PATH
# Install dependencies
- name: Install comeit
run: poetry install --no-interaction --no-ansi
- name: Build comeit
run: poetry run pytest