-
Notifications
You must be signed in to change notification settings - Fork 59
54 lines (52 loc) · 1.69 KB
/
stress-test.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
name: Stress test
on:
push:
branches:
- master
jobs:
run-server:
name: Run server and stress test with k6
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: tighten
POSTGRES_PASSWORD: rename
POSTGRES_DB: embassy
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install k6
run: |
curl https://github.com/grafana/k6/releases/download/v0.39.0/k6-v0.39.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
- uses: bahmutov/npm-install@v1
- name: Setup the project
run: |
npm run db:create
npm run typeorm migration:run
npm run db:seed
npm run build
npm prune --production
env:
DATABASE_URL: postgres://tighten:rename@localhost:${{ job.services.postgres.ports['5432'] }}/embassy
- name: Run the server
run: npm start &
env:
PORT: 3000
NODE_ENV: production
APP_SECRET: laborum-cupidatat-officia-duis-dolor-nisi-esse
DATABASE_URL: postgres://tighten:rename@localhost:${{ job.services.postgres.ports['5432'] }}/embassy
ALLOWED_ORIGINS: '*'
- name: Run k6 local test
run: ./k6 run stress-test/main.js
- uses: actions/upload-artifact@v4
with:
name: stress-test-result
path: stress-test-result.*