Add gitea action to run tests
Some checks failed
Ruff / ruff (push) Successful in 25s
Test / test (push) Failing after 32s

This commit is contained in:
Adam Goldsmith 2024-02-16 14:20:35 -05:00
parent 9568a32b00
commit 7c26cf252d
2 changed files with 67 additions and 0 deletions

34
.gitea/workflows/test.yml Normal file
View File

@ -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

33
cmsmanage/settings/ci.py Normal file
View File

@ -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",
},
},
}