From 7ff3fa36585bf961f891747c7a3bb8f4d900360f Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Wed, 28 Apr 2021 17:07:11 -0700 Subject: [PATCH 1/8] Create a unified 'build' workflow --- .github/workflows/build.yml | 487 ++++++++++++++++++++++++++++++++++++ 1 file changed, 487 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..06f530103c25 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,487 @@ +name: Build + +on: + push: + branches: + - 'main' + - 'release' + - 'release/*' + - 'release-*' + +env: + PYTHON_VERSION: 3.9 + PYTHON_DEBUGPY_WHEEL_VERSION: 3.8 + NODE_VERSION: 12.15.0 + # 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: + setup: + name: Set up + runs-on: ubuntu-latest + defaults: + run: + shell: python + outputs: + vsix_name: ${{ steps.vsix_names.outputs.vsix_name }} + vsix_artifact_name: $ {{ steps.vsix_names.outputs.vsix_artifact_name }} + steps: + - name: VSIX names + id: vsix_names + run: | + import os + if os.environ["GITHUB_REF"].endswith("/main"): + vsix_type = "insiders" + else: + vsix_type = "release" + print(f"::set-output name=vsix_name::ms-python-{vsix_type}.vsix") + print(f"::set-output name=vsix_artifact_name::ms-python-{vsix_type}-vsix") + + build-vsix: + name: Build VSIX + runs-on: ubuntu-latest + needs: setup + if: github.repository == 'microsoft/vscode-python' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node + uses: actions/setup-node@v2.1.5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: Use Python ${{env.PYTHON_VERSION}} + uses: actions/setup-python@v2 + with: + python-version: ${{env.PYTHON_VERSION}} + + - name: Upgrade pip + run: python -m pip install -U pip + + - name: Build VSIX + uses: ./.github/actions/build-vsix + id: build-vsix + + - name: Rename VSIX + if: steps.build-vsix.outputs.path != needs.setup.outputs.vsix_name + run: mv ${{ steps.build-vsix.outputs.path }} ${{ needs.setup.outputs.vsix_name }} + + - uses: actions/upload-artifact@v2 + with: + name: ${{ needs.setup.outputs.vsix_artifact_name }} + path: ${{ needs.setup.outputs.vsix_name }} + retention-days: 14 + + lint: + name: Lint + runs-on: ubuntu-latest + if: github.repository == 'microsoft/vscode-python' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node + uses: actions/setup-node@v2.1.5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: Install dependencies (npm ci) + run: npm ci --prefer-offline + + - name: Run gulp prePublishNonBundle + run: npx gulp prePublishNonBundle + + - name: Check dependencies + run: npm run checkDependencies + + - name: Run linting on TypeScript code + run: npm run lint + + - name: Run formatting on TypeScript code + run: npm run format-check + + - name: Use Python ${{env.PYTHON_VERSION}} + uses: actions/setup-python@v2 + with: + python-version: ${{env.PYTHON_VERSION}} + + - name: Run Black on Python code + run: | + python -m pip install -U black + python -m black . --check + working-directory: pythonFiles + + ### Non-smoke tests + 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}} + if: github.repository == 'microsoft/vscode-python' + 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: [2.7, '${{ env.PYTHON_VERSION }}'] + test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: ${{env.special-working-directory-relative}} + + - name: Install Node + uses: actions/setup-node@v2.1.5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: Install dependencies (npm ci) + run: npm ci + + - name: Compile + run: npx gulp prePublishNonBundle + + - name: Install Python ${{ env.PYTHON_DEBUGPY_WHEEL_VERSION }} for debugpy wheels + if: matrix.test_suite == 'debugger' + uses: actions/setup-python@v2 + with: + python-version: ${{ env.PYTHON_DEBUGPY_WHEEL_VERSION }} + + - name: Install Python ${{matrix.python}} + uses: actions/setup-python@v2 + with: + python-version: ${{matrix.python}} + + - name: Install Node + uses: actions/setup-node@v2.1.5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: Install Python requirements + run: | + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt + # We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase. + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy + + - name: Install test requirements + run: python -m pip install --upgrade -r build/test-requirements.txt + + - name: Install debugpy wheels (python 3.8) + run: | + python${{ env.PYTHON_DEBUGPY_WHEEL_VERSION }} -m pip install wheel + python${{ env.PYTHON_DEBUGPY_WHEEL_VERSION }} -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt + python${{ env.PYTHON_DEBUGPY_WHEEL_VERSION }} ./pythonFiles/install_debugpy.py + shell: bash + if: matrix.test-suite == 'debugger' + + - name: Install debugpy (python 2.7) + run: | + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy + shell: bash + if: matrix.test-suite == 'debugger' && matrix.python == 2.7 + + - 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 .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 ('${{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: 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 `terminalActivation.testvirtualenvs.test.ts` + if ('${{matrix.os}}' -match 'windows-latest') { + $condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath python.exe + $condaExecPath = Join-Path -Path $Env:CONDA -ChildPath Scripts | Join-Path -ChildPath conda + } else{ + $condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath python + $condaExecPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath conda + } + & $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaExecPath $condaExecPath + & $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaPath + + # 2. For `interpreterLocatorService.testvirtualenvs.ts` + + & $condaExecPath create -n "test_env1" -y python + & $condaExecPath create -p "./test_env2" -y python + & $condaExecPath create -p "~/test_env3" -y python + + - 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.) + + # Run the Python tests in our codebase. + - name: Run Python unit tests + run: | + python pythonFiles/tests/run_all.py + if: matrix.test-suite == 'python-unit' + + # 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@v1.5 + 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@v1.5 + with: + run: npm run testSingleWorkspace + working-directory: ${{env.special-working-directory}} + if: matrix.test-suite == 'single-workspace' + + - name: Run multi-workspace tests + env: + CI_PYTHON_VERSION: ${{matrix.python}} + uses: GabrielBB/xvfb-action@v1.5 + with: + run: npm run testMultiWorkspace + working-directory: ${{env.special-working-directory}} + if: matrix.test-suite == 'multi-workspace' + + - name: Run debugger tests + env: + CI_PYTHON_VERSION: ${{matrix.python}} + uses: GabrielBB/xvfb-action@v1.5 + 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' + + 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 }} + if: github.repository == 'microsoft/vscode-python' + needs: [setup, 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. + os: [ubuntu-latest, windows-latest] + python: ['${{ env.PYTHON_VERSION }}'] + steps: + # Need the source to have the tests available. + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node + uses: actions/setup-node@v2.1.5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: Use Python ${{matrix.python}} + uses: actions/setup-python@v2 + with: + python-version: ${{matrix.python}} + + - name: Install dependencies (npm ci) + run: npm ci --prefer-offline + + - name: pip install system test requirements + run: | + python -m pip install --upgrade -r build/test-requirements.txt + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy + shell: bash + + - name: pip install smoke test requirements + run: | + python -m pip install --upgrade -r build/smoke-test-requirements.txt + shell: bash + + # Save time by reusing bits from the VSIX. + - name: Download VSIX + uses: actions/download-artifact@v2 + with: + name: ${{ needs.setup.outputs.vsix_artifactname }} + + # Compile the test files. + - name: Prepare for smoke tests + run: npx tsc -p ./ + shell: bash + + - 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 + + - name: Run smoke tests + env: + DISPLAY: 10 + INSTALL_JUPYTER_EXTENSION: true + uses: GabrielBB/xvfb-action@v1.5 + with: + run: node --no-force-async-hooks-checks ./out/test/smokeTest.js + + insider-tests: + name: Insider 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 }} + if: github.repository == 'microsoft/vscode-python' + 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] + python: [3.8] + steps: + # Need the source to have the tests available. + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node + uses: actions/setup-node@v2.1.5 + with: + node-version: ${{env.NODE_VERSION}} + + - name: Use Python ${{matrix.python}} + uses: actions/setup-python@v2 + with: + python-version: ${{matrix.python}} + + - name: Install dependencies (npm ci) + run: npm ci --prefer-offline + + - name: pip install system test requirements + run: | + python -m pip install --upgrade -r build/test-requirements.txt + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt + python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy + shell: bash + + - name: pip install smoke test requirements + run: | + python -m pip install --upgrade -r build/smoke-test-requirements.txt + shell: bash + + # Compile the test files. + - name: Prepare for insiders tests + run: npm run prePublish + shell: bash + + - 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 + + - name: Run insider tests + env: + DISPLAY: 10 + INSTALL_JUPYTER_EXTENSION: true + INSTALL_PYLANCE_EXTENSION: true + VSC_PYTHON_CI_TEST_VSC_CHANNEL: insiders + TEST_FILES_SUFFIX: insiders.test + CODE_TESTS_WORKSPACE: ./src/testMultiRootWkspc/smokeTests + uses: GabrielBB/xvfb-action@v1.5 + with: + run: node --no-force-async-hooks-checks ./out/test/standardTest.js + + upload: + name: Upload VSIX to Azure Blob Storage + if: github.repository == 'microsoft/vscode-python' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: [setup, tests, smoke-tests, build-vsix] + env: + BLOB_CONTAINER_NAME: extension-builds + BLOB_NAME: ms-python-insiders.vsix + steps: + - name: Download VSIX + uses: actions/download-artifact@v2 + with: + name: ${{ needs.setup.outputs.vsix_artifact_name }} + - name: Azure Login + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + - name: Upload to Blob Storage + run: az storage blob upload --file ${{ needs.setup.outputs.vsix_name }} --account-name pvsc --container-name ${{ env.BLOB_CONTAINER_NAME }} --name ${{ env.BLOB_NAME }} --auth-mode login + - name: Get URL to uploaded VSIX + run: az storage blob url --account-name pvsc --container-name ${{ env.BLOB_CONTAINER_NAME }} --name ${{ env.BLOB_NAME }} --auth-mode login From 18f191661dfa499371e9f35bc2b33500a7eda148 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 15:43:34 -0700 Subject: [PATCH 2/8] Test new setup --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06f530103c25..0260b11f7a1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,11 +2,11 @@ name: Build on: push: - branches: - - 'main' - - 'release' - - 'release/*' - - 'release-*' + # branches: + # - 'main' + # - 'release' + # - 'release/*' + # - 'release-*' env: PYTHON_VERSION: 3.9 From 263172a67cda3e2f29250a06cddac8a836f6dec1 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 15:45:31 -0700 Subject: [PATCH 3/8] Try to fix using env to specify the Python version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0260b11f7a1a..1ae9d37bc3d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,7 +130,7 @@ jobs: # 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: [2.7, '${{ env.PYTHON_VERSION }}'] + python: [2.7, ${{ env.PYTHON_VERSION }}] test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] steps: - name: Checkout From 4e88980076e17832b2c7cc84f6e8806cc085193f Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 15:51:18 -0700 Subject: [PATCH 4/8] Try to use an environment variable in the test matrix --- .github/workflows/build.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ae9d37bc3d0..179e4fbe4ad9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,12 +126,14 @@ jobs: 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: [2.7, ${{ env.PYTHON_VERSION }}] test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] + # 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: + - python: '2.7' + - python: ${{ env.PYTHON_VERSION }} steps: - name: Checkout uses: actions/checkout@v2 From 4fdc73d9c4b96d82a3e0d99726925d931d4e85ff Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 15:54:58 -0700 Subject: [PATCH 5/8] Use 3.x as the newest version of Python to support --- .github/workflows/build.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 179e4fbe4ad9..23f09d75c38a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,6 @@ on: # - 'release-*' env: - PYTHON_VERSION: 3.9 PYTHON_DEBUGPY_WHEEL_VERSION: 3.8 NODE_VERSION: 12.15.0 # Force a path with spaces and to test extension works in these scenarios @@ -53,10 +52,10 @@ jobs: with: node-version: ${{env.NODE_VERSION}} - - name: Use Python ${{env.PYTHON_VERSION}} + - name: Use Python 3.x uses: actions/setup-python@v2 with: - python-version: ${{env.PYTHON_VERSION}} + python-version: 3.x - name: Upgrade pip run: python -m pip install -U pip @@ -103,10 +102,10 @@ jobs: - name: Run formatting on TypeScript code run: npm run format-check - - name: Use Python ${{env.PYTHON_VERSION}} + - name: Use Python 3.x uses: actions/setup-python@v2 with: - python-version: ${{env.PYTHON_VERSION}} + python-version: 3.x - name: Run Black on Python code run: | @@ -126,14 +125,12 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] - test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] # 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: - - python: '2.7' - - python: ${{ env.PYTHON_VERSION }} + os: [ubuntu-latest, windows-latest] + python: ['2.7', '3.x'] + test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] steps: - name: Checkout uses: actions/checkout@v2 @@ -345,7 +342,7 @@ jobs: # 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: ['${{ env.PYTHON_VERSION }}'] + python: ['3.x'] steps: # Need the source to have the tests available. - name: Checkout From 1158cedaf718e01f2ba8f0410194f5ccc3efa1df Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 15:56:39 -0700 Subject: [PATCH 6/8] Test using setup outputs --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23f09d75c38a..8c006ba28e02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: name: Build VSIX runs-on: ubuntu-latest needs: setup - if: github.repository == 'microsoft/vscode-python' + #if: github.repository == 'microsoft/vscode-python' steps: - name: Checkout uses: actions/checkout@v2 From 2a0851ecf0c79a2865491af57a0af1e1a6957338 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 16:08:03 -0700 Subject: [PATCH 7/8] Final touch-ups for the PR --- .github/workflows/build.yml | 39 +++++++++++++++---------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c006ba28e02..d7f03dad3317 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,11 +2,11 @@ name: Build on: push: - # branches: - # - 'main' - # - 'release' - # - 'release/*' - # - 'release-*' + branches: + - 'main' + - 'release' + - 'release/*' + - 'release-*' env: PYTHON_DEBUGPY_WHEEL_VERSION: 3.8 @@ -19,6 +19,7 @@ env: jobs: setup: name: Set up + if: github.repository == 'microsoft/vscode-python' runs-on: ubuntu-latest defaults: run: @@ -40,9 +41,9 @@ jobs: build-vsix: name: Build VSIX - runs-on: ubuntu-latest + if: github.repository == 'microsoft/vscode-python' needs: setup - #if: github.repository == 'microsoft/vscode-python' + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 @@ -76,8 +77,8 @@ jobs: lint: name: Lint - runs-on: ubuntu-latest if: github.repository == 'microsoft/vscode-python' + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 @@ -116,12 +117,11 @@ jobs: ### Non-smoke tests 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. + if: github.repository == 'microsoft/vscode-python' runs-on: ${{ matrix.os }} defaults: run: working-directory: ${{env.special-working-directory}} - if: github.repository == 'microsoft/vscode-python' strategy: fail-fast: false matrix: @@ -274,12 +274,10 @@ jobs: # 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.) + if: matrix.test-suite == 'ts-unit' && startsWith(matrix.python, '3.') - # Run the Python tests in our codebase. - name: Run Python unit tests - run: | - python pythonFiles/tests/run_all.py + run: python pythonFiles/tests/run_all.py if: matrix.test-suite == 'python-unit' # The virtual environment based tests use the `testSingleWorkspace` set of tests @@ -332,9 +330,8 @@ jobs: 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 }} if: github.repository == 'microsoft/vscode-python' + runs-on: ${{ matrix.os }} needs: [setup, build-vsix] strategy: fail-fast: false @@ -344,7 +341,6 @@ jobs: os: [ubuntu-latest, windows-latest] python: ['3.x'] steps: - # Need the source to have the tests available. - name: Checkout uses: actions/checkout@v2 @@ -379,7 +375,6 @@ jobs: with: name: ${{ needs.setup.outputs.vsix_artifactname }} - # Compile the test files. - name: Prepare for smoke tests run: npx tsc -p ./ shell: bash @@ -400,18 +395,16 @@ jobs: insider-tests: name: Insider 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 }} if: github.repository == 'microsoft/vscode-python' + runs-on: ${{ matrix.os }} 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] - python: [3.8] + python: [3.8] # For Jupyter. steps: - # Need the source to have the tests available. - name: Checkout uses: actions/checkout@v2 @@ -466,8 +459,8 @@ jobs: upload: name: Upload VSIX to Azure Blob Storage if: github.repository == 'microsoft/vscode-python' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest needs: [setup, tests, smoke-tests, build-vsix] + runs-on: ubuntu-latest env: BLOB_CONTAINER_NAME: extension-builds BLOB_NAME: ms-python-insiders.vsix From 9b6506f765ba44fd74bdbdd6c586e5f3613fbdb2 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Thu, 29 Apr 2021 16:08:29 -0700 Subject: [PATCH 8/8] Drop old workflow files --- .github/workflows/insiders.yml | 460 --------------------------------- .github/workflows/release.yml | 433 ------------------------------- 2 files changed, 893 deletions(-) delete mode 100644 .github/workflows/insiders.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml deleted file mode 100644 index b147600b1917..000000000000 --- a/.github/workflows/insiders.yml +++ /dev/null @@ -1,460 +0,0 @@ -name: Insiders Build - -on: - push: - branches: - - main - -env: - NODE_VERSION: 12.15.0 - PYTHON_VERSION: 3.9 - 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 - VSIX_NAME: 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: Build VSIX - runs-on: ubuntu-latest - if: github.repository == 'microsoft/vscode-python' - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Use Python ${{env.PYTHON_VERSION}} - uses: actions/setup-python@v2 - with: - python-version: ${{env.PYTHON_VERSION}} - - - name: Upgrade pip - run: python -m pip install -U pip - - - name: Build VSIX - uses: ./.github/actions/build-vsix - id: build-vsix - - - name: Rename VSIX - if: steps.build-vsix.outputs.path != env.VSIX_NAME - run: mv ${{ steps.build-vsix.outputs.path }} ${{ env.VSIX_NAME }} - - - uses: actions/upload-artifact@v2 - with: - name: ${{env.ARTIFACT_NAME_VSIX}} - path: ${{env.VSIX_NAME}} - retention-days: 7 - - lint: - name: Lint - runs-on: ubuntu-latest - if: github.repository == 'microsoft/vscode-python' - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Install dependencies (npm ci) - run: npm ci --prefer-offline - - - name: Run gulp prePublishNonBundle - run: npx gulp prePublishNonBundle - - - name: Check dependencies - run: npm run checkDependencies - - - name: Run linting on TypeScript code - run: npm run lint - - - name: Run formatting on TypeScript code - run: npm run format-check - - - name: Use Python ${{env.PYTHON_VERSION}} - uses: actions/setup-python@v2 - with: - python-version: ${{env.PYTHON_VERSION}} - - - name: Run Black on Python code - run: | - python -m pip install -U black - python -m black . --check - working-directory: pythonFiles - - ### Non-smoke tests - 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}} - if: github.repository == 'microsoft/vscode-python' - 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: [2.7, 3.9] - test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - path: ${{env.special-working-directory-relative}} - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Install dependencies (npm ci) - run: npm ci - - - name: Compile - run: npx gulp prePublishNonBundle - - - name: Use Python ${{matrix.python}} - uses: actions/setup-python@v2 - with: - python-version: ${{matrix.python}} - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Install Python requirements - run: | - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user - # We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase. - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - - - name: Install test requirements - run: python -m pip install --upgrade -r build/test-requirements.txt - - - name: Install debugpy wheels (python 3.8) - run: | - python -m pip install wheel - python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt - python ./pythonFiles/install_debugpy.py - shell: bash - if: matrix.test-suite == 'debugger' && matrix.python == 3.8 - - - name: Install debugpy (python 2.7) - run: | - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - shell: bash - if: matrix.test-suite == 'debugger' && matrix.python == 2.7 - - - 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 .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 ('${{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: 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 `terminalActivation.testvirtualenvs.test.ts` - if ('${{matrix.os}}' -match 'windows-latest') { - $condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath python.exe - $condaExecPath = Join-Path -Path $Env:CONDA -ChildPath Scripts | Join-Path -ChildPath conda - } else{ - $condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath python - $condaExecPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath conda - } - & $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaExecPath $condaExecPath - & $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaPath - - # 2. For `interpreterLocatorService.testvirtualenvs.ts` - - & $condaExecPath create -n "test_env1" -y python - & $condaExecPath create -p "./test_env2" -y python - & $condaExecPath create -p "~/test_env3" -y python - - - 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.) - - # Run the Python tests in our codebase. - - name: Run Python unit tests - run: | - python pythonFiles/tests/run_all.py - if: matrix.test-suite == 'python-unit' - - # 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@v1.5 - 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@v1.5 - with: - run: npm run testSingleWorkspace - working-directory: ${{env.special-working-directory}} - if: matrix.test-suite == 'single-workspace' - - - name: Run multi-workspace tests - env: - CI_PYTHON_VERSION: ${{matrix.python}} - uses: GabrielBB/xvfb-action@v1.5 - with: - run: npm run testMultiWorkspace - working-directory: ${{env.special-working-directory}} - if: matrix.test-suite == 'multi-workspace' - - - name: Run debugger tests - env: - CI_PYTHON_VERSION: ${{matrix.python}} - uses: GabrielBB/xvfb-action@v1.5 - 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' - - 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 }} - if: github.repository == 'microsoft/vscode-python' - 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. - os: [ubuntu-latest, windows-latest] - # 3.8 is still required here so that jupyter can install. - python: [3.8] - steps: - # Need the source to have the tests available. - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Use Python ${{matrix.python}} - uses: actions/setup-python@v2 - with: - python-version: ${{matrix.python}} - - - name: Install dependencies (npm ci) - run: npm ci --prefer-offline - - - name: pip install system test requirements - run: | - python -m pip install --upgrade -r build/test-requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - shell: bash - - - name: pip install smoke test requirements - run: | - python -m pip install --upgrade -r build/smoke-test-requirements.txt - shell: bash - - # Save time by reusing bits from the VSIX. - - name: Download VSIX - uses: actions/download-artifact@v2 - with: - name: ${{env.ARTIFACT_NAME_VSIX}} - - # Compile the test files. - - name: Prepare for smoke tests - run: npx tsc -p ./ - shell: bash - - - 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 - - - name: Run smoke tests - env: - DISPLAY: 10 - INSTALL_JUPYTER_EXTENSION: true - uses: GabrielBB/xvfb-action@v1.5 - with: - run: node --no-force-async-hooks-checks ./out/test/smokeTest.js - - insider-tests: - name: Insider 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 }} - if: github.repository == 'microsoft/vscode-python' - 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] - python: [3.8] - steps: - # Need the source to have the tests available. - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Use Python ${{matrix.python}} - uses: actions/setup-python@v2 - with: - python-version: ${{matrix.python}} - - - name: Install dependencies (npm ci) - run: npm ci --prefer-offline - - - name: pip install system test requirements - run: | - python -m pip install --upgrade -r build/test-requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - shell: bash - - - name: pip install smoke test requirements - run: | - python -m pip install --upgrade -r build/smoke-test-requirements.txt - shell: bash - - # Compile the test files. - - name: Prepare for insiders tests - run: npm run prePublish - shell: bash - - - 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 - - - name: Run insider tests - env: - DISPLAY: 10 - INSTALL_JUPYTER_EXTENSION: true - INSTALL_PYLANCE_EXTENSION: true - VSC_PYTHON_CI_TEST_VSC_CHANNEL: insiders - TEST_FILES_SUFFIX: insiders.test - CODE_TESTS_WORKSPACE: ./src/testMultiRootWkspc/smokeTests - uses: GabrielBB/xvfb-action@v1.5 - with: - run: node --no-force-async-hooks-checks ./out/test/standardTest.js - - upload: - name: Upload VSIX to Azure Blob Storage - if: github.repository == 'microsoft/vscode-python' - runs-on: ubuntu-latest - needs: [tests, smoke-tests, build-vsix] - env: - BLOB_CONTAINER_NAME: extension-builds - BLOB_NAME: ms-python-insiders.vsix - steps: - - name: Download VSIX - uses: actions/download-artifact@v2 - with: - name: ${{ env.ARTIFACT_NAME_VSIX }} - - name: Azure Login - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - name: Upload to Blob Storage - run: az storage blob upload --file ${{ env.VSIX_NAME }} --account-name pvsc --container-name ${{ env.BLOB_CONTAINER_NAME }} --name ${{ env.BLOB_NAME }} --auth-mode login - - name: Get URL to uploaded VSIX - run: az storage blob url --account-name pvsc --container-name ${{ env.BLOB_CONTAINER_NAME }} --name ${{ env.BLOB_NAME }} --auth-mode login diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 17799ff234b2..000000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,433 +0,0 @@ -name: Release Build - -on: - push: - branches: - - 'release' - - 'release/*' - - 'release-*' - -env: - PYTHON_VERSION: 3.8 - NODE_VERSION: 12.15.0 - MOCHA_REPORTER_JUNIT: false # 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 hasn't already. - # Key for the cache created at the end of the the 'Cache ./pythonFiles/lib/python' step. - CACHE_PYTHONFILES: cache-pvsc-pythonFiles - ARTIFACT_NAME_VSIX: ms-python-release-vsix - VSIX_NAME: ms-python-release.vsix - TEST_RESULTS_DIRECTORY: . - -jobs: - build-vsix: - name: Build VSIX - runs-on: ubuntu-latest - if: github.repository == 'microsoft/vscode-python' - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Use Python ${{env.PYTHON_VERSION}} - uses: actions/setup-python@v2 - with: - python-version: ${{env.PYTHON_VERSION}} - - - name: Upgrade pip - run: python -m pip install -U pip - - - name: Build VSIX - uses: ./.github/actions/build-vsix - id: build-vsix - - - name: Rename VSIX - if: steps.build-vsix.outputs.path != env.VSIX_NAME - run: mv ${{ steps.build-vsix.outputs.path }} ${{ env.VSIX_NAME }} - - - uses: actions/upload-artifact@v2 - with: - name: ${{ env.ARTIFACT_NAME_VSIX }} - path: ${{ env.VSIX_NAME }} - retention-days: 14 - - lint: - # Unlike for the insiders build, we skip linting file formatting as that - # will be caught when we merge back into 'main'. - name: Lint - runs-on: ubuntu-latest - if: github.repository == 'microsoft/vscode-python' - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Install dependencies (npm ci) - run: npm ci --prefer-offline - - - name: Run gulp prePublishNonBundle - run: npx gulp prePublishNonBundle - - - name: Check dependencies - run: npm run checkDependencies - - - name: Run linting on TypeScript code - run: npm run lint - - - name: Run formatting on TypeScript code - run: npm run format-check - - ### Non-smoke tests - 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 }} - env: - # 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' - defaults: - run: - working-directory: ${{env.special-working-directory}} - if: github.repository == 'microsoft/vscode-python' - 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: [2.7, 3.8] - test-suite: [ts-unit, python-unit, venv, single-workspace, multi-workspace, debugger, functional] - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - path: ${{env.special-working-directory-relative}} - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Install dependencies (npm ci) - run: npm ci - - - name: Compile - run: npx gulp prePublishNonBundle - - - name: Use Python ${{matrix.python}} - uses: actions/setup-python@v2 - with: - python-version: ${{matrix.python}} - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Install Python requirements - run: | - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt - # We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase. - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - - - name: Install test requirements - run: python -m pip install --upgrade -r build/test-requirements.txt - - - name: Install debugpy wheels (python 3.8) - run: | - python -m pip install wheel - python -m pip --disable-pip-version-check install -r build/debugger-install-requirements.txt - python ./pythonFiles/install_debugpy.py - shell: bash - if: matrix.test-suite == 'debugger' && matrix.python == 3.8 - - - name: Install debugpy (python 2.7) - run: | - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - shell: bash - if: matrix.test-suite == 'debugger' && matrix.python == 2.7 - - - 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 .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 ('${{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: 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 `terminalActivation.testvirtualenvs.test.ts` - if ('${{matrix.os}}' -match 'windows-latest') { - $condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath python.exe - $condaExecPath = Join-Path -Path $Env:CONDA -ChildPath Scripts | Join-Path -ChildPath conda - } else{ - $condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath python - $condaExecPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath conda - } - & $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaExecPath $condaExecPath - & $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaPath - - # 2. For `interpreterLocatorService.testvirtualenvs.ts` - - & $condaExecPath create -n "test_env1" -y python - & $condaExecPath create -p "./test_env2" -y python - & $condaExecPath create -p "~/test_env3" -y python - - - 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.) - - # Run the Python tests in our codebase. - - name: Run Python unit tests - run: | - python pythonFiles/tests/run_all.py - if: matrix.test-suite == 'python-unit' - - # 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@v1.5 - 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@v1.5 - with: - run: npm run testSingleWorkspace - working-directory: ${{env.special-working-directory}} - if: matrix.test-suite == 'single-workspace' - - - name: Run multi-workspace tests - env: - CI_PYTHON_VERSION: ${{matrix.python}} - uses: GabrielBB/xvfb-action@v1.5 - with: - run: npm run testMultiWorkspace - working-directory: ${{env.special-working-directory}} - if: matrix.test-suite == 'multi-workspace' - - - name: Run debugger tests - env: - CI_PYTHON_VERSION: ${{matrix.python}} - uses: GabrielBB/xvfb-action@v1.5 - 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' - - 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 }} - if: github.repository == 'microsoft/vscode-python' - 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. - os: [ubuntu-latest, windows-latest] - python: [3.8] - steps: - # Need the source to have the tests available. - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Use Python ${{matrix.python}} - uses: actions/setup-python@v2 - with: - python-version: ${{matrix.python}} - - - name: Install dependencies (npm ci) - run: npm ci --prefer-offline - - - name: pip install system test requirements - run: | - python -m pip install --upgrade -r build/test-requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - shell: bash - - - name: pip install smoke test requirements - run: | - python -m pip install --upgrade -r build/smoke-test-requirements.txt - shell: bash - - # Save time by reusing bits from the VSIX. - - name: Download VSIX - uses: actions/download-artifact@v2 - with: - name: ${{env.ARTIFACT_NAME_VSIX}} - - # Compile the test files. - - name: Prepare for smoke tests - run: npx tsc -p ./ - shell: bash - - - 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 - - - name: Run smoke tests - env: - DISPLAY: 10 - INSTALL_JUPYTER_EXTENSION: true - uses: GabrielBB/xvfb-action@v1.5 - with: - run: node --no-force-async-hooks-checks ./out/test/smokeTest.js - - insider-tests: - name: Insider 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 }} - if: github.repository == 'microsoft/vscode-python' - 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] - python: [3.8] - steps: - # Need the source to have the tests available. - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{env.NODE_VERSION}} - - - name: Use Python ${{matrix.python}} - uses: actions/setup-python@v2 - with: - python-version: ${{matrix.python}} - - - name: Install dependencies (npm ci) - run: npm ci --prefer-offline - - - name: pip install system test requirements - run: | - python -m pip install --upgrade -r build/test-requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt - python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy - shell: bash - - - name: pip install smoke test requirements - run: | - python -m pip install --upgrade -r build/smoke-test-requirements.txt - shell: bash - - # Compile the test files. - - name: Prepare for insiders tests - run: npm run prePublish - shell: bash - - - 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 - - - name: Run insider tests - env: - DISPLAY: 10 - INSTALL_JUPYTER_EXTENSION: true - INSTALL_PYLANCE_EXTENSION: true - VSC_PYTHON_CI_TEST_VSC_CHANNEL: insiders - TEST_FILES_SUFFIX: insiders.test - CODE_TESTS_WORKSPACE: ./src/testMultiRootWkspc/smokeTests - uses: GabrielBB/xvfb-action@v1.5 - with: - run: node --no-force-async-hooks-checks ./out/test/standardTest.js