Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# GitHub Actions workflow to build, test and publish Python packages to PyPI everytime a new release is created.

name: Publish release

on:
release:
types:
- published

jobs:
build:
name: Build package
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

# We use Python 3.8 here because it's the minimum Python version supported by this library.
- name: Setup Python 3.8
Comment thread
the-infinity marked this conversation as resolved.
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install dependencies
run: pip install --upgrade pip build

- name: Build package
run: python -m build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist_packages
path: dist/

test:
# This job tests the built package by installing it via pip and running unit tests (without tox).
name: Test package
needs: build
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist_packages
path: dist/

- name: Install built package with testing dependencies
run: pip install "$(find dist/ -name 'validataclass-search-queries-*.whl')[testing]"

- name: Run unit tests
run: python -m pytest

publish:
name: Publish package
needs: test
runs-on: ubuntu-24.04

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist_packages
path: dist/

- name: Upload package to GitHub release assets
uses: AButler/upload-release-assets@v3.0
with:
files: dist/*
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# GitHub Actions workflow for running unit tests (using tox, pytest and flake8) on each push or pull request to main.

name: Unit tests

# TODO: Remove dev-mypy after merging it into main.
on:
push:
branches:
- main
- dev-mypy
pull_request:
branches:
- main
- dev-mypy

jobs:
test:
name: Run unit tests (Python ${{ matrix.python-version }}, SQLAlchemy ${{ matrix.sqlalchemy-version }})
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
sqlalchemy-version:
- '1.4'
- '2.0'

steps:
- uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install --upgrade pip tox

- name: Run test suite with tox
# Run tox using the version of Python in `PATH`
run: tox run -e clean,py-sqlalchemy${{ matrix.sqlalchemy-version }},report,flake8 -- --junit-xml=reports/pytest_${{ matrix.python-version }}_sqlalchemy${{ matrix.sqlalchemy-version }}.xml

- name: Upload test result artifacts
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: pytest-results-${{ matrix.python-version }}-sqlalchemy${{ matrix.sqlalchemy-version }}
path: reports/pytest_${{ matrix.python-version }}_sqlalchemy${{ matrix.sqlalchemy-version }}.xml

report:
name: Publish unit test reports
runs-on: ubuntu-24.04

# Job depends on test results
needs: test

# Do not run this job in pull requests from a forked repository (because the test-reporter would fail)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository

steps:
- uses: actions/checkout@v4

- name: Download test result artifacts
uses: actions/download-artifact@v4
with:
path: reports/
pattern: pytest-results-*
merge-multiple: true

- name: Publish unit test reports
uses: dorny/test-reporter@v2.1.1
if: success() || failure()
with:
name: Pytest Report
path: reports/pytest_*.xml
reporter: java-junit
69 changes: 0 additions & 69 deletions .gitlab-ci.yml

This file was deleted.

Loading
Loading