Add gunicorn (#27) #99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run test | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
env: | |
DJANGO_SECRET_KEY: "ci-test-insecure-django-secret-key" | |
COMPOSE_FILE: docker-compose.yml:gh-docker-compose.yml | |
jobs: | |
test: | |
name: 🚴 Test 🚴 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- name: 🐳 Prepare Docker | |
id: prep | |
run: | | |
TAG=$(echo $GITHUB_SHA | head -c7) | |
IMAGE="backend" | |
echo "tagged_image=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT | |
echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
- name: 🐳 Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: 🐳 Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.ref }} | |
restore-keys: | | |
${{ runner.os }}-buildx-refs/develop | |
${{ runner.os }}-buildx- | |
- name: 🐳 Build image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
file: Dockerfile | |
push: false | |
load: true | |
tags: ${{ steps.prep.outputs.tagged_image }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: 🕮 Validate if there are no pending django migrations. | |
env: | |
DOCKER_IMAGE_BACKEND: ${{ steps.prep.outputs.tagged_image }} | |
run: | | |
docker compose run --rm web bash -c 'wait-for-it db:5432 && ./manage.py makemigrations --check --dry-run' || { | |
echo 'There are some changes to be reflected in the migration. Make sure to run makemigrations'; | |
exit 1; | |
} | |
- name: 🐳 Move docker cache (🧙 Hack fix) | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |