-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (48 loc) · 1.63 KB
/
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
name: status
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:
inputs:
OAUTH_CLIENT_ID:
description: 'OAuth client ID'
required: true
type: string
secrets:
OAUTH_CLIENT_SECRET:
description: 'OAuth client secret'
required: true
CREDS_JSON:
description: 'Google credentials JSON'
required: true
TOKEN_JSON:
description: 'Google token JSON'
required: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build and run
run: |
sed -i "s/ENV REACT_APP_OAUTH_CLIENT_ID=.*/ENV REACT_APP_OAUTH_CLIENT_ID=${{ inputs.OAUTH_CLIENT_ID }}/" client/Dockerfile
sed -i "s/ENV OAUTH_CLIENT_ID=.*/ENV OAUTH_CLIENT_ID=${{ inputs.OAUTH_CLIENT_ID }}/" server/Dockerfile
sed -i "s/ENV OAUTH_CLIENT_SECRET=.*/ENV OAUTH_CLIENT_SECRET=${{ secrets.OAUTH_CLIENT_SECRET }}/" server/Dockerfile
sed -i 's@ENV CREDS_JSON=.*@ENV CREDS_JSON="${{ secrets.CREDS_JSON }}"@' server/Dockerfile
sed -i 's@ENV TOKEN_JSON=.*@ENV TOKEN_JSON="${{ secrets.TOKEN_JSON }}"@' server/Dockerfile
docker compose up -d --build
- name: Test frontend
run: |
sleep 20
frontend_container_id=$(docker ps -q --filter "name=node")
docker exec $frontend_container_id npm run test -- --watchAll=false
- name: Test backend
if: success() || failure()
run: |
django_container_id=$(docker ps -q --filter "name=django")
docker exec $django_container_id pytest -n logical