generated from 8iq/nodejs-hackathon-boilerplate-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 30
117 lines (105 loc) · 3.89 KB
/
nodejs.condo.k6.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: RUN K6 LOAD TESTS
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
server_url:
required: false
type: string
description: server url that will be used as target of load test
default: https://condo.d.doma.ai
workflow_run:
workflows:
- '[review] Deploy'
types:
- completed
env:
SERVER_URL: ${{ inputs.server_url || 'https://review-master-condo.r.doma.ai' }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
- name: run k6 tests
run: |
yarn --cwd ./apps/condo/k6 webpack
export K6_BROWSER_HEADLESS=true
export K6_PROMETHEUS_RW_SERVER_URL=${{ secrets.K6_PROMETHEUS_RW_SERVER_URL }}
export K6_PROMETHEUS_RW_USERNAME=${{ secrets.K6_PROMETHEUS_USER }}
export K6_PROMETHEUS_RW_PASSWORD=${{ secrets.K6_PROMETHEUS_PASSWORD }}
export BASE_URL=${{ github.event_name == 'schedule' && 'https://condo.d.doma.ai' || env.SERVER_URL }}
export AUTH_EMAIL=${{ secrets.K6_AUTH_EMAIL }}
export AUTH_PASSWORD=${{ secrets.K6_AUTH_PASSWORD }}
export K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true
k6 -o experimental-prometheus-rw run apps/condo/k6/dist/ticket.test.js
k6 -o experimental-prometheus-rw run apps/condo/k6/dist/payment.test.js
k6 -o experimental-prometheus-rw run apps/condo/k6/dist/news.test.js
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots
path: ./apps/condo/k6/screenshots
retention-days: 2
check_review_namespace:
name: "Check namespace exists"
runs-on: self-hosted
if: ${{ github.event_name == 'workflow_run' }}
outputs:
namespace_exist: ${{ steps.check_review_namespace.outputs.exists }}
steps:
- name: "Check namespace"
id: check_review_namespace
run: |
kubectl get ns review-master > /dev/null 2>&1 && \
echo "::set-output name=exist::true" || \
echo "::set-output name=exist::false"
remove_review:
name: "Remove review"
needs: [check_review_namespace]
if: needs.check_review_namespace.outputs.namespace_exist == 'true'
runs-on: self-hosted
env:
WERF_SECRET_KEY: ${{ secrets.WERF_SECRET_KEY }}
PULL_USER: ${{ secrets.PULL_USER }}
PULL_PERSONAL_ACCESS_KEY: ${{ secrets.PULL_PERSONAL_ACCESS_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Set env for namespace
run: |
echo "REVIEW_NAMESPACE=review-master" >> $GITHUB_ENV
- name: Dismiss
uses: werf/actions/[email protected]
env:
WERF_NAMESPACE: ${{ env.REVIEW_NAMESPACE }}
WERF_WITH_NAMESPACE: true
with:
env: review