Issue624Login #11
Workflow file for this run
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
# Runs the Pytest test suite when PRs are made against any branch | |
name: Run Pytest via Docker Compose on all PRs | |
on: | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
build-and-run-pytest-suite-in-docker-compose: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Create .env file from repo secrets | |
run: | | |
touch envs/.env | |
echo "SITE_DOMAIN=${{ secrets.SITE_DOMAIN }}" >> envs/.env | |
echo "LETSENCRYPT_EMAIL_ADDRESS=${{ secrets.LETSENCRYPT_EMAIL_ADDRESS }}" >> envs/.env | |
echo "LETSENCRYPT_ENDPOINT=${{ secrets.LETSENCRYPT_ENDPOINT }}" >> envs/.env | |
echo "TLS_SOURCE=${{ secrets.TLS_SOURCE }}" >> envs/.env | |
echo "CELERY_BROKER_URL=${{ secrets.CELERY_BROKER_URL }}" >> envs/.env | |
echo "CELERY_RESULT_BACKEND=${{ secrets.CELERY_RESULT_BACKEND }}" >> envs/.env | |
echo "RCPCH_CENSUS_PLATFORM_TOKEN=${{ secrets.RCPCH_CENSUS_PLATFORM_TOKEN }}" >> envs/.env | |
echo "RCPCH_CENSUS_PLATFORM_URL=${{ secrets.RCPCH_CENSUS_PLATFORM_URL }}" >> envs/.env | |
echo "DEBUG=${{ secrets.DEBUG }}" >> envs/.env | |
echo "DJANGO_ALLOWED_HOSTS=${{ secrets.DJANGO_ALLOWED_HOSTS }}" >> envs/.env | |
echo "DJANGO_CSRF_TRUSTED_ORIGINS=https://${{ secrets.DJANGO_CSRF_TRUSTED_ORIGINS }}" >> envs/.env | |
echo "E12_SECRET_KEY=${{ secrets.E12_SECRET_KEY }}" >> envs/.env | |
echo "E12_POSTGRES_DB_HOST=${{ secrets.E12_POSTGRES_DB_HOST }}" >> envs/.env | |
echo "E12_POSTGRES_DB_NAME=${{ secrets.E12_POSTGRES_DB_NAME }}" >> envs/.env | |
echo "E12_POSTGRES_DB_PASSWORD=${{ secrets.E12_POSTGRES_DB_PASSWORD }}" >> envs/.env | |
echo "E12_POSTGRES_DB_PORT=${{ secrets.E12_POSTGRES_DB_PORT }}" >> envs/.env | |
echo "E12_POSTGRES_DB_USER=${{ secrets.E12_POSTGRES_DB_USER }}" >> envs/.env | |
echo "EMAIL_DEFAULT_FROM_EMAIL=${{ secrets.EMAIL_DEFAULT_FROM_EMAIL }}" >> envs/.env | |
echo "EMAIL_HOST_PASSWORD=${{ secrets.EMAIL_HOST_PASSWORD }}" >> envs/.env | |
echo "EMAIL_HOST_PORT=${{ secrets.EMAIL_HOST_PORT }}" >> envs/.env | |
echo "EMAIL_HOST_SERVER=${{ secrets.EMAIL_HOST_SERVER }}" >> envs/.env | |
echo "EMAIL_HOST_USER=${{ secrets.EMAIL_HOST_USER }}" >> envs/.env | |
echo "SMTP_EMAIL_ENABLED=${{ secrets.SMTP_EMAIL_ENABLED }}" >> envs/.env | |
echo "FLOWER_PASSWORD=${{ secrets.FLOWER_PASSWORD }}" >> envs/.env | |
echo "FLOWER_PORT=${{ secrets.FLOWER_PORT }}" >> envs/.env | |
echo "FLOWER_USER=${{ secrets.FLOWER_USER }}" >> envs/.env | |
echo "RCPCH_HERMES_SERVER_URL=${{ secrets.RCPCH_HERMES_SERVER_URL }}" >> envs/.env | |
echo "ENABLE_GIT_COMMITTERS=${{ secrets.ENABLE_GIT_COMMITTERS }}" >> envs/.env | |
echo "ENABLE_PDF_EXPORT=${{ secrets.ENABLE_PDF_EXPORT }}" >> envs/.env | |
echo "DOCS_URL=https://${{ secrets.SITE_DOMAIN }}/docs/" >> envs/.env | |
echo "NHS_ODS_API_URL=${{ secrets.NHS_ODS_API_URL }}" >> envs/.env | |
echo "POSTCODE_API_BASE_URL=${{ secrets.POSTCODE_API_BASE_URL }}" >> envs/.env | |
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> envs/.env | |
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> envs/.env | |
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> envs/.env | |
echo "TZ=${{ secrets.TZ }}" >> envs/.env | |
cat envs/.env | |
- name: Creates git_hash.txt file current commit hash | |
id: hash | |
run: echo "GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}),GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" > git_hash.txt | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- name: Build Docker images and run containers with compose | |
run: | | |
docker compose up -d | |
- name: Run tests | |
run: | | |
docker compose exec django pytest -v $* | |