Refactor LDAP test to remove dependency on mockldap #258
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run unit tests | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| DATABASE_NAME: dejacode | |
| DATABASE_USER: dejacode | |
| DATABASE_PASSWORD: dejacode | |
| POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8 | |
| jobs: | |
| run-unit-tests: | |
| runs-on: ubuntu-24.04 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_DB: ${{ env.DATABASE_NAME }} | |
| POSTGRES_USER: ${{ env.DATABASE_USER }} | |
| POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }} | |
| POSTGRES_INITDB_ARGS: ${{ env.POSTGRES_INITDB_ARGS }} | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| # - name: Install python-ldap OS dependencies | |
| # run: | | |
| # sudo apt-get update | |
| # # https://github.com/python-ldap/python-ldap/blob/main/.github/workflows/ci.yml | |
| # sudo apt-get install -y libldap2-dev libsasl2-dev slapd ldap-utils enchant-2 apparmor-utils | |
| # # Disable AppArmor for slapd to allow slapdtest to create temp instances | |
| # sudo aa-disable /usr/sbin/slapd | |
| - name: Install python-ldap OS dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libldap2-dev libsasl2-dev slapd ldap-utils | |
| # Stop system slapd - slapdtest will create its own test instances | |
| sudo systemctl stop slapd | |
| sudo systemctl disable slapd | |
| - name: Install dependencies | |
| run: make dev envfile | |
| - name: Validate code format | |
| run: make check | |
| - name: Start Redis | |
| uses: supercharge/[email protected] | |
| - name: Build the documentation | |
| run: make docs | |
| - name: Run tests | |
| run: .venv/bin/python manage.py test --verbosity=2 --noinput --parallel |