-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (124 loc) · 4.6 KB
/
ui.yaml
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
---
# yamllint disable rule:line-length
# Pin micromamba version to `1.5.10-0` because of following issue:
# https://github.com/mamba-org/setup-micromamba/issues/225
name: UI
"on":
pull_request: null
push: null
jobs:
format:
name: JS-Format
runs-on: ubuntu-latest
# Skip `pull_request` runs on local PRs for which `push` runs are already triggered
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Conda environment
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: 1.5.10-0
environment-file: conda-environment.yml
cache-environment: true
post-cleanup: "all"
- name: Cache UI dependencies
uses: actions/cache@v4
with:
path: |
~/setup-pnpm/node_modules/.bin/store
~/.cache/Cypress
key: cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-
- name: Install UI dependencies
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui install"
- name: Run Prettier
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui prettier"
lint:
name: JS-Lint
runs-on: ubuntu-latest
# Skip `pull_request` runs on local PRs for which `push` runs are already triggered
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Conda environment
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: 1.5.10-0
environment-file: conda-environment.yml
cache-environment: true
post-cleanup: "all"
- name: Cache UI dependencies
uses: actions/cache@v4
with:
path: |
~/setup-pnpm/node_modules/.bin/store
~/.cache/Cypress
key: cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-
- name: Install UI dependencies
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui install"
- name: Run ESLint
# fail on warnings
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui eslint --max-warnings=0"
e2e:
name: E2E-Test
runs-on: ubuntu-latest
# Skip `pull_request` runs on local PRs for which `push` runs are already triggered
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
# Service containers to run with `container-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Conda environment
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: 1.5.10-0
environment-file: conda-environment.yml
cache-environment: true
post-cleanup: "all"
- name: Install MXCuBE
run: "${MAMBA_EXE} run --name mxcubeweb poetry install --only main"
- name: Cache UI dependencies
uses: actions/cache@v4
with:
path: |
~/setup-pnpm/node_modules/.bin/store
~/.cache/Cypress
key: cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-
- name: Install UI dependencies
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui install"
- name: Build UI
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui build"
- name: Start MXCuBE-Web server
run: |
${MAMBA_EXE} run --name mxcubeweb mxcubeweb-server -r ./demo/ --static-folder $(pwd)/ui/build/ -L debug &
${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui exec wait-on http://127.0.0.1:8081
- name: Run Cypress
run: "${MAMBA_EXE} run --name mxcubeweb pnpm --prefix ui e2e"
env:
CYPRESS_BASE_URL: http://127.0.0.1:8081
- uses: actions/upload-artifact@v4
if: failure()
with:
name: debug
retention-days: 3
path: |
ui/cypress/debug
debug