-
Notifications
You must be signed in to change notification settings - Fork 29
76 lines (66 loc) · 2.3 KB
/
unit-tests.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
name: Unit Tests
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened] # Default
env:
SALESFORCE_CONSUMER_KEY: foo
SALESFORCE_CLIENT_SECRET: foo
DB_ENCRYPTION_KEY: ${{ secrets.DB_ENCRYPTION_KEY }}
DJANGO_HASHID_SALT: ${{ secrets.DJANGO_HASHID_SALT }}
DJANGO_SETTINGS_MODULE: config.settings.test
POSTGRES_PORT: 5432
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_URL: redis://localhost:6379
GITHUB_CLIENT_ID: NO_GITHUB_CLIENT
GITHUB_CLIENT_SECRET: NO_GITHUB_SECRET
DATABASE_URL: postgres://postgres:postgres@localhost:5432/github_actions
jobs:
unit-tests:
name: Unit tests
runs-on: SFDO-Tooling-Ubuntu
env:
YARN_CACHE_DIR: ~/.yarn_cache
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
# Set health check to wait until postgres has started
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout
5s --health-retries 10
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up python 3.9
id: py
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: pip
cache-dependency-path: "requirements/*.txt"
- name: Install Python dependencies
run: |
pip install -r requirements/prod.txt
pip install -r requirements/dev.txt
- name: Run migrations
run: python manage.py migrate
- name: Check for migrations
run: python manage.py makemigrations --check --dry-run
- name: Run Pytest
run: pytest