Skip to content

Commit

Permalink
Run openklant client tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
swrichards committed Sep 4, 2024
1 parent 2264fb0 commit b4d4c13
Showing 1 changed file with 53 additions and 5 deletions.
58 changes: 53 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
test-type: [main, elastic]
test-type: [main, elastic, openklant]

services:
postgres:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up backend environment
uses: maykinmedia/setup-django-backend@v1
uses: maykinmedia/setup-django-backend@v1.1.1
with:
apt-packages: 'libxml2-dev libxmlsec1-dev libxmlsec1-openssl gettext postgresql-client libgdal-dev gdal-bin'
python-version: '3.11'
Expand All @@ -70,6 +70,8 @@ jobs:
--exclude-tag=elastic
elif [ "${{ matrix.test-type }}" = "elastic" ]; then
coverage run -p src/manage.py test src --tag=elastic --exclude-tag=e2e
elif [ "${{ matrix.test-type }}" = "openklant" ]; then
pytest --block-network --record-mode=none src/openklant2
else
echo "Error: Unknown test type '${{ matrix.test-type }}'"
exit 1
Expand All @@ -95,7 +97,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: '3.11'
- name: Install coverage.py
# We only need coverage, but we need to match the version that was used
# to generate the coverage files. Grab it from the dependencies.
Expand All @@ -113,6 +115,53 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

#
# OpenKlant client tests
#
# setup-python-with-uv:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v5
# id: setup_python
# with:
# python-version: 3.11

# - name: Install uv (pip alternative)
# id: setup_uv
# run: |
# pip install uv
# cache_dependency_path="./requirements/*.txt"
# ubuntu_version=$(lsb_release -rs)
# restore_key="uv-${{ runner.os }}-Ubuntu-${ubuntu_version}-python-${{ steps.setup_python.outputs.python-version }}"
# echo "uv_cache_dir=$(uv cache dir)" >> "$GITHUB_OUTPUT"
# echo "cache_dependency_path=${cache_dependency_path}" >> "$GITHUB_OUTPUT"
# echo "cache_restore_key=${restore_key}" >> "$GITHUB_OUTPUT"
# shell: bash

# - name: (Restore) uv cache
# uses: actions/cache@v4
# with:
# path: ${{ steps.setup_uv.outputs.uv_cache_dir }}
# key: ${{ steps.setup_uv.outputs.cache_restore_key }}-${{ hashFiles(steps.setup_uv.outputs.cache_dependency_path) }}
# restore-keys: |
# ${{ steps.setup_uv.outputs.cache_restore_key }}-
# save-always: 'true'

# - name: Install backend dependencies
# run: |
# uv pip install \
# --system \
# -r requirements/ci.txt
# shell: bash
# - name: Run tests
# run: |
# pytest --block-network --record-mode=none
# working-directory: src/openklant2
# shell: bash

#
# End-to-end tests
#
Expand Down Expand Up @@ -166,8 +215,7 @@ jobs:
uses: actions/cache@v3
with:
path: /home/runner/.cache/ms-playwright
key:
${{ runner.os }}-${{ matrix.browser }}-playwright-${{ hashFiles('requirements/ci.txt') }}
key: ${{ runner.os }}-${{ matrix.browser }}-playwright-${{ hashFiles('requirements/ci.txt') }}

- name: Install playwright deps
run: playwright install --with-deps ${{ matrix.browser }}
Expand Down

0 comments on commit b4d4c13

Please sign in to comment.