Skip to content

Commit

Permalink
update django-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DrCBeatz committed Mar 29, 2024
1 parent bbca0df commit fb84bc5
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/django-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,41 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-

- name: Create .env file
run: |
echo "DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}" >> .env
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> .env
echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> .env
echo "MDB_PRO_KEY=${{ secrets.MDB_PRO_KEY }}" >> .env
- name: Build and push Docker images
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: user/app:latest
file: ./Dockerfile
push: false
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

- name: Start Docker Compose services
run: docker-compose up -d

- name: Run backend tests
run: docker-compose exec web pytest
run: docker-compose run web pytest

- name: Add MDB API Key
run: docker-compose exec web python manage.py addapikey
Expand Down

0 comments on commit fb84bc5

Please sign in to comment.