-
-
Notifications
You must be signed in to change notification settings - Fork 8
165 lines (135 loc) · 4.53 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
name: CI Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
working-directory: "./frontend"
run: yarn install --production=false
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Install Python dependencies
run: poetry install --no-root --with=dev
- name: Run linters
run: poetry run ./scripts/lint
- name: Ensure requirements.txt and pyproject.toml
run: |
poetry export --without-hashes -o requirements.txt
git diff --exit-code
- name: Ensure pyproject.toml and poetry.lock are in sync
run: |
poetry check
- name: Ensure models and migrations are in sync
run: |
poetry run python manage.py makemigrations --noinput --check --dry-run
run-django-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Install dependencies
run: poetry install --no-root --with=dev
- name: Run Django unit tests
env:
TOPSCORE_CLIENT_ID: "fake-client-id"
TOPSCORE_CLIENT_SECRET: "fake-client-secret"
TOPSCORE_SITE_SLUG: "upai"
run: |
poetry run pytest --disable-warnings -k 'not Integration'
run-integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Install dependencies
run: poetry install --no-root --with=dev
- name: Set up Node
uses: actions/setup-node@v3
with:
# webpack dev server proxy doesn't work with Node 18!
node-version: 16
cache: "yarn"
cache-dependency-path: frontend/yarn.lock
- name: Install node dependencies (webpack-dev-server)
working-directory: "./frontend"
run: yarn install --production=false
- name: Install geckodriver (for integration tests)
run: poetry run sbase get geckodriver latest
- name: Run Django Integration tests
env:
PHONEPE_SALT_INDEX: 1
PHONEPE_SALT_KEY: ${{ secrets.PHONEPE_SALT_KEY }}
PHONEPE_MERCHANT_ID: ${{ secrets.PHONEPE_MERCHANT_ID }}
RAZORPAY_KEY_ID: ${{ secrets.RAZORPAY_KEY_ID }}
RAZORPAY_KEY_SECRET: ${{ secrets.RAZORPAY_KEY_SECRET }}
RAZORPAY_WEBHOOK_SECRET: ${{ secrets.RAZORPAY_WEBHOOK_SECRET }}
run: |
poetry run pytest --disable-warnings -k Integration --firefox
- name: Upload selenium base logs as artifacts
if: failure() # Upload the artifact even if a previous step fails
uses: actions/upload-artifact@v3
with:
name: sbase-logs
path: latest_logs/
retention-days: 1
frontend-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
working-directory: "./frontend"
run: yarn install --production=false
- name: Run Build
working-directory: "./frontend"
run: yarn build
docker_image_test:
name: Build docker image to ensure everything works
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: whoan/docker-build-with-cache-action@v5
with:
image_name: india-ultimate/hub
push_image_and_stages: false
- name: Run the migrations
run: docker run india-ultimate/hub:latest python manage.py migrate
- name: Run the deploy checks
run: docker run --env OTP_EMAIL_HASH_KEY=test india-ultimate/hub:latest python manage.py check --deploy