Skip to content

ci

ci #38

Workflow file for this run

name: ci
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
push:
branches: [master]
pull_request:
branches: [master]
release:
types: [released]
env:
POETRY_VERSION: "1.3.1"
PYTHON_PUBLISH_VERSION: "3.10"
# 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:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run poetry image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-root
- name: Test with pytest
run: poetry run pytest
publish:
if: github.event_name == 'release'
needs: test
runs-on: ubuntu-20.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_PUBLISH_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_PUBLISH_VERSION }}
- name: Run poetry image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Build
run: poetry build
- name: Publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
run: poetry publish