Skip to content

Automatic Running of Tests On Pull Request #14

Automatic Running of Tests On Pull Request

Automatic Running of Tests On Pull Request #14

name: Django Test Suite on PR
on:
pull_request:
branches:
- dev
jobs:
run-tests:
runs-on: ubuntu-latest
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 5432:5432
steps:
- name: Check out merged code
uses: actions/checkout@v2
- name: Set up Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Build the Docker environment
run: docker-compose -f local.yml build
- name: Clear Python cache
run: docker-compose -f local.yml run --rm django find . -type f -name "*.pyc" -delete && find . -type d -name "__pycache__" -exec rm -rf {} +
- name: Run test suite
env:
DJANGO_ENV: test
run: docker-compose -f local.yml run --rm django pytest
- name: Cleanup
run: docker-compose -f local.yml down --volumes