-
Notifications
You must be signed in to change notification settings - Fork 3
141 lines (126 loc) · 4.12 KB
/
build.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build
on:
push:
branches:
- main
- release/*
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js 16
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: 'package.json'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
test-js:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js 16
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: 'package.json'
- name: Install JS dependencies
run: npm ci
- name: Create e2e logs directory
run: mkdir logs
- name: Start web application in background for e2e tests
run: npm start >logs/output.txt 2>logs/error.txt &
env:
PORT: 3000
- name: Run unit tests
run: npm run test:unit
- name: Determine Playwright version
run: |
PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq --raw-output '.dependencies["@playwright/test"].version')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright browser binaries
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright
run: npx playwright install
- name: Run e2e tests
run: npm run test:e2e
env:
PORT: 3000
- name: Upload test output
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: output-js
path: |
logs
test-results
retention-days: 3
if-no-files-found: error
- name: Report JS build to Ketryx
uses: Ketryx/ketryx-github-action@v1
with:
ketryx-url: https://demo.ketryx.com
project: KXPRJ4NRJJ0HAP29QJADYG6X96R15V3
api-key: ${{ secrets.KETRYX_API_KEY }}
build-name: client-js
artifact-path: |
build/**/*.css
build/**/*.js
build/**/*.json
test-cucumber-path: test-results/report.json
test-junit-path: test-results/*.xml
test-python:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python dependencies
run: pip install --upgrade pytest
- name: Run Python tests
run: cd python && pytest -o junit_family=xunit1 --junitxml=../test-results/python-results.xml
- name: Upload test output
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: output-python
path: |
logs
test-results
retention-days: 3
if-no-files-found: error
- name: Report Python build to Ketryx
uses: Ketryx/ketryx-github-action@v1
with:
ketryx-url: ${{ secrets.KETRYX_URL }}
project: ${{ secrets.KETRYX_PROJECT }}
api-key: ${{ secrets.KETRYX_API_KEY }}
build-name: server-python
test-junit-path: test-results/*.xml
deploy:
runs-on: ubuntu-latest
steps:
- name: Check Ketryx release
uses: Ketryx/ketryx-github-action@v1
with:
ketryx-url: ${{ secrets.KETRYX_URL }}
project: ${{ secrets.KETRYX_PROJECT }}
api-key: ${{ secrets.KETRYX_API_KEY }}
# It's important to assign a separate name to this build, so that it does not supersede
# the other build that reports test results.
build-name: deploy
# Check whether the version associated with this commit is fully approved and released.
# This can be used as a check before pushing a release to production.
check-release-status: true
- name: Run deployment
run: echo "Deploying (if the version was released in Ketryx)"