Skip to content

Fix lint formatting in execution test #13738

Fix lint formatting in execution test

Fix lint formatting in execution test #13738

Workflow file for this run

name: PR/CI Check
on:
pull_request:
push:
branches-ignore:
- main
- release*
permissions: {}
env:
NODE_VERSION: 22.21.1
PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already.
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix
TEST_RESULTS_DIRECTORY: .
# Force a path with spaces and to test extension works in these scenarios
# Unicode characters are causing 2.7 failures so skip that for now.
special-working-directory: './path with spaces'
special-working-directory-relative: 'path with spaces'
jobs:
build-vsix:
name: Create VSIX
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
vsix-target: win32-x64
- os: windows-latest
target: aarch64-pc-windows-msvc
vsix-target: win32-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
vsix-target: linux-x64
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# vsix-target: linux-arm64
# - os: ubuntu-latest
# target: arm-unknown-linux-gnueabihf
# vsix-target: linux-armhf
# - os: macos-latest
# target: x86_64-apple-darwin
# vsix-target: darwin-x64
# - os: macos-14
# target: aarch64-apple-darwin
# vsix-target: darwin-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
vsix-target: alpine-x64
# - os: ubuntu-latest
# target: aarch64-unknown-linux-musl
# vsix-target: alpine-arm64
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Checkout Python Environment Tools
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: 'microsoft/python-environment-tools'
path: 'python-env-tools'
persist-credentials: false
sparse-checkout: |
crates
Cargo.toml
Cargo.lock
sparse-checkout-cone-mode: false
- name: Build VSIX
uses: ./.github/actions/build-vsix
with:
node_version: ${{ env.NODE_VERSION}}
vsix_name: 'ms-python-insiders-${{ matrix.vsix-target }}.vsix'
artifact_name: '${{ env.ARTIFACT_NAME_VSIX }}-${{ matrix.vsix-target }}'
cargo_target: ${{ matrix.target }}
vsix_target: ${{ matrix.vsix-target }}
candidate-compatibility:
name: Candidate Core packaged compatibility (${{ matrix.vsix-target }})
needs: [build-vsix]
if: ${{ !cancelled() }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
vsix-target: win32-x64
- os: ubuntu-latest
vsix-target: linux-x64
steps:
- name: Checkout the same run's test orchestration
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Initialize candidate infrastructure evidence
if: always()
shell: pwsh
run: |
$evidence = Join-Path $env:GITHUB_WORKSPACE 'candidate-core-evidence'
New-Item -ItemType Directory -Path $evidence -Force | Out-Null
@{
schemaVersion = 1
status = 'infrastructure-error'
scope = 'ci-built-candidate-core-compatibility'
message = 'Candidate download, preparation or execution has not completed.'
runId = $env:GITHUB_RUN_ID
sourceCommit = $env:GITHUB_SHA
artifactName = $env:PYTHON_CANDIDATE_ARTIFACT
certifiesOfficialCandidateOrSignedPublication = $false
} | ConvertTo-Json | Set-Content (Join-Path $evidence 'job-report.json')
env:
PYTHON_CANDIDATE_ARTIFACT: '${{ env.ARTIFACT_NAME_VSIX }}-${{ matrix.vsix-target }}'
- name: Select repository Node version
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- name: Select Python for real fixture venvs
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Download original candidate VSIX from this workflow run
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: '${{ env.ARTIFACT_NAME_VSIX }}-${{ matrix.vsix-target }}'
path: candidate-core-artifact
- name: Restore only reviewed test orchestration dependencies
run: npm ci --ignore-scripts --no-audit --no-fund
- name: Exercise candidate Core and fixed released Environments on and off
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$artifact = Join-Path $env:GITHUB_WORKSPACE 'candidate-core-artifact'
$files = @(Get-ChildItem -LiteralPath $artifact -Filter '*.vsix' -File -Recurse)
$candidate = Join-Path $artifact "ms-python-insiders-$($env:PYTHON_CANDIDATE_TARGET).vsix"
if ($files.Count -ne 1 -or -not (Test-Path -LiteralPath $candidate -PathType Leaf)) {
throw 'The exact same-run candidate artifact must contain its one expected original VSIX.'
}
$evidence = Join-Path $env:GITHUB_WORKSPACE 'candidate-core-evidence'
$output = Join-Path $evidence 'compatibility'
$script = Join-Path (Join-Path (Join-Path $env:GITHUB_WORKSPACE 'build') 'releaseCompatibility') 'selfTest.js'
$python = (Get-Command python).Source
if ($IsLinux) {
& xvfb-run -a node $script $output $python $candidate
} else {
& node $script $output $python $candidate
}
$result = $LASTEXITCODE
$report = Get-Content (Join-Path $output 'input-report.json') -Raw | ConvertFrom-Json
$report | ConvertTo-Json -Depth 20 | Set-Content (Join-Path $evidence 'job-report.json')
exit $result
env:
PYTHON_CANDIDATE_TARGET: ${{ matrix.vsix-target }}
PYTHON_CANDIDATE_ARTIFACT: '${{ env.ARTIFACT_NAME_VSIX }}-${{ matrix.vsix-target }}'
PYTHON_CANDIDATE_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Retain candidate bytes provenance and all real-host outcomes
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: candidate-core-compatibility-${{ matrix.vsix-target }}
path: |
candidate-core-evidence/job-report.json
candidate-core-evidence/compatibility/input-report.json
candidate-core-evidence/compatibility/plan.json
candidate-core-evidence/compatibility/run/report.json
candidate-core-evidence/compatibility/run/environments-on/candidate/**
candidate-core-evidence/compatibility/run/environments-on/user-data/logs/**
candidate-core-evidence/compatibility/run/environments-on/workspace/probe-*.json
candidate-core-evidence/compatibility/run/explicit-off/candidate/**
candidate-core-evidence/compatibility/run/explicit-off/user-data/logs/**
candidate-core-evidence/compatibility/run/explicit-off/workspace/probe-*.json
if-no-files-found: error
retention-days: 7
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Lint
uses: ./.github/actions/lint
with:
node_version: ${{ env.NODE_VERSION }}
check-types:
name: Check Python types
runs-on: ubuntu-latest
steps:
- name: Use Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Checkout Python Environment Tools
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: 'microsoft/python-environment-tools'
path: 'python-env-tools'
persist-credentials: false
sparse-checkout: |
crates
Cargo.toml
Cargo.lock
sparse-checkout-cone-mode: false
- name: Install base Python requirements
uses: brettcannon/pip-secure-install@92f400e3191171c1858cc0e0d9ac6320173fdb0c # v1.0.0
with:
options: '-t ./python_files/lib/python --no-cache-dir --implementation py'
- name: Install Jedi requirements
uses: brettcannon/pip-secure-install@92f400e3191171c1858cc0e0d9ac6320173fdb0c # v1.0.0
with:
requirements-file: './python_files/jedilsp_requirements/requirements.txt'
options: '-t ./python_files/lib/jedilsp --no-cache-dir --implementation py'
- name: Install other Python requirements
run: |
python -m pip install --upgrade -r build/test-requirements.txt
- name: Run Pyright
uses: jakebailey/pyright-action@8ec14b5cfe41f26e5f41686a31eb6012758217ef # v3.0.2
with:
version: 1.1.308
working-directory: 'python_files'
python-tests:
name: Python Tests
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.special-working-directory }}
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the Unix case.
os: [ubuntu-latest, windows-latest]
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
# Test approximately one year of pytest releases and upcoming pytest changes.
pytest-version: ['pytest==8.4.*', 'pytest@pre-release']
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ${{ env.special-working-directory-relative }}
persist-credentials: false
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- name: Install base Python requirements
uses: brettcannon/pip-secure-install@92f400e3191171c1858cc0e0d9ac6320173fdb0c # v1.0.0
with:
requirements-file: '"${{ env.special-working-directory-relative }}/requirements.txt"'
options: '-t "${{ env.special-working-directory-relative }}/python_files/lib/python" --no-cache-dir --implementation py'
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt
- name: Install specific pytest version (pre-release)
if: matrix.pytest-version == 'pytest@pre-release'
run: python -m pip install --upgrade --pre pytest
- name: Install specific pytest version
if: matrix.pytest-version != 'pytest@pre-release'
run: python -m pip install --upgrade "${{ matrix.pytest-version }}"
- name: Print pytest version
run: python -m pytest --version
- name: Run Python unit tests
run: python python_files/tests/run_all.py
tests:
name: Tests
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.special-working-directory }}
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the Unix case.
os: [ubuntu-latest, windows-latest]
# Run the tests on the oldest and most recent versions of Python.
python: ['3.x']
test-suite: [ts-unit, venv, single-workspace, debugger, functional]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ${{ env.special-working-directory-relative }}
persist-credentials: false
- name: Checkout Python Environment Tools
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: 'microsoft/python-environment-tools'
path: ${{ env.special-working-directory-relative }}/python-env-tools
persist-credentials: false
sparse-checkout: |
crates
Cargo.toml
Cargo.lock
sparse-checkout-cone-mode: false
- name: Install Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.special-working-directory-relative }}/package-lock.json
- name: Install dependencies (npm ci)
run: npm ci
- name: Compile
run: npx gulp prePublishNonBundle
- name: Localization
run: npx @vscode/l10n-dev@latest export ./src
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- name: Upgrade Pip
run: python -m pip install -U pip
# For faster/better builds of sdists.
- name: Install build pre-requisite
run: python -m pip install wheel nox
- name: Install Python Extension dependencies (jedi, etc.)
run: nox --session install_python_libs
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt
- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # stable
with:
toolchain: stable
- name: Build Native Binaries
run: nox --session native_build
shell: bash
- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
if: matrix.test-suite == 'functional'
- name: Prepare pipenv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
if: matrix.test-suite == 'venv'
run: |
python -m pip install pipenv
python -m pipenv run python ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} pipenvPath
- name: Prepare poetry for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
shell: pwsh
if: matrix.test-suite == 'venv'
run: |
python -m pip install poetry
Move-Item -Path ".\build\ci\pyproject.toml" -Destination .
poetry env use python
- name: Prepare virtualenv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
if: matrix.test-suite == 'venv'
run: |
python -m pip install virtualenv
python -m virtualenv --no-venv-redirect .virtualenv/
if ('${{ matrix.os }}' -match 'windows-latest') {
& ".virtualenv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} virtualEnvPath
} else {
& ".virtualenv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} virtualEnvPath
}
- name: Prepare venv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
if: matrix.test-suite == 'venv' && startsWith(matrix.python, 3.)
run: |
python -m venv .venv
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ('${{ matrix.os }}' -match 'windows-latest') {
& "./.venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
} else {
& "./.venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
}
- name: Set up Conda for venv tests
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
with:
activate-environment: ''
auto-activate: false
if: matrix.test-suite == 'venv'
- name: Prepare conda for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
if: matrix.test-suite == 'venv'
run: |
# 1. For `*.testvirtualenvs.test.ts`
$condaCommand = Get-Command conda -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $condaCommand) {
throw 'Conda executable was not found on PATH.'
}
$condaExecPath = $condaCommand.Source
$condaBasePath = & $condaExecPath info --base
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($condaBasePath)) {
throw "Could not determine the Conda base directory using '$condaExecPath info --base'."
}
$condaBasePath = "$condaBasePath".Trim()
if ('${{ matrix.os }}' -match 'windows-latest') {
$condaPythonPath = Join-Path -Path $condaBasePath -ChildPath python.exe
} else{
$condaPythonPath = Join-Path -Path $condaBasePath -ChildPath bin | Join-Path -ChildPath python
}
if (-not (Test-Path -Path $condaPythonPath -PathType Leaf)) {
throw "Conda base Python was not found at '$condaPythonPath'."
}
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaExecPath $condaExecPath
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaPath
& $condaExecPath init --all
- name: Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION
run: |
echo "CI_PYTHON_PATH=python" >> $GITHUB_ENV
echo "CI_DISABLE_AUTO_SELECTION=1" >> $GITHUB_ENV
shell: bash
if: matrix.test-suite != 'ts-unit'
# Run TypeScript unit tests only for Python 3.X.
- name: Run TypeScript unit tests
run: npm run test:unittests
if: matrix.test-suite == 'ts-unit' && startsWith(matrix.python, 3.)
# The virtual environment based tests use the `testSingleWorkspace` set of tests
# with the environment variable `TEST_FILES_SUFFIX` set to `testvirtualenvs`,
# which is set in the "Prepare environment for venv tests" step.
# We also use a third-party GitHub Action to install xvfb on Linux,
# run tests and then clean up the process once the tests ran.
# See https://github.com/GabrielBB/xvfb-action
- name: Run venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
CI_PYTHON_VERSION: ${{ matrix.python }}
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
with:
run: npm run testSingleWorkspace
working-directory: ${{ env.special-working-directory }}
if: matrix.test-suite == 'venv'
- name: Run single-workspace tests
env:
CI_PYTHON_VERSION: ${{ matrix.python }}
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
with:
run: npm run testSingleWorkspace
working-directory: ${{ env.special-working-directory }}
if: matrix.test-suite == 'single-workspace'
- name: Run debugger tests
env:
CI_PYTHON_VERSION: ${{ matrix.python }}
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
with:
run: npm run testDebugger
working-directory: ${{ env.special-working-directory }}
if: matrix.test-suite == 'debugger'
# Run TypeScript functional tests
- name: Run TypeScript functional tests
run: npm run test:functional
if: matrix.test-suite == 'functional'
native-tests:
name: Native Tests
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.special-working-directory }}
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the Unix case.
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ${{ env.special-working-directory-relative }}
persist-credentials: false
- name: Checkout Python Environment Tools
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: 'microsoft/python-environment-tools'
path: ${{ env.special-working-directory-relative }}/python-env-tools
persist-credentials: false
sparse-checkout: |
crates
Cargo.toml
Cargo.lock
sparse-checkout-cone-mode: false
- name: Python Environment Tools tests
run: cargo test -- --nocapture
working-directory: ${{ env.special-working-directory }}/python-env-tools
smoke-tests:
name: Smoke tests
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
needs: [build-vsix]
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the UNIX case.
include:
- os: windows-latest
vsix-target: win32-x64
- os: ubuntu-latest
vsix-target: linux-x64
steps:
# Need the source to have the tests available.
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Checkout Python Environment Tools
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: 'microsoft/python-environment-tools'
path: python-env-tools
persist-credentials: false
sparse-checkout: |
crates
Cargo.toml
Cargo.lock
sparse-checkout-cone-mode: false
- name: Smoke tests
uses: ./.github/actions/smoke-tests
with:
node_version: ${{ env.NODE_VERSION }}
artifact_name: '${{ env.ARTIFACT_NAME_VSIX }}-${{ matrix.vsix-target }}'
### Coverage run
coverage:
name: Coverage
# TEMPORARILY DISABLED - hanging in CI, needs investigation
if: false
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
needs: [lint, check-types, python-tests, tests, native-tests]
strategy:
fail-fast: false
matrix:
# Only run coverage on linux for PRs
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Checkout Python Environment Tools
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: 'microsoft/python-environment-tools'
path: python-env-tools
persist-credentials: false
sparse-checkout: |
crates
Cargo.toml
Cargo.lock
sparse-checkout-cone-mode: false
- name: Install Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies (npm ci)
run: npm ci
- name: Compile
run: npx gulp prePublishNonBundle
- name: Localization
run: npx @vscode/l10n-dev@latest export ./src
- name: Use Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
python_files/jedilsp_requirements/requirements.txt
build/test-requirements.txt
build/functional-test-requirements.txt
- name: Install base Python requirements
uses: brettcannon/pip-secure-install@92f400e3191171c1858cc0e0d9ac6320173fdb0c # v1.0.0
with:
options: '-t ./python_files/lib/python --implementation py'
- name: Install Jedi requirements
uses: brettcannon/pip-secure-install@92f400e3191171c1858cc0e0d9ac6320173fdb0c # v1.0.0
with:
requirements-file: './python_files/jedilsp_requirements/requirements.txt'
options: '-t ./python_files/lib/jedilsp --implementation py'
- name: Install build pre-requisite
run: python -m pip install wheel nox
shell: bash
- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # stable
with:
toolchain: stable
- name: Build Native Binaries
run: nox --session native_build
shell: bash
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt
- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
- name: Prepare pipenv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
python -m pip install pipenv
python -m pipenv run python ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} pipenvPath
- name: Prepare poetry for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
shell: pwsh
run: |
python -m pip install poetry
Move-Item -Path ".\build\ci\pyproject.toml" -Destination .
poetry env use python
- name: Prepare virtualenv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
python -m pip install virtualenv
python -m virtualenv --no-venv-redirect .virtualenv/
if ('${{ matrix.os }}' -match 'windows-latest') {
& ".virtualenv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} virtualEnvPath
} else {
& ".virtualenv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} virtualEnvPath
}
- name: Prepare venv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
python -m venv .venv
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ('${{ matrix.os }}' -match 'windows-latest') {
& "./.venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
} else {
& "./.venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
}
- name: Set up Conda for venv tests
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
with:
activate-environment: ''
auto-activate: false
- name: Prepare conda for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
# 1. For `*.testvirtualenvs.test.ts`
$condaCommand = Get-Command conda -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $condaCommand) {
throw 'Conda executable was not found on PATH.'
}
$condaExecPath = $condaCommand.Source
$condaBasePath = & $condaExecPath info --base
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($condaBasePath)) {
throw "Could not determine the Conda base directory using '$condaExecPath info --base'."
}
$condaBasePath = "$condaBasePath".Trim()
if ('${{ matrix.os }}' -match 'windows-latest') {
$condaPythonPath = Join-Path -Path $condaBasePath -ChildPath python.exe
} else{
$condaPythonPath = Join-Path -Path $condaBasePath -ChildPath bin | Join-Path -ChildPath python
}
if (-not (Test-Path -Path $condaPythonPath -PathType Leaf)) {
throw "Conda base Python was not found at '$condaPythonPath'."
}
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaExecPath $condaExecPath
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaPath
& $condaExecPath init --all
- name: Run TypeScript unit tests
run: npm run test:unittests:cover
- name: Run Python unit tests
run: |
python python_files/tests/run_all.py
# The virtual environment based tests use the `testSingleWorkspace` set of tests
# with the environment variable `TEST_FILES_SUFFIX` set to `testvirtualenvs`,
# which is set in the "Prepare environment for venv tests" step.
# We also use a third-party GitHub Action to install xvfb on Linux,
# run tests and then clean up the process once the tests ran.
# See https://github.com/GabrielBB/xvfb-action
- name: Run venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
CI_PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
CI_DISABLE_AUTO_SELECTION: 1
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
with:
run: npm run testSingleWorkspace:cover
- name: Run single-workspace tests
env:
CI_PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
CI_DISABLE_AUTO_SELECTION: 1
uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
with:
run: npm run testSingleWorkspace:cover
# Enable these tests when coverage is setup for multiroot workspace tests
# - name: Run multi-workspace tests
# env:
# CI_PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
# CI_DISABLE_AUTO_SELECTION: 1
# uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
# with:
# run: npm run testMultiWorkspace:cover
# Enable these tests when coverage is setup for debugger tests
# - name: Run debugger tests
# env:
# CI_PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
# CI_DISABLE_AUTO_SELECTION: 1
# uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7
# with:
# run: npm run testDebugger:cover
# Run TypeScript functional tests
- name: Run TypeScript functional tests
env:
CI_PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
CI_DISABLE_AUTO_SELECTION: 1
run: npm run test:functional:cover
- name: Generate coverage reports
run: npm run test:cover:report
- name: Upload HTML report
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ runner.os }}-coverage-report-html
path: ./coverage
retention-days: 1