diff --git a/.forgejo/workflows/demo.yml b/.forgejo/workflows/demo.yml deleted file mode 100644 index d470cda..0000000 --- a/.forgejo/workflows/demo.yml +++ /dev/null @@ -1,6 +0,0 @@ -on: [push] -jobs: - test: - runs-on: docker - steps: - - run: echo All Good diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml new file mode 100644 index 0000000..cea1f66 --- /dev/null +++ b/.forgejo/workflows/tests.yml @@ -0,0 +1,57 @@ +on: [ push ] + +env: + POSTGRES_HOST: "postgres" + POSTGRES_DB: "newsreader" + POSTGRES_USER: "newsreader" + POSTGRES_PASSWORD: "newsreader" + +jobs: + test: + runs-on: docker + + services: + postgres: + image: postgres:15 + env: + POSTGRES_HOST: "${{ env.POSTGRES_HOST }}" + POSTGRES_DB: "${{ env.POSTGRES_NAME }}" + POSTGRES_NAME: "${{ env.POSTGRES_NAME }}" + POSTGRES_USER: "${{ env.POSTGRES_USER }}" + POSTGRES_PASSWORD: "${{ env.POSTGRES_PASSWORD }}" + memcached: + image: memcached:1.5.22 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - uses: actions/cache@v4 + with: + path: "${{ GITHUB_WORKSPACE }}/.cache/uv" + key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} + restore-keys: | + ${{ runner.os }}-uv- + - uses: actions/cache@v4 + with: + path: "${{ GITHUB_WORKSPACE }}/.cache/pip" + key: ${{ runner.os }}-pip- + restore-keys: | + ${{ runner.os }}-pip- + + - run: pip install uv + env: + PIP_CACHE_DIR: "${{ GITHUB_WORKSPACE }}/.cache/pip" + - run: uv sync --extra testing --extra ci + env: + UV_CHACHE_DIR: "${{ GITHUB_WORKSPACE }}/.cache/uv" + + - run: ./.venv/bin/coverage run ./src/manage.py test newsreader + env: + DJANGO_SETTINGS_MODULE: "newsreader.conf.ci" + POSTGRES_HOST: "${{ env.POSTGRES_HOST }}" + POSTGRES_DB: "${{ env.POSTGRES_NAME }}" + POSTGRES_NAME: "${{ env.POSTGRES_NAME }}" + POSTGRES_USER: "${{ env.POSTGRES_USER }}" + POSTGRES_PASSWORD: "${{ env.POSTGRES_PASSWORD }}" diff --git a/src/newsreader/conf/gitlab.py b/src/newsreader/conf/ci.py similarity index 97% rename from src/newsreader/conf/gitlab.py rename to src/newsreader/conf/ci.py index e08556d..40c4a2f 100644 --- a/src/newsreader/conf/gitlab.py +++ b/src/newsreader/conf/ci.py @@ -33,7 +33,7 @@ CACHES = { # Project settings VERSION = get_current_version() -ENVIRONMENT = "gitlab" +ENVIRONMENT = "ci" try: # Optionally use sentry integration