-
Notifications
You must be signed in to change notification settings - Fork 31
128 lines (115 loc) · 4.34 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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 }}