Skip to content

Commit ffa8c3c

Browse files
committed
Added integration test CI job
1 parent 4a6609c commit ffa8c3c

File tree

2 files changed

+105
-60
lines changed

2 files changed

+105
-60
lines changed

.github/workflows/pull-request-develop.yml

Lines changed: 103 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,111 @@ on:
1212
jobs:
1313
# Installs npm dependencies for the first time,
1414
# caching them in ~/.npm
15-
install:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/setup-node@v3
20-
with:
21-
node-version: 18
22-
# This only caches ~/.npm, therefore each subsequent
23-
# job needs to run `npm ci` to install deps from npm cache
24-
# alternative is to cache `node_modules` directly
25-
# TODO:
26-
# https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/
27-
# Add caching of `node_modules` to speed up this workflow
28-
cache: npm
15+
# install:
16+
# runs-on: ubuntu-latest
17+
# steps:
18+
# - uses: actions/checkout@v3
19+
# - uses: actions/setup-node@v3
20+
# with:
21+
# node-version: 18
22+
# # This only caches ~/.npm, therefore each subsequent
23+
# # job needs to run `npm ci` to install deps from npm cache
24+
# # alternative is to cache `node_modules` directly
25+
# # TODO:
26+
# # https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/
27+
# # Add caching of `node_modules` to speed up this workflow
28+
# cache: npm
29+
#
30+
# # install dependencies from the package-lock.json
31+
# - name: Install dependencies
32+
# run: npm ci --workspaces
33+
#
34+
# # builds all packages
35+
# build:
36+
# runs-on: ubuntu-latest
37+
# needs: install
38+
# steps:
39+
# - uses: actions/checkout@v3
40+
# - uses: actions/setup-node@v3
41+
# with:
42+
# node-version: 18
43+
# cache: npm
44+
#
45+
# - name: "Install dependencies"
46+
# run: npm ci --workspaces --include-workspace-root
47+
#
48+
# - name: "Build"
49+
# run: npm run build
50+
#
51+
# # lints all packages
52+
# lint:
53+
# runs-on: ubuntu-latest
54+
# needs: install
55+
# steps:
56+
# # check out the repository
57+
# - uses: actions/checkout@v3
58+
# - uses: actions/setup-node@v3
59+
# with:
60+
# node-version: 18
61+
# cache: npm
62+
#
63+
# - name: "Install dependencies"
64+
# run: npm ci --workspaces --include-workspace-root
65+
#
66+
# - name: "Build"
67+
# run: npm run build
68+
#
69+
# - name: "Lint"
70+
# run: npm run lint
71+
#
72+
# - name: "Check formatting"
73+
# run: npx prettier ./packages --check
74+
#
75+
# # tests all packages
76+
# test:
77+
# runs-on: ubuntu-latest
78+
# needs: install
79+
# steps:
80+
# - uses: actions/checkout@v3
81+
# - uses: actions/setup-node@v3
82+
# with:
83+
# node-version: 18
84+
# cache: npm
85+
#
86+
# - name: "Install dependencies"
87+
# run: npm ci --workspaces --include-workspace-root
88+
#
89+
# - name: "Build"
90+
# run: npm run build
91+
#
92+
# - name: "Test"
93+
# run: npm run test:ci
2994

30-
# install dependencies from the package-lock.json
31-
- name: Install dependencies
32-
run: npm ci --workspaces
33-
34-
# builds all packages
35-
build:
95+
integration:
3696
runs-on: ubuntu-latest
37-
needs: install
38-
steps:
39-
- uses: actions/checkout@v3
40-
- uses: actions/setup-node@v3
41-
with:
42-
node-version: 18
43-
cache: npm
97+
# needs: test
4498

45-
- name: "Install dependencies"
46-
run: npm ci --workspaces --include-workspace-root
99+
env:
100+
POSTGRES_URL: postgres
101+
REDIS_URL: redis
102+
DATABASE_URL: "postgresql://admin:password@postgres:5432/protokit?schema=public"
47103

48-
- name: "Build"
49-
run: npm run build
104+
services:
105+
postgres:
106+
image: postgres:14-alpine
107+
env:
108+
POSTGRES_PASSWORD: password
109+
POSTGRES_USER: admin
110+
POSTGRES_DB: protokit
111+
ports:
112+
- 5432:5432
113+
redis:
114+
image: redis:6.2-alpine
115+
command: redis-server /redis.conf --requirepass password
116+
ports:
117+
- 6379:6379
50118

51-
# lints all packages
52-
lint:
53-
runs-on: ubuntu-latest
54-
needs: install
55119
steps:
56-
# check out the repository
57120
- uses: actions/checkout@v3
58121
- uses: actions/setup-node@v3
59122
with:
@@ -66,28 +129,8 @@ jobs:
66129
- name: "Build"
67130
run: npm run build
68131

69-
- name: "Lint"
70-
run: npm run lint
71-
72-
- name: "Check formatting"
73-
run: npx prettier ./packages --check
74-
75-
# tests all packages
76-
test:
77-
runs-on: ubuntu-latest
78-
needs: install
79-
steps:
80-
- uses: actions/checkout@v3
81-
- uses: actions/setup-node@v3
82-
with:
83-
node-version: 18
84-
cache: npm
85-
86-
- name: "Install dependencies"
87-
run: npm ci --workspaces --include-workspace-root
88-
89-
- name: "Build"
90-
run: npm run build
132+
- name: "Migrate DB"
133+
run: npm run migrate
91134

92-
- name: "Test"
93-
run: npm run test:ci
135+
- name: "Integration tests"
136+
run: npm run test:integration

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"lint:staged": "eslint",
1111
"test": "npx lerna run test --scope=\"*/sdk\" -- --passWithNoTests",
1212
"test:ci": "npx lerna run test -- --passWithNoTests --forceExit",
13+
"test:integration": "npx lerna run integration -- --passWithNoTests --forceExit",
1314
"test:watch": "npx lerna run test:watch",
15+
"migrate": "npx lerna run prisma-migrate",
1416
"commit": "cz",
1517
"publish:canary": "npx lerna publish prerelease --no-private --exact --yes --canary --preid develop --dist-tag latest --loglevel verbose --force-git-tag --force-publish"
1618
},

0 commit comments

Comments
 (0)