Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/default-repos
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcphers committed Dec 2, 2024
2 parents c547abd + 1492e58 commit a51d4ae
Show file tree
Hide file tree
Showing 38 changed files with 2,213 additions and 221 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/e2e-test-release-run-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ jobs:
env:
POSITRON_PY_VER_SEL: 3.10.12
POSITRON_R_VER_SEL: 4.4.0
id: electron-smoke-tests
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }}
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: "electron,release,${{ inputs.e2e_grep }}"
id: electron-e2e-tests
run: |
export DISPLAY=:10
BUILD=/usr/share/positron npx playwright test --project e2e-electron --workers 2 --grep="${{ env.E2E_GREP }}"
BUILD=/usr/share/positron npx playwright test --project e2e-electron --workers 3 --grep=${{ env.E2E_GREP }}
- name: Upload Playwright Report to S3
if: ${{ !cancelled() }}
Expand Down
46 changes: 36 additions & 10 deletions .github/workflows/positron-full-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ jobs:
e2e-electron-tests:
runs-on: ubuntu-latest-8x
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2]
shardTotal: [2]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POSITRON_BUILD_NUMBER: 0 # CI skips building releases
Expand Down Expand Up @@ -131,26 +126,39 @@ jobs:
env:
POSITRON_PY_VER_SEL: 3.10.12
POSITRON_R_VER_SEL: 4.4.0
CURRENTS_PROJECT_ID: ZOs5z2
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }} # only works on push events
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: "electron"
id: electron-tests
run: DISPLAY=:10 npx playwright test --project e2e-electron --workers 1 --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: DISPLAY=:10 npx playwright test --project e2e-electron --workers 2

- name: Upload blob report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-electron-${{ matrix.shardIndex }}
name: blob-report-electron
path: blob-report
retention-days: 14

- name: Upload junit report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: junit-report-electron-${{ matrix.shardIndex }}
name: junit-report-electron
path: test-results/junit.xml

- name: Upload logs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: logs-electron
path: test-logs

e2e-browser-tests:
runs-on: ubuntu-latest-4x
runs-on: ubuntu-latest-8x
timeout-minutes: 50
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -184,12 +192,23 @@ jobs:
aws-region: ${{ secrets.QA_AWS_REGION }}
github-token: ${{ secrets.GITHUB_TOKEN }}

# Preloading ensures the Node.js binary is fully built and ready before
# any parallel processes start, preventing runtime conflicts
- name: Preload Node.js Binary
run: yarn gulp node

- name: Run Tests (Browser)
env:
POSITRON_PY_VER_SEL: 3.10.12
POSITRON_R_VER_SEL: 4.4.0
CURRENTS_PROJECT_ID: ZOs5z2
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }}
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: "chromium"
id: browser-tests
run: DISPLAY=:10 npx playwright test --project e2e-browser --workers 1
run: DISPLAY=:10 npx playwright test --project e2e-browser --workers 2

- name: Upload blob report
if: ${{ !cancelled() }}
Expand All @@ -199,6 +218,13 @@ jobs:
path: blob-report
retention-days: 14

- name: Upload logs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: logs-browser
path: test-logs

- name: Clean up license files
if: always()
run: cd .. && rm -rf positron-license
Expand Down
73 changes: 65 additions & 8 deletions .github/workflows/positron-merge-to-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,21 @@ jobs:
env:
POSITRON_PY_VER_SEL: 3.10.12
POSITRON_R_VER_SEL: 4.4.0
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }}
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: "electron,${{ inputs.e2e_grep }}"
id: e2e-playwright-tests
run: DISPLAY=:10 npx playwright test --project e2e-electron --workers 2 --grep="${{ env.E2E_GREP }}"
run: DISPLAY=:10 npx playwright test --project e2e-electron --workers 2 --grep=${{ env.E2E_GREP }}

- name: Upload Playwright Report to S3
if: ${{ success() || failure() }}
uses: ./.github/actions/upload-report-to-s3
with:
role-to-assume: ${{ secrets.AWS_TEST_REPORTS_ROLE }}

unit-integration:
unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
Expand Down Expand Up @@ -113,21 +118,73 @@ jobs:
with:
version: "4.4.0"

- name: Compile Integration Tests
run: yarn --cwd test/integration/browser compile
- name: Run Unit Tests (Electron)
id: electron-unit-tests
run: DISPLAY=:10 ./scripts/test.sh

- name: Run Unit Tests (node.js)
id: nodejs-unit-tests
run: yarn test-node

- name: Run Integration Tests (Electron)
id: electron-integration-tests
run: DISPLAY=:10 ./scripts/test-integration-pr.sh
- name: Run Unit Tests (Browser, Chromium)
id: browser-unit-tests
run: DISPLAY=:10 yarn test-browser-no-install --browser chromium

integration-tests:
runs-on: ubuntu-latest-4x
timeout-minutes: 20
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POSITRON_BUILD_NUMBER: 0 # CI skips building releases
_R_CHECK_FUTURE_FILE_TIMESTAMPS_: false # this check can be flaky in the R pkg tests
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_SYSTEM_CLOCK_: false
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Cache node_modules, build, extensions, and remote
uses: ./.github/actions/cache-multi-paths

- name: Setup Build and Compile
uses: ./.github/actions/setup-build-env

- name: Install Positron License
uses: ./.github/actions/install-license
with:
github-token: ${{ secrets.POSITRON_GITHUB_PAT }}
license-key: ${{ secrets.POSITRON_DEV_LICENSE }}

# one integration test needs this: Connections pane works for R
- name: Setup R
uses: ./.github/actions/install-r
with:
version: "4.4.0"

- name: Compile Integration Tests
run: yarn --cwd test/integration/browser compile

- name: Run Integration Tests (Electron)
id: electron-integration-tests
run: DISPLAY=:10 ./scripts/test-integration-pr.sh

- name: Run Integration Tests (Remote)
if: ${{ job.status != 'cancelled' && (success() || failure()) }}
id: electron-remote-integration-tests
run: DISPLAY=:10 ./scripts/test-remote-integration.sh

- name: Run Integration Tests (Browser, Chromium)
if: ${{ job.status != 'cancelled' && (success() || failure()) }}
id: browser-integration-tests
run: DISPLAY=:10 ./scripts/test-web-integration.sh --browser chromium

slack-notification:
name: "Send Slack notification"
runs-on: ubuntu-latest
needs: [unit-integration, e2e-electron]
needs: [unit-tests, integration-tests, e2e-electron]
if: ${{ failure() && inputs.e2e_grep == '' }}
steps:
- name: "Send Slack notification"
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/positron-windows-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,29 @@ jobs:
env:
POSITRON_PY_VER_SEL: 3.10.10
POSITRON_R_VER_SEL: 4.4.0
CURRENTS_PROJECT_ID: ZOs5z2
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }} # only works on push events
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: "electron,@win"
if: ${{ !cancelled() }}
id: e2e-win-electron-tests
run: npx playwright test --project e2e-electron --grep "@win" --workers 1
run: npx playwright test --project e2e-electron --grep "@win" --workers 2

- name: Upload blob report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-electron-${{ matrix.shardIndex }}
name: blob-report-electron
path: blob-report
retention-days: 14

- name: Upload junit report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: junit-report-electron-${{ matrix.shardIndex }}
name: junit-report-electron
path: test-results/junit.xml

e2e-report:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,19 @@ function executeCode(
}
}
}).catch(error => {
// Stop listening for replies.
handler.dispose();

// Reject the outer execution promise since we've encountered an error.
reject(error);

// Rethrow the error to stop any replies that are chained to this promise.
throw error;
});

// Avoid unhandled rejections being logged to the console.
// The actual error-handling is in the catch block above.
currentMessagePromise.catch(() => { });
});

// Execute the cell.
Expand Down
6 changes: 6 additions & 0 deletions extensions/positron-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,12 @@
"description": "%python.venvPath.description%",
"scope": "machine",
"type": "string"
},
"python.installModulesInTerminal": {
"default": false,
"markdownDescription": "%python.installModulesInTerminal.description%",
"scope": "resource",
"type": "boolean"
}
},
"title": "Python",
Expand Down
1 change: 1 addition & 0 deletions extensions/positron-python/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"python.testing.unittestEnabled.description": "Enable testing using unittest.",
"python.venvFolders.description": "Folders in your home directory to look into for virtual environments (supports pyenv, direnv and virtualenvwrapper by default).",
"python.venvPath.description": "Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).",
"python.installModulesInTerminal.description": "Whether to install Python modules (such as `ipykernel`) in the Terminal, instead of in a background process. Installing modules in the Terminal allows you to see the output of the installation command.",
"walkthrough.pythonWelcome.title": "Get Started with Python Development",
"walkthrough.pythonWelcome.description": "Your first steps to set up a Python project with all the powerful tools and features that the Python extension has to offer!",
"walkthrough.step.python.createPythonFile.title": "Create a Python file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
)

import comm
from IPython.core.error import UsageError

from .access_keys import decode_access_key
from .data_explorer_comm import (
Expand Down Expand Up @@ -96,7 +97,14 @@
TextSearchType,
)
from .positron_comm import CommMessage, PositronComm
from .third_party import np_, pd_, pl_
from .third_party import (
RestartRequiredError,
import_pandas,
import_polars,
np_,
pd_,
pl_,
)
from .utils import BackgroundJobQueue, guid

if TYPE_CHECKING:
Expand Down Expand Up @@ -312,6 +320,7 @@ def _match_text_search(params: FilterTextSearch):

def matches(x):
return term in x.lower()

else:

def matches(x):
Expand Down Expand Up @@ -2581,11 +2590,31 @@ class PyArrowView(DataExplorerTableView):


def _is_pandas(table):
return pd_ is not None and isinstance(table, (pd_.DataFrame, pd_.Series))
pandas = import_pandas()
if pandas is not None and isinstance(table, (pandas.DataFrame, pandas.Series)):
# If pandas was installed after the kernel was started, pd_ will still be None.
# Raise an error to inform the user to restart the kernel.
if pd_ is None:
raise RestartRequiredError(
"Pandas was installed after the session started. Please restart the session to "
+ "view the table in the Data Explorer."
)
return True
return False


def _is_polars(table):
return pl_ is not None and isinstance(table, (pl_.DataFrame, pl_.Series))
polars = import_polars()
if polars is not None and isinstance(table, (polars.DataFrame, polars.Series)):
# If polars was installed after the kernel was started, pl_ will still be None.
# Raise an error to inform the user to restart the kernel.
if pl_ is None:
raise RestartRequiredError(
"Polars was installed after the session started. Please restart the session to "
+ "view the table."
)
return True
return False


def _get_table_view(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from .patch.holoviews import set_holoviews_extension
from .plots import PlotsService
from .session_mode import SessionMode
from .third_party import RestartRequiredError
from .ui import UiService
from .utils import BackgroundJobQueue, JsonRecord, get_qualname
from .variables import VariablesService
Expand Down Expand Up @@ -168,6 +169,8 @@ def view(self, line: str) -> None:
)
except TypeError:
raise UsageError(f"cannot view object of type '{get_qualname(obj)}'")
except RestartRequiredError as error:
raise UsageError(*error.args)

@magic_arguments.magic_arguments()
@magic_arguments.argument(
Expand Down
Loading

0 comments on commit a51d4ae

Please sign in to comment.