Skip to content

Commit

Permalink
fixup! refactor(ci): split django setup into reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Oct 17, 2024
1 parent 649363f commit 0e68072
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup-django/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Set up Django server and Postgres for further testing
runs:
using: "composite"
steps:
- uses: actions/setup-python@v2
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
sudo apt-get install -y gettext
- name: Create logging folder
run: |
sudo mkdir -p /logging
sudo chown runner:runner /logging
- name: Compile Translation Messages
run: |
cp .env.testing app/.env
cd app/
python manage.py makemessages --all
python manage.py compilemessages
37 changes: 0 additions & 37 deletions .github/workflows/setup_django.yml

This file was deleted.

16 changes: 15 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@ on: [ pull_request, push ] # activates the workflow when there is a push or pull
jobs:
test_project:
runs-on: ubuntu-latest # operating system your code will run on
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: sadilar
POSTGRES_PASSWORD: sadilar
POSTGRES_DB: test_db_1
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/setup_django.yml
- uses: ./.github/actions/setup-django
- name: Run linting tools
run: |
cd app/
ruff format .
- name: Run validate_templates
run: |
export DJANGO_TEST_PROCESSES=1
Expand Down

0 comments on commit 0e68072

Please sign in to comment.