-
Notifications
You must be signed in to change notification settings - Fork 6
163 lines (155 loc) · 4.7 KB
/
test-and-ci.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test and CI
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-client:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./client
steps:
- uses: actions/checkout@v4
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: "20.11.0"
- name: Install client dependencies
run: npm clean-install
env:
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Run test client
run: npm run test
env:
CI: true
timeout-minutes: 1
- name: Run format client
run: npm run format-check
- name: Run lint client
run: npm run lint
- name: Build client
run: npm run build
env:
NODE_OPTIONS: "--max-old-space-size=4096"
test-server:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./server
steps:
- uses: actions/checkout@v4
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: "20.11.0"
- name: Install server dependencies
run: npm clean-install
- name: Build server
run: npm run build
env:
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Run test server
run: npm test
env:
CI: true
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Run format server
run: npm run format-check
- name: Run lint server
run: npm run lint
test-storybook:
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.11.0"
- name: Install dependencies
run: npm clean-install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build Storybook and run tests
run: npm run storybook-compile-and-test
lint-e2e:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./tests
steps:
- uses: actions/checkout@v4
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: "20.11.0"
- name: Install project e2e dependencies
run: npm clean-install
- name: Run format e2e
run: npm run format-check
- name: Run lint e2e
run: npm run lint
run-e2e:
needs: lint-e2e
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install client
uses: cypress-io/github-action@v6
with:
build: npm run client:install
runTests: false
working-directory: tests
- name: Build client
uses: cypress-io/github-action@v6
with:
build: npm run client:build
runTests: false
working-directory: tests
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
start: npm run client:preview
wait-on: http://localhost:3000/
wait-on-timeout: 300
working-directory: tests
- uses: actions/upload-artifact@v4
if: failure() # Cypress screenshots will be generated only if the test failed, thus we store screenshots only on failures
with:
name: cypress-screenshots
path: tests/cypress/screenshots
retention-days: 7
- uses: actions/upload-artifact@v4
if: always() # Cypress test video is always captured, so this action uses "always()" condition
with:
name: cypress-videos
path: tests/cypress/videos
retention-days: 3
publish-images:
needs: [test-client, test-server]
runs-on: ubuntu-22.04
if: "startsWith(github.ref, 'refs/tags/')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: set up environment variables
run: |
echo "GIT_USER=Renku Bot" >> $GITHUB_ENV
echo "GIT_EMAIL=renku@datascience.ch" >> $GITHUB_ENV
- name: Push images
uses: SwissDataScienceCenter/renku-actions/publish-chartpress-images@v1.12.3
env:
DOCKER_USERNAME: ${{ secrets.RENKU_DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.RENKU_DOCKER_PASSWORD }}
- name: Update ui version
uses: SwissDataScienceCenter/renku-actions/update-component-version@v1.12.3
env:
GITHUB_TOKEN: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
COMPONENT_NAME: renku-ui