-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (97 loc) · 3.15 KB
/
pull-request.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
name: Integration tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
# Docker Hub image
image: postgres
env:
POSTGRES_DB: govuk_domain
POSTGRES_USER: govuk_domain
POSTGRES_PASSWORD: govuk_domain
ports:
- "5432:5432"
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
clamav:
# Docker Hub image
image: clamav/clamav:latest
ports:
- "3310:3310"
s3:
image: adobe/s3mock
env:
initialBuckets: registration-app-media-root-local
debug: "true"
retainFilesOnExit: "false"
ports:
- "9090:9090"
steps:
- name: Install pyenv and Python
run: |
curl https://pyenv.run | bash && \
export PYENV_ROOT="$HOME/.pyenv" && \
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" && \
eval "$(pyenv init -)" && \
pyenv update && \
pyenv install 3.10.11 && \
pyenv global 3.10.11 && \
pyenv rehash
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
python -m pip install --upgrade poetry pre-commit
poetry install --no-root
- name: Run linters
run: |
pre-commit run --all
- name: Init server
env:
SECRET_KEY: blah
DATABASE_URL: postgresql://govuk_domain:govuk_domain@localhost:5432/govuk_domain
DOMAIN_NAME: http://localhost:8010
run: |
poetry run ./manage.py collectstatic --noinput
poetry run ./manage.py migrate --noinput
poetry run ./manage.py create_reviewer_group
poetry run ./manage.py loaddata ./seed/users.json
poetry run ./manage.py create_sample_data
- name: Cypress
uses: cypress-io/github-action@v6
env:
SECRET_KEY: blah
DATABASE_URL: postgresql://govuk_domain:govuk_domain@localhost:5432/govuk_domain
DEBUG: True
DOMAIN_NAME: http://localhost:8010
AWS_ENDPOINT_URL_S3: http://127.0.0.1:9090
CLAMD_TCP_ADDR: 127.0.0.1
S3_STORAGE_ENABLED: "True"
AWS_ACCESS_KEY_ID: "dummy-key-id"
AWS_SECRET_ACCESS_KEY: "dummy-key"
ENVIRONMENT: 'local'
with:
start: |
/home/runner/work/domains-register-a-govuk-domain/domains-register-a-govuk-domain/.github/workflows/start-server.sh
- name: Run Unit Tests
env:
DATABASE_URL: postgresql://govuk_domain:govuk_domain@localhost:5432/govuk_domain
AWS_ENDPOINT_URL_S3: http://127.0.0.1:9090
CLAMD_TCP_ADDR: 127.0.0.1
S3_STORAGE_ENABLED: "True"
AWS_ACCESS_KEY_ID: "dummy-key-id"
AWS_SECRET_ACCESS_KEY: "dummy-key"
ENVIRONMENT: 'local'
NOMINET_ROMSID: test_romsid
NOMINET_SECRET: test_secret # pragma: allowlist secret
run: |
SECRET_KEY=unneeded DOMAIN_NAME=http://localhost:8010 poetry run python manage.py test -v 2