Skip to content

Merge branch 'pk'

Merge branch 'pk' #303

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Test & Test-Publish
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, ]
pull_request:
branches: [ main, ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
name: Test
# The type of runner that the job will run on
strategy:
matrix:
python-version: ["3.10"]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Setup Poetry
# https://github.com/abatilo/actions-poetry
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.2.0"
# View poetry help
- name: View Poetry Help
run: poetry --help
# Install dependencies
- name: Install dependencies with test dependencies
run: poetry install --with test --no-root
# Test with PyTest and Coverage
- name: Test with PyTest and Coverage
run: poetry run invoke pytest-cov
# Build wheels and source tarball
# todo: Note that, at the moment, only pure python wheels are supported. Restriction due to poetry build system
- name: Build wheels and source tarball
run: |
poetry version
poetry build
poetry publish --dry-run --username=__token__ --password=${{ secrets.PYPI_API_TOKEN}}
publish_dev_build:
name: Publish Dev Build
# if test failed, we should not publish
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Setup Poetry
# https://github.com/abatilo/actions-poetry
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.2.0"
- name: Install build dependencies
run: poetry install --with build --no-root
# We are aware that this does not change version in all places as
# we are using poetry for bumping version.
# But Note that this is intended as it is just for dev purpose ;)
- name: Build wheels and source tarball
run: |
poetry version
poetry version --short
poetry version $(poetry version --short)dev$GITHUB_RUN_NUMBER
poetry build
poetry publish --dry-run --username=__token__ --password=${{ secrets.TEST_PYPI_API_TOKEN}}
- name: Check wheels and source tarball
run: poetry run twine check dist/*
- name: List files
run: |
cd dist
ls -l .
cd ..
# todo: temporary block publishing to test pypi
# Know more at https://github.com/pypa/gh-action-pypi-publish
# - name: Publish to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN}}
# repository_url: https://test.pypi.org/legacy/
# skip_existing: true
# verbose: true