Testing conditionals in various views #1315
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: Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: [release] | |
paths-ignore: | |
- docs/** | |
- README.md | |
- .github/** | |
- cloudformation/** | |
- db_scripts/** | |
- jenkins/** | |
- kibana-proxy/** | |
- postgresql/** | |
pull_request: | |
branches: [main, 'feature-*'] | |
paths-ignore: | |
- docs/** | |
- README.md | |
- .github/** | |
- cloudformation/** | |
- db_scripts/** | |
- jenkins/** | |
- kibana-proxy/** | |
- postgresql/** | |
env: | |
PIPENV_IGNORE_VIRTUALENVS: 1 | |
DJANGO_SETTINGS_MODULE: concordia.settings_test | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_DB: concordia | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Opens tcp port 6379 on the host and service container | |
- 6379:6379 | |
steps: | |
- name: Install system packages | |
run: | | |
sudo apt-get update -qy && sudo apt-get dist-upgrade -qy && sudo apt-get install -qy \ | |
libmemcached-dev libz-dev libfreetype6-dev libtiff-dev \ | |
libjpeg-dev libopenjp2-7-dev libwebp-dev zlib1g-dev libpq-dev \ | |
tesseract-ocr tesseract-ocr-all | |
- name: Install node and npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
cache: 'pipenv' | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install Python Dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install -U packaging | |
pip3 install -U setuptools | |
pip3 install -U pipenv | |
pipenv install --dev --deploy | |
- name: Run Tests | |
run: | | |
mkdir logs | |
touch ./logs/concordia-celery.log | |
npm install | |
npx gulp build | |
chromepath=$(npx @puppeteer/browsers install chrome@stable) | |
chromepath=${chromepath#* } | |
chromepath=${chromepath%/chrome} | |
OLDPATH=$PATH | |
PATH=$PATH:$chromepath | |
pipenv run ./manage.py collectstatic --no-input | |
pipenv run coverage run ./manage.py test | |
PATH=$OLDPATH | |
env: | |
PGPASSWORD: postgres | |
# The hostname used to communicate with the PostgreSQL service container | |
POSTGRES_HOST: localhost | |
# The default PostgreSQL port | |
POSTGRES_PORT: 5432 | |
# The hostname used to communicate with the Redis service container | |
REDIS_HOST: localhost | |
# The default Redis port | |
REDIS_PORT: 6379 | |
# COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} |