-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt positron-python CI configuration to run within main Positron
expository from extensions/positron-python subdirectory.
- Loading branch information
Showing
11 changed files
with
101 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,13 @@ on: | |
|
||
defaults: | ||
run: | ||
working-directory: './extensions/positron-python' | ||
working-directory: 'extensions/positron-python' | ||
|
||
env: | ||
NODE_VERSION: '18.17.1' | ||
PYTHON_VERSION: '3.10' | ||
PROJECT_DIR: 'extensions/positron-python' | ||
PYTHON_SRC_DIR: 'extensions/positron-python/pythonFiles' | ||
# 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' | ||
|
@@ -67,13 +69,13 @@ jobs: | |
run: | | ||
python -m pip install -U black | ||
python -m black . --check | ||
working-directory: pythonFiles | ||
working-directory: ${{ env.PYTHON_SRC_DIR }} | ||
|
||
- name: Run Ruff | ||
run: | | ||
python -m pip install -U ruff | ||
python -m ruff check . | ||
working-directory: pythonFiles | ||
working-directory: ${{ env.PYTHON_SRC_DIR }} | ||
|
||
check-types: | ||
name: Check Python types | ||
|
@@ -89,9 +91,7 @@ jobs: | |
cache: 'pip' | ||
|
||
- name: Install base Python requirements | ||
uses: brettcannon/pip-secure-install@v1 | ||
with: | ||
options: '-t ./pythonFiles/lib/python --no-cache-dir --implementation py' | ||
run: 'python -m pip install --no-deps --require-hashes --only-binary :all: -t ./pythonFiles/lib/python --no-cache-dir --implementation py -r requirements.txt' | ||
|
||
- name: Install Positron IPyKernel requirements | ||
run: python scripts/vendor.py | ||
|
@@ -106,15 +106,15 @@ jobs: | |
uses: jakebailey/pyright-action@v2 | ||
with: | ||
version: 1.1.308 | ||
working-directory: 'pythonFiles' | ||
working-directory: ${{ env.PYTHON_SRC_DIR }} | ||
|
||
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 }} | ||
working-directory: ${{ env.special-working-directory }}/${{ env.PROJECT_DIR}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -167,10 +167,7 @@ jobs: | |
run: python -m pytest --version | ||
|
||
- name: Install base Python requirements | ||
uses: brettcannon/pip-secure-install@v1 | ||
with: | ||
requirements-file: '"${{ env.special-working-directory-relative }}/requirements.txt"' | ||
options: '-t "${{ env.special-working-directory-relative }}/pythonFiles/lib/python" --no-cache-dir --implementation py' | ||
run: 'python -m pip install --no-deps --require-hashes --only-binary :all: -t ./pythonFiles/lib/python --no-cache-dir --implementation py -r requirements.txt' | ||
|
||
- name: Install test requirements | ||
run: python -m pip install -r build/test-requirements.txt | ||
|
@@ -248,7 +245,7 @@ jobs: | |
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ${{ env.special-working-directory }} | ||
working-directory: ${{ env.special-working-directory }}/${{ env.PROJECT_DIR}} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
@@ -285,7 +282,7 @@ jobs: | |
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: 'yarn' | ||
cache-dependency-path: ${{ env.special-working-directory-relative }}/yarn.lock | ||
cache-dependency-path: ${{ env.special-working-directory-relative }}/${{ env.PROJECT_DIR }}/yarn.lock | ||
|
||
- name: Install Yarn | ||
run: npm install -g yarn | ||
|
@@ -406,31 +403,31 @@ jobs: | |
env: | ||
TEST_FILES_SUFFIX: testvirtualenvs | ||
CI_PYTHON_VERSION: ${{ matrix.python }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_RO_PAT }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_PAT }} | ||
uses: GabrielBB/[email protected] | ||
with: | ||
run: yarn testSingleWorkspace | ||
working-directory: ${{ env.special-working-directory }} | ||
working-directory: ${{ env.special-working-directory }}/${{ env.PROJECT_DIR }} | ||
if: matrix.test-suite == 'venv' | ||
|
||
- name: Run single-workspace tests | ||
env: | ||
CI_PYTHON_VERSION: ${{ matrix.python }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_RO_PAT }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_PAT }} | ||
uses: GabrielBB/[email protected] | ||
with: | ||
run: yarn testSingleWorkspace | ||
working-directory: ${{ env.special-working-directory }} | ||
working-directory: ${{ env.special-working-directory }}/${{ env.PROJECT_DIR }} | ||
if: matrix.test-suite == 'single-workspace' | ||
|
||
- name: Run debugger tests | ||
env: | ||
CI_PYTHON_VERSION: ${{ matrix.python }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_RO_PAT }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_PAT }} | ||
uses: GabrielBB/[email protected] | ||
with: | ||
run: yarn testDebugger | ||
working-directory: ${{ env.special-working-directory }} | ||
working-directory: ${{ env.special-working-directory }}/${{ env.PROJECT_DIR }} | ||
if: matrix.test-suite == 'debugger' | ||
|
||
- name: Run TypeScript functional tests | ||
|
@@ -439,6 +436,6 @@ jobs: | |
|
||
- name: Run smoke tests | ||
env: | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_RO_PAT }} | ||
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_PAT }} | ||
run: yarn tsc && node ./out/test/smokeTest.js | ||
if: matrix.test-suite == 'smoke' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (C) 2024 Posit Software, PBC. All rights reserved. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as fs from 'fs-extra'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
|
||
/** | ||
* Get the path to the user data directory for tests. | ||
* | ||
* Uses the environment variable POSITRON_USER_DATA_DIR if set, otherwise creates a new temporary | ||
* directory and sets the environment variable. | ||
* | ||
* @returns The path to the user data directory. | ||
*/ | ||
export async function getUserDataDir(): Promise<string> { | ||
if (!process.env.POSITRON_USER_DATA_DIR) { | ||
process.env.POSITRON_USER_DATA_DIR = await fs.mkdtemp(path.join(os.tmpdir(), 'positron-')); | ||
} | ||
return process.env.POSITRON_USER_DATA_DIR; | ||
} |
Oops, something went wrong.