Skip to content

PyPi Publish Pipeline #13

PyPi Publish Pipeline

PyPi Publish Pipeline #13

name: PyPi Publish Pipeline
on:
workflow_dispatch:
workflow_call:
jobs:
compile-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Run commands
run: |
pip install poetry
poetry config virtualenvs.create false
poetry install --with dev
python scripts/compile.py
pytest
- name: Upload compiled binaries
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.os }}
path: quantcrypt/internal/bin
retention-days: 1
build:
needs: compile-test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Clean bin directory
run: rm -rf quantcrypt/internal/bin/*
- name: Download all compiled binaries
uses: actions/download-artifact@v4
with:
path: quantcrypt/internal/bin
merge-multiple: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Run commands
run: |
pip install poetry
poetry build
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: pypi-package
path: dist
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/quantcrypt/
permissions:
id-token: write
steps:
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: pypi-package
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1