Skip to content

feat: add integration tests to CI #1147

feat: add integration tests to CI

feat: add integration tests to CI #1147

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
actions: read
contents: read
packages: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run ESLint
run: npm run lint
- name: Check Prettier formatting
run: npm run format
typecheck:
name: TypeCheck
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run TypeScript type checking
run: npm run typecheck
qlty:
name: Qlty Check
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
fetch-depth: 0
- name: Install qlty
uses: qltysh/qlty-action/install@92420f3093ba65970fed22ce5f162ecb8a5c1700
- name: Run qlty check
run: qlty check
- name: Run qlty code smells analysis
run: qlty smells
build:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
id-token: write
contents: read
packages: read
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Compile TypeScript
run: npm run compile
- name: Run tests
run: npm test
env:
VSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
with:
use_oidc: true
files: coverage/lcov.info
fail_ci_if_error: true
- name: Upload test results to Codecov
if: '!cancelled()'
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1
with:
use_oidc: true
files: test-results.xml
fail_ci_if_error: true
- name: Check dependencies
run: npm run checkDependencies
continue-on-error: true
- name: Check licenses
run: npm run check-licenses
check_licenses:
name: Check Licenses
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check Licenses
run: npm run check-licenses
spell-check:
name: Spell Check
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run spell check
run: npm run spell-check
integration-tests:
name: Integration Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
id-token: write
contents: read
packages: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest] # Windows commented out for now, can be re-enabled later
python: [python]
pythonVersion: ['3.12']
tags: [
'^[^@]+$|@mandatory|@kernelCore|@python|@jupyter',
'@widgets',
'@iw',
'@webview|@export|@lsp|@variableViewer',
'@debugger'
]
# exclude:
# - os: windows-latest
# tags: '@widgets'
# - os: windows-latest
# tags: '@webview|@export|@lsp|@variableViewer'
env:
VSC_JUPYTER_FORCE_LOGGING: 'true'
VSC_PYTHON_FORCE_LOGGING: 'true'
VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders'
DISABLE_INSIDERS_EXTENSION: 1
PYTHON_VERSION: ${{ matrix.pythonVersion }}
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Setup Python ${{ matrix.pythonVersion }}
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
id: setupPythonVersion
with:
python-version: ${{ matrix.pythonVersion }}
- name: Set CI Python Path
run: echo "CI_PYTHON_PATH=${{ steps.setupPythonVersion.outputs.python-path }}" >> $GITHUB_ENV
# Cache pip dependencies
- name: Cache pip dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.pythonVersion }}-${{ hashFiles('build/venv-test-ipywidgets8-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.pythonVersion }}-
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Python test requirements
run: |
python --version
python -c "import sys;print(sys.executable)"
python -m pip install --upgrade pip wheel
python -m pip --disable-pip-version-check install -r build/venv-test-ipywidgets8-requirements.txt
python -m pip install packaging
python ./pythonFiles/install_debugpy.py
python -m ipykernel install --user
- name: Install screen capture dependencies
run: sudo apt-get update && sudo apt-get install --fix-missing imagemagick x11-xserver-utils
- name: Generate Tag Variable
run: echo "TAGSVAR=${{ matrix.tags }}" >> $GITHUB_ENV
- name: Generate Friendly Variable
run: echo "TAGS_NAME=${TAGSVAR//[^a-zA-Z]/_}" >> $GITHUB_ENV
- name: Compile TypeScript
run: npm run compile
env:
VSC_JUPYTER_CI_FAST_COMPILATION: 1
VSC_JUPYTER_CI_TEST_GREP: ${{ matrix.tags }}
- name: Create temp folder for user data dir
run: |
echo "VSC_JUPYTER_USER_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
echo ${{env.VSC_JUPYTER_USER_DATA_DIR}} is user data dir
# Windows-specific steps (commented out for now)
# - name: Create temp folder for user data dir (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# echo "VSC_JUPYTER_USER_DATA_DIR=$env:USERPROFILE\AppData\Local\Temp" >> $Env:GITHUB_ENV
# echo ${{env.VSC_JUPYTER_USER_DATA_DIR}} is user data dir
# shell: pwsh
- name: Set xvfb parameters
run: echo "xvfbCommand=--server-args=\"-screen 0 1024x768x24\"" >> $GITHUB_ENV
- name: Run integration tests
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
with:
run: ${{ env.xvfbCommand }} npm run test:integration
env:
VSC_JUPYTER_FORCE_LOGGING: 1
VSC_PYTHON_FORCE_LOGGING: 1
VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders'
VSC_JUPYTER_CI_TEST_GREP: ${{ matrix.tags }}
# Windows-specific test execution (commented out for now)
# - name: Run integration tests (Windows)
# if: matrix.os == 'windows-latest'
# run: npm run test:integration:windows
# env:
# VSC_JUPYTER_FORCE_LOGGING: 1
# VSC_PYTHON_FORCE_LOGGING: 1
# VSC_JUPYTER_CI_TEST_VSC_CHANNEL: 'insiders'
# VSC_JUPYTER_CI_TEST_GREP: ${{ matrix.tags }}
# VSC_PYTHON_LOG_FILE: ${{env.VSC_JUPYTER_USER_DATA_DIR}}/logs/python.log
- name: Upload VS Code logs
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5
if: failure()
with:
name: VSCodeLogs-${{ matrix.os }}-${{ matrix.pythonVersion }}-${{ env.TAGS_NAME }}
path: '${{env.VSC_JUPYTER_USER_DATA_DIR}}/logs/**/*'
retention-days: 7
- name: Upload test result files
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5
if: always()
with:
name: TestLogs-${{ matrix.os }}-${{ matrix.pythonVersion }}-${{ env.TAGS_NAME }}
path: './logs/*'
retention-days: 7
- name: Verify there are no unhandled errors
run: npx gulp verifyUnhandledErrors
audit-prod:
name: Audit - Production
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run audit for production dependencies
run: npm audit --production
audit-all:
name: Audit - All
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@deepnote'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run audit for all dependencies
run: npm audit