-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (59 loc) · 1.91 KB
/
run_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
name: Run tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
DB_USERNAME: gh_db_un
DB_PASSWORD: gh_db_pw
API_DB_USERNAME: gh_api_un
API_DB_PASSWORD: gh_api_pw
SESSION_SECRET: gh_secret
EXTERNAL_API_TOKEN: gh_token
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup env
run: |
echo "PROJECT_ROOT=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
echo "PROJECT_NAME=combine" >> $GITHUB_ENV
echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH
- name: Start docker containers
run: |
echo "VERSION=$(versioninfo)" >> $GITHUB_ENV
docker-compose -f docker-compose-test.yaml build
docker-compose -f docker-compose-test.yaml up --detach db
sleep 10 # wait for database to be ready
# docker-compose -f tests-docker-compose.yml run backend bash -c "rails db:create && rails db:migrate && rails db:seed"
- name: Run backend unit and integration tests
run: |
docker-compose -f docker-compose-test.yaml up api
buildAndRun:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
DB_USERNAME: gh_db_un
DB_PASSWORD: gh_db_pw
API_DB_USERNAME: gh_api_un
API_DB_PASSWORD: gh_api_pw
SESSION_SECRET: gh_secret
EXTERNAL_API_TOKEN: gh_token
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build docker containers
run: |
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml build
- name: RUN docker containers
run: |
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up -d
sleep 20
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml stop