Skip to content

Add minimal reproducable example #243

Add minimal reproducable example

Add minimal reproducable example #243

Workflow file for this run

name: Tests
on:
workflow_dispatch: # allow to run manually
push:
pull_request:
jobs:
lint:
strategy:
fail-fast: false
runs-on: ubuntu-latest
name: Lint
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install \
build-essential \
git \
gcc \
libpq-dev \
make \
postgresql \
libpoppler-cpp-dev \
pkg-config \
python3-dev \
--fix-missing
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install -r requirements.txt -r tests_requirements.txt
env:
UV_SYSTEM_PYTHON: true
- name: Linting
run: flake8 src/ tests/ stubs/
- name: Check security issues
run: bandit --recursive --configfile pyproject.toml src/
- name: Static type checking
run: bash mypy.sh
env:
SKIP_VENV: 1
test:
strategy:
fail-fast: false
matrix:
group: [1] # expand as needed for parallelizing
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Test group ${{ matrix.group }}
steps:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install \
build-essential \
git \
gcc \
libpq-dev \
make \
postgresql \
libpoppler-cpp-dev \
pkg-config \
python3-dev \
--fix-missing
export LC_ALL="C.UTF-8"
export LANG="C.UTF-8"
- name: Checkout repo
uses: actions/checkout@v4
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: |
echo "BUILDKITE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" \
>> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: |
echo "BUILDKITE_BRANCH=$(echo ${GITHUB_HEAD_REF} | tr / -)" \
>> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install pytest-split pytest-cov pytest-codecov
# TEMPORARY: editable build so we don't need a path-fix in codecov
uv pip install -e .[test]
env:
UV_SYSTEM_PYTHON: true
- name: Run tests
run: |
pytest \
--splits "1" \
--group "${{matrix.group}}" \
--cov \
--cov-config=pyproject.toml \
--codecov \
--codecov-branch="$BUILDKITE_BRANCH" \
--codecov-commit="$GITHUB_SHA" \
--codecov-slug=seantis/privatim \
--codecov-token="${{ secrets.CODECOV_TOKEN }}" \
tests