Skip to content

Commit ab9429a

Browse files
update
1 parent a7acc4d commit ab9429a

File tree

1 file changed

+58
-25
lines changed

1 file changed

+58
-25
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,30 @@ env:
1919
POSTGRES_HOST: 127.0.0.1
2020

2121
jobs:
22-
test:
22+
web:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v2
27+
28+
- name: Setup node
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: 14.18.0
32+
33+
- name: Install dependencies
34+
run: yarn install --frozen-lockfile
35+
36+
- name: Check for lint errors
37+
run: yarn lint
38+
39+
- name: Run tests for Web
40+
run: cd web && yarn test
41+
42+
- name: Build Web
43+
run: cd web && yarn build
44+
45+
backend:
2346
runs-on: ubuntu-latest
2447
services:
2548
postgres:
@@ -44,23 +67,22 @@ jobs:
4467
with:
4568
node-version: 14.18.0
4669

47-
- name: Setup test DB
48-
run: PGPASSWORD=${{ env.POSTGRES_PASSWORD }} psql -h ${{ env.POSTGRES_HOST }} -U ${{ env.POSTGRES_USER }} -d ${{ env.POSTGRES_DB }} -a -f backend-go/scripts/db/dump.sql
49-
5070
- name: Install dependencies
5171
run: yarn install --frozen-lockfile
5272

5373
- name: Check for lint errors
5474
run: yarn lint
5575

56-
- name: Run tests for web
57-
run: cd web && yarn test
58-
5976
- name: Run tests for Node backend
60-
run: |
61-
cd backend
62-
# yarn migrate
63-
# yarn test
77+
run: cd backend && yarn migrate && yarn test
78+
79+
- name: Build Node backend
80+
run: cd backend && yarn build
81+
82+
- name: Setup Go DB
83+
run: psql -h ${{ env.POSTGRES_HOST }} -U ${{ env.POSTGRES_USER }} -d ${{ env.POSTGRES_DB }} -a -f backend-go/scripts/db/dump.sql
84+
env:
85+
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
6486

6587
- name: Run tests for Go backend
6688
run: |
@@ -69,26 +91,37 @@ jobs:
6991
make generate
7092
go test ./graphql -count=1
7193
72-
build:
94+
backendGo:
7395
runs-on: ubuntu-latest
74-
needs: test
96+
services:
97+
postgres:
98+
image: postgres:12
99+
env:
100+
POSTGRES_USER: user
101+
POSTGRES_PASSWORD: password
102+
POSTGRES_DB: database
103+
ports:
104+
- 5432:5432
105+
options: >-
106+
--health-cmd pg_isready
107+
--health-interval 10s
108+
--health-timeout 5s
109+
--health-retries 5
75110
steps:
76111
- name: Checkout code
77112
uses: actions/checkout@v2
78113

79-
- name: Setup node
80-
uses: actions/setup-node@v1
81-
with:
82-
node-version: 14.18.0
83-
84-
- name: Install dependencies
85-
run: yarn install --frozen-lockfile
114+
- name: Setup Go DB
115+
run: psql -h ${{ env.POSTGRES_HOST }} -U ${{ env.POSTGRES_USER }} -d ${{ env.POSTGRES_DB }} -a -f backend-go/scripts/db/dump.sql
116+
env:
117+
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
86118

87-
- name: Build Web
88-
run: cd web && yarn build
89-
90-
- name: Build Node backend
91-
run: cd backend && yarn build
119+
- name: Run tests for Go backend
120+
run: |
121+
cd backend-go
122+
go install cmd/main.go
123+
make generate
124+
go test ./graphql -count=1
92125
93126
- name: Build Go backend
94127
run: yarn backend-go && go build cmd/main.go

0 commit comments

Comments
 (0)