-
Notifications
You must be signed in to change notification settings - Fork 4
86 lines (77 loc) · 2.88 KB
/
main.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
name: Build and Test Extension
on: [push, workflow_dispatch]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
# Get the current repo files and install node
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: List files in the repository
run: |
ls ${{ github.workspace }}
# Install jupyterlab
- name: Install JupyterLab
run: |
python -m pip install "jupyterlab>=3.5.0,<4"
jupyter lab --version
jupyter --paths
# Install the extension and show where it was installed
- name: Install the extension
run: |
python -m pip install .
jupyter labextension list
# Create the overrides.json file and copy the data from example_overrides, then set fetch source
- name: Set overrides
run: |
mkdir -p /home/runner/.local/etc/jupyter/labconfig
cp example_overrides.json /home/runner/.local/etc/jupyter/labconfig/default_setting_overrides.json
echo '{"nersc-refresh-announcements:plugin": { "url": "http://localhost:3000" } }' > /home/runner/.local/etc/jupyter/labconfig/default_setting_overrides.json
# Download and install gecko web driver
- name: Get web driver
run: |
wget https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux64.tar.gz
sudo tar -xzf geckodriver-v0.32.2-linux64.tar.gz -C /usr/bin
sudo chmod a+x /usr/bin/geckodriver
# Install selenium and pytest
- name: Install Selenium
run: python -m pip install selenium
- name: Install pytest
run: python -m pip install pytest
# Install necessary server packages and start the server
- name: Setup mock server for tests
run: |
cd tests/test-server
npm install express
npm install cors
npm install nodemon
npm install
cd ../..
(node ./tests/test-server/server.js &)
# Start jupyterlab and run the nonempty test
- name: Start jupyterlab
run: |
jupyter labextension list
jupyter lab --port=8888 --NotebookApp.token='' &
- name: Run nonempty test
run: |
pytest tests/test_nonempty_announcement.py
# Kill and restart the server
- name: Restart nodejs server
run: |
killall -9 node
cd tests/test-server
(node ./tests/test-server/server.js --empty-announcement &)
cd ../..
# Run empty announcements test
- name: Run empty announcement test
run: |
pytest tests/test_empty_announcement.py