-
Notifications
You must be signed in to change notification settings - Fork 129
205 lines (200 loc) · 8.44 KB
/
diffgram_testing.yaml
File metadata and controls
205 lines (200 loc) · 8.44 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Diffgram Testing Workflow
on:
push:
branches:
- 'main'
- 'master'
- 'releases/**'
- 'fix/**'
pull_request_target:
types: [synchronize]
branches:
- '**'
pull_request:
types: [opened, synchronize, ready_for_review]
jobs:
Default-Service-Unit-Tests:
runs-on: ubuntu-20.04
# Service containers to run with `container-job` test
container:
image: python:3.11.1-bullseye
options: --user root
env:
NODE_ENV: development
DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable
UNIT_TESTING_DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable
PYTHONPATH: /__w/diffgram/default
DIFFGRAM_SYSTEM_MODE: testing
GOOGLE_APPLICATION_CREDENTIALS: /gcp/gcloud-service-key.json
DIFFGRAM_STATIC_STORAGE_PROVIDER: gcp
GOOGLE_PROJECT_NAME: ${{ secrets.GOOGLE_PROJECT_NAME }}
DIFFGRAM_HOST_OS: ${{ secrets.DIFFGRAM_HOST_OS }}
DIFFGRAM_VERSION_TAG: ${{ secrets.DIFFGRAM_VERSION_TAG }}
DIFFGRAM_INSTALL_FINGERPRINT: ${{ secrets.DIFFGRAM_INSTALL_FINGERPRINT }}
CLOUD_STORAGE_BUCKET: ${{ secrets.CLOUD_STORAGE_BUCKET }}
ML__CLOUD_STORAGE_BUCKET: ${{ secrets.ML__CLOUD_STORAGE_BUCKET }}
SERVICE_ACCOUNT_FULL_PATH: /gcp/gcloud-service-key.json
DOCKER_CONTEXT: true
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
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
steps:
- uses: actions/setup-python@v3
with:
python-version: '3.11'
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- uses: mdecoleman/pr-branch-name@1.2.0
if: "github.event.pull_request != null"
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: echo ${{ steps.vars.outputs.branch }}
if: "github.event.pull_request != null"
- name: Check out repository code
if: "github.event.pull_request != null"
uses: actions/checkout@v2
with:
ref: ${{ steps.vars.outputs.branch }}
- name: Check out repository code
if: "github.event.pull_request == null"
uses: actions/checkout@v2
with:
ref: ${{ github.ref_name }}
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: cp -rf . /__w/diffgram
- run: cd /__w/diffgram
- run: pip3 install --upgrade pip
- run: pip3 install -r default/requirements.txt
- run: pip3 install pytest sqlalchemy-utils
- run: mkdir /gcp
- run: echo ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ENCODED }} | base64 --decode --ignore-garbage > /gcp/gcloud-service-key.json
- run: pytest default/tests --junitxml=test-results/junit.xml
- name: Publish Default Service Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: test-results/**/*.xml
Walrus-Service-Unit-Tests:
runs-on: ubuntu-20.04
# Service containers to run with `container-job`
container:
image: ubuntu:22.04
options: --user root
env:
NODE_ENV: development
DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable
UNIT_TESTING_DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres/diffgram_unit_tests?sslmode=disable
PYTHONPATH: /__w/diffgram/walrus
DIFFGRAM_SYSTEM_MODE: testing
GOOGLE_APPLICATION_CREDENTIALS: /gcp/gcloud-service-key.json
DIFFGRAM_STATIC_STORAGE_PROVIDER: gcp
GOOGLE_PROJECT_NAME: ${{ secrets.GOOGLE_PROJECT_NAME }}
CLOUD_STORAGE_BUCKET: ${{ secrets.CLOUD_STORAGE_BUCKET }}
ML__CLOUD_STORAGE_BUCKET: ${{ secrets.ML__CLOUD_STORAGE_BUCKET }}
DIFFGRAM_HOST_OS: ${{ secrets.DIFFGRAM_HOST_OS }}
DIFFGRAM_VERSION_TAG: ${{ secrets.DIFFGRAM_VERSION_TAG }}
DIFFGRAM_INSTALL_FINGERPRINT: ${{ secrets.DIFFGRAM_INSTALL_FINGERPRINT }}
SERVICE_ACCOUNT_FULL_PATH: /gcp/gcloud-service-key.json
CRYPTOGRAPHY_DONT_BUILD_RUST: 1
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
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
steps:
- uses: actions/setup-python@v3
with:
python-version: '3.11'
- run: apt-get update --allow-insecure-repositories && apt-get install -y git libffi-dev ffmpeg python3.11 python3-pip libpq-dev python3.11-venv python3.11-distutils python3.11-dev git python3-setuptools libgdal-dev python3-lxml libxslt-dev
- run: pip3 install --upgrade pip
- run: rm -rf /tmp
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- uses: mdecoleman/pr-branch-name@1.2.0
if: "github.event.pull_request != null"
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: echo ${{ steps.vars.outputs.branch }}
if: "github.event.pull_request != null"
- name: Check out repository code
if: "github.event.pull_request != null"
uses: actions/checkout@v2
with:
ref: ${{ steps.vars.outputs.branch }}
- name: Check out repository code
if: "github.event.pull_request == null"
uses: actions/checkout@v2
with:
ref: ${{ github.ref_name }}
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: pwd
- run: cp -rf . /__w/diffgram
- run: cd /__w/diffgram
- run: cd walrus
- run: pip install -r walrus/requirements.txt
- run: pip install pytest sqlalchemy-utils
- run: mkdir /gcp
- run: echo ${{ secrets.GOOGLE_SERVICE_ACCOUNT_ENCODED }} | base64 --decode --ignore-garbage > /gcp/gcloud-service-key.json
- run: pytest walrus/tests --junitxml=test-results/junit.xml
- name: Publish Walrus Service Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: test-results/**/*.xml
Frontend-Unit-Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- uses: mdecoleman/pr-branch-name@1.2.0
if: "github.event.pull_request != null"
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: echo ${{ steps.vars.outputs.branch }}
if: "github.event.pull_request != null"
- name: Check out repository code
if: "github.event.pull_request != null"
uses: actions/checkout@v2
with:
ref: ${{ steps.vars.outputs.branch }}
- name: Check out repository code
if: "github.event.pull_request == null"
uses: actions/checkout@v2
with:
ref: ${{ github.ref_name }}
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: cd frontend
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: yarn --cwd frontend install
- run: yarn --cwd frontend run test:unit