-
Notifications
You must be signed in to change notification settings - Fork 37
104 lines (87 loc) · 2.96 KB
/
run-e2e-tests.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
# Copyright 2023-2024 The MathWorks, Inc.
name: End-to-End Tests for MATLAB Integration for Jupyter
on:
workflow_call:
jobs:
playwright_e2e_tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests/e2e
env:
NODE_VERSION: 18
PYTHON_VERSION: 3.8
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install xvfb
run: |
sudo apt-get update
sudo apt-get install -y xvfb
- name: Install node dependencies
run: npm ci
- name: Run the linter
run: npm run lint
- name: Set up MATLAB
# Use MATLAB Actions to get running MATLAB in GitHub Actions
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB Symbolic_Math_Toolbox
- name: Install jupyterlab and jupyter-matlab-proxy
working-directory: ${{ github.workspace }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install ".[dev]"
python3 -m pip install "jupyterlab>4.0.0,<5.0.0"
- name: Install playwright browsers
run: npx playwright install --with-deps
- name: Find an available port
run: |
FREE_PORT=$(python3 -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()');
echo "Using port = ${FREE_PORT}"
echo "TEST_JMP_PORT=$FREE_PORT" >> "$GITHUB_ENV"
- name: Start JupyterLab in background and save PID
id: start-jlab
run: |
npm start
- name: License MATLAB
env:
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pytest-playwright
python3 -m playwright install chromium --with-deps
(cd tests/utils && python3 -c "from licensing import *; license_with_online_licensing(log_dir=\"./licensing-logs\")")
- name: Run playwright tests
env:
TEST_JMP_PORT: ${{ env.TEST_JMP_PORT }}
run: |
echo "Playwright version: $(npx playwright -V)"
npm test
- name: Stop JupyterLab
if: always()
run: |
npm stop
- name: Zip test results
if: always()
run: |
zip -r zipped-e2e-test-results.zip \
./playwright-report \
./test-results \
./licensing-logs \
./jupyterlab.log
- name: Preserve test results after the job has finished
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e_test_results
path: ./tests/e2e/zipped-e2e-test-results.zip
retention-days: 5