Simpler Template #701
This file contains 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: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- main | |
- release/* | |
types: | |
- ready_for_review | |
- opened | |
- reopened | |
- synchronize | |
workflow_dispatch: | |
jobs: | |
integration: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
services: | |
# Postgres service container | |
postgres: | |
image: sibedge/postgres-plv8 | |
env: | |
# Specify the password for Postgres superuser. | |
POSTGRES_PASSWORD: a!b@c$d()e*_,/:;=?@ff[]22 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# Zookeeper service container (required by Kafka) | |
zookeeper: | |
image: bitnami/zookeeper | |
ports: | |
- 2181:2181 | |
env: | |
ALLOW_ANONYMOUS_LOGIN: yes | |
options: >- | |
--health-cmd "echo mntr | nc -w 2 -q 2 localhost 2181" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# Kafka service container | |
kafka: | |
image: bitnami/kafka | |
ports: | |
- 9092:9092 | |
options: >- | |
--health-cmd "kafka-broker-api-versions.sh --version" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 | |
ALLOW_PLAINTEXT_LISTENER: yes | |
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092 | |
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: 'x64' | |
- name: Install Dependencies | |
run: pdm install | |
working-directory: ./ | |
- name: Check Types | |
run: pdm run mypy . | |
working-directory: ./ | |
- name: Run Unit Tests | |
run: pdm run pytest | |
working-directory: ./ | |
env: | |
PGPASSWORD: a!b@c$d()e*_,/:;=?@ff[]22 |