Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

test

test #2132

Workflow file for this run

name: test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 5 * * *"
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1
jobs:
test:
name: py ${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.9, "3.10", 3.11]
node-version: [18]
runs-on: ubuntu-20.04
services:
selenium-hub:
image: selenium/hub:3.141.59
ports:
- 4444:4444
options: --health-cmd=/opt/bin/check-grid.sh --health-interval=15s --health-timeout=30s --health-retries=5
volumes:
- /tmp:/dev/shm
chrome:
image: selenium/node-chrome:3.141.59
env:
HUB_HOST: selenium-hub
HUB_PORT: 4444
SCREEN_WIDTH: 1440
SCREEN_HEIGHT: 900
volumes:
- /tmp:/dev/shm
env:
SELENIUM_HUB_HOST: selenium-hub
SELENIUM_HUB_PORT: 4444
PYTEST_BASE_URL: http://localhost:8866
steps:
- uses: actions/checkout@v3
- uses: arduino/setup-task@v1
# ------------------------------------------------------------------------
# JS
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Load cached node_modules
id: cached-node_modules
uses: actions/cache@v3
with:
path: js/node_modules
key: >
node_modules
${{ runner.os }}
node-${{ matrix.node-version }}
${{ hashFiles('js/package*.json') }}
- name: Install JS deps
if: steps.cached-node_modules.outputs.cache-hit != 'true'
run: |
task js-install
- name: Build JS
run: |
task download-assets
task js-build
# ------------------------------------------------------------------------
# Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
id: cached-python-env
with:
path: ${{ env.pythonLocation }}
key: >
python-test
${{ runner.os }}
python-${{ matrix.python-version }}
${{ hashFiles('python/pyproject.toml') }}
${{ hashFiles('python/requirements/*') }}
- name: Install dependencies
if: steps.cached-python-env.outputs.cache-hit != 'true'
run: |
pip install -r python/requirements/pyproject.txt
pip install -r python/requirements/examples.txt
- name: Install Hatch and other dependencies
run: |
pip install --upgrade hatch
task download-testdata
- name: Print Python info
run: |
which python
python --version
which pip
pip --version
pip freeze
# ------------------------------------------------------------------------
# Tests
- name: Build Python package
run: task build
- name: Install package
run: |
cd python
pip uninstall -y jupyter-flex
pip install dist/*.whl
pip freeze
- name: Verify Selenium Hub
run: |
curl http://localhost:4444/
- name: Serve Voila
run: |
task voila-examples &
- name: Verify Voila
run: |
# ls /__t/Python/3.7.7/x64/share/jupyter/voila/templates
curl http://localhost:8866/
- name: Run tests
run: |
task pytest-all
task pytest-report
- name: Codecov
uses: codecov/codecov-action@v2
with:
file: python/coverage.xml
- name: Upload test results to GitHub
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-results-py${{ matrix.python-version }}
path: python/test-results