This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
Merge pull request #860 from yverdon/feature/yc-1139 #6137
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: Geocity CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Lint Code" | |
uses: pre-commit/[email protected] | |
- name: Configure stack | |
run: cp .env.example .env | |
- name: Build/Pull Containers | |
run: docker-compose build | |
- name: Start full stack | |
run: docker-compose up -d | |
- name: Sanity Checks | |
run: | | |
WEB_OK=$(docker ps -aq --filter status="running" --filter name="geocity_web_1") && if [ -z "$WEB_OK" ]; then exit 1; fi | |
POSTGRES_OK=$(docker ps -aq --filter status="running" --filter name="geocity_postgres_1") && if [ -z "$POSTGRES_OK" ]; then exit 1; fi | |
- name: Stop web container | |
run: docker-compose stop web | |
- name: Run tests (with 2FA) | |
env: | |
ENABLE_2FA: "true" | |
run: | | |
docker-compose run --service-ports --name=web --rm --entrypoint="" web coverage run --source='.' ./manage.py test --settings=geocity.settings_test --keepdb | |
- name: Coverage report (with 2FA) | |
run: docker-compose run --rm --entrypoint="" web coverage report -m | |
- name: Run tests (without 2FA) | |
env: | |
ENABLE_2FA: "false" | |
run: | | |
docker-compose run --service-ports --name=web --rm --entrypoint="" web coverage run --source='.' ./manage.py test --settings=geocity.settings_test --keepdb | |
- name: Coverage report (without 2FA) | |
run: docker-compose run --rm --entrypoint="" web coverage report -m | |
- name: Upload test output images | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-output-images | |
path: ./geocity/apps/reports/tests/data |