From 7c26cf252db2bfe1c3510ae93a517c29e216f730 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 16 Feb 2024 14:20:35 -0500 Subject: [PATCH] Add gitea action to run tests --- .gitea/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ cmsmanage/settings/ci.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .gitea/workflows/test.yml create mode 100644 cmsmanage/settings/ci.py diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..d987358 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test +on: [ push, pull_request ] + +env: + DJANGO_SETTINGS_MODULE: cmsmanage.settings.ci + +jobs: + test: + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + services: + mariadb: + image: mariadb:latest + env: + MARIADB_ROOT_PASSWORD: whatever + ports: + - 3306:3306 + healthcheck: + test: ["CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized"] + steps: + - uses: actions/checkout@v4 + - name: Setup PDM + uses: pdm-project/setup-pdm@v4 + with: + cache: true + python-version: ~3.11 + - name: Install apt dependencies + run: >- + sudo apt-get update && + sudo apt-get -y install build-essential python3-dev libldap2-dev libsasl2-dev mariadb-client + - name: Install python dependencies + run: pdm install + - name: Run tests + run: pdm run ./manage.py test --parallel auto diff --git a/cmsmanage/settings/ci.py b/cmsmanage/settings/ci.py new file mode 100644 index 0000000..f9aa2dc --- /dev/null +++ b/cmsmanage/settings/ci.py @@ -0,0 +1,33 @@ +from .base import * # noqa: F403 + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "aed7jee2kai1we9eithae0gaegh9ohthoh4phahk5bau4Ahxaijo3aicheex3qua" + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.mysql", + "HOST": "mariadb", + "NAME": "CMS_Database", + "USER": "root", + "PASSWORD": "whatever", + "OPTIONS": { + "charset": "utf8mb4", + }, + }, + "membershipworks": { + "ENGINE": "django.db.backends.mysql", + "HOST": "mariadb", + "NAME": "membershipworks", + "USER": "root", + "PASSWORD": "whatever", + "OPTIONS": { + "charset": "utf8mb4", + }, + }, +}