Merge pull request #8 from jaytmiller/add-token-header #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test Extension | |
on: [push, workflow_dispatch] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
# Get the current repo files and install node | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
# Install jupyterlab | |
- run: pip install jupyterlab | |
# Install the extension and show where it was installed | |
- run: pip install . | |
- run: jupyter labextension list | |
# Download and install gecko web driver | |
- run: wget https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux64.tar.gz | |
- run: sudo tar -xzf geckodriver-v0.32.2-linux64.tar.gz -C /usr/bin | |
- run: sudo chmod a+x /usr/bin/geckodriver | |
# Install selenium and pytest | |
- run: pip install selenium | |
- run: pip install pytest | |
# Install necessary server packages and start the server | |
- run: cd tests/test-server | |
- run: npm install express | |
- run: npm install cors | |
- run: npm install nodemon | |
- run: npm install | |
- run: (node ./tests/test-server/server.js &) | |
- run: cd ../.. | |
# Create the overrides.json file and set to fetch from localhost:3000 | |
- run: mkdir /home/runner/.local/share/jupyter/lab/settings | |
- run: | |
> | |
echo '{"stsci-announce:plugin": { "url": "http://localhost:3000" } }' > /home/runner/.local/share/jupyter/lab/settings/overrides.json | |
# Start jupyterlab and run the nonempty test | |
- run: jupyter labextension list | |
- run: jupyter lab --port=8888 --NotebookApp.token='' & | |
- run: pytest tests/test_nonempty_announcement.py | |
# Kill and restart the server | |
- run: killall -9 node | |
- run: cd tests/test-server | |
- run: (node ./tests/test-server/server.js --empty-announcement &) | |
# Run empty announcements test | |
- run: cd ../.. | |
- run: pytest tests/test_empty_announcement.py |