Skip to content

build

build #765

Workflow file for this run

name: build
on:
push:
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
pull_request:
schedule:
- cron: "30 2 * * *"
jobs:
test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
tox-env: [py38, py39, py310, py311, linters, packaging, migrations]
include:
- tox-env: py38
python-version: 3.8
- tox-env: py39
python-version: 3.9
- tox-env: py310
python-version: "3.10"
- tox-env: py311
python-version: "3.11"
- tox-env: linters
python-version: "3.11"
- tox-env: packaging
python-version: "3.11"
- tox-env: migrations
python-version: "3.11"
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: rolca
POSTGRES_DB: rolca
ports:
- 5432/tcp
# Needed because the postgres container does not provide a healthcheck.
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
run: |
python -m pip install --upgrade pip
python -m pip install tox~=4.5.1
- name: Run Tox
run: python -m tox -e ${{ matrix.tox-env }} --skip-missing-interpreters false
env:
# Get randomly assigned published port.
ROLCA_POSTGRESQL_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Upload coverage to Codecov
if: matrix.tox-env == 'py38' || matrix.tox-env == 'py39' || matrix.tox-env == 'py310' || matrix.tox-env == 'py311'
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.codecov_token }}
file: .coverage
build:
runs-on: ubuntu-22.04
needs: test
if: "startsWith(github.ref, 'refs/tags')"
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install pep517
run: python -m pip install --user pep517
- name: Build a binary wheel and a source tarball
run: python -m pep517.build --source --binary --out-dir dist/ .
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/