From 13ba89562694e00b3dcf6c574b80a1921776b9e9 Mon Sep 17 00:00:00 2001 From: tdstein Date: Tue, 24 Oct 2023 15:52:20 -0400 Subject: [PATCH] Adds CI for Positron extension --- .../{extensions.yaml => jupyterlab.yaml} | 10 +++- .github/workflows/main.yaml | 8 +-- .github/workflows/positron.yaml | 33 ++++++++++ .github/workflows/pull-request.yaml | 6 +- extensions/positron/.gitignore | 3 +- extensions/positron/justfile | 60 +++++++++++++++++++ justfile | 7 +++ 7 files changed, 116 insertions(+), 11 deletions(-) rename .github/workflows/{extensions.yaml => jupyterlab.yaml} (69%) create mode 100644 .github/workflows/positron.yaml create mode 100644 extensions/positron/justfile diff --git a/.github/workflows/extensions.yaml b/.github/workflows/jupyterlab.yaml similarity index 69% rename from .github/workflows/extensions.yaml rename to .github/workflows/jupyterlab.yaml index 203ddee17a..66f25afb04 100644 --- a/.github/workflows/extensions.yaml +++ b/.github/workflows/jupyterlab.yaml @@ -1,11 +1,15 @@ -name: Extensions +name: JupyterLab on: workflow_call: jobs: - jupyterlab: + native: env: DOCKER: false - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + runner: [macos-latest, windows-latest, ubuntu-latest] + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v3 - uses: extractions/setup-just@v1 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 32d909ca50..f46fff0f0e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,12 +6,12 @@ on: jobs: agent: uses: ./.github/workflows/agent.yaml - extensions: - uses: ./.github/workflows/extensions.yaml - web: - uses: ./.github/workflows/web.yaml build: uses: ./.github/workflows/build.yaml + jupyterlab: + uses: ./.github/workflows/jupyterlab.yaml + web: + uses: ./.github/workflows/web.yaml bats: needs: build uses: ./.github/workflows/bats.yaml diff --git a/.github/workflows/positron.yaml b/.github/workflows/positron.yaml new file mode 100644 index 0000000000..ef80fee32b --- /dev/null +++ b/.github/workflows/positron.yaml @@ -0,0 +1,33 @@ +name: Positron +on: + workflow_call: +jobs: + native: + env: + DOCKER: false + strategy: + fail-fast: false + matrix: + runner: [macos-latest, windows-latest, ubuntu-latest] + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: extractions/setup-just@v1 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: just positron + docker: + strategy: + fail-fast: false + matrix: + runner: [ubuntu-latest] + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: ./.github/actions/setup + - run: just positron diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 0e65865de6..1c8374ee1f 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -7,8 +7,10 @@ concurrency: jobs: agent: uses: ./.github/workflows/agent.yaml - extensions: - uses: ./.github/workflows/extensions.yaml + jupyterlab: + uses: ./.github/workflows/jupyterlab.yaml + positron: + uses: ./.github/workflows/positron.yaml web: uses: ./.github/workflows/web.yaml build: diff --git a/extensions/positron/.gitignore b/extensions/positron/.gitignore index 092ea7c827..0b60dfa12f 100644 --- a/extensions/positron/.gitignore +++ b/extensions/positron/.gitignore @@ -1,6 +1,5 @@ out dist node_modules -.vscode-test-web/ +.vscode-test/ *.vsix -5 diff --git a/extensions/positron/justfile b/extensions/positron/justfile new file mode 100644 index 0000000000..86c22c5622 --- /dev/null +++ b/extensions/positron/justfile @@ -0,0 +1,60 @@ +alias c := clean +alias i := install +alias t := test + +_ci := env_var_or_default("CI", "false") + +_debug := env_var_or_default("DEBUG", "false") + +_with_debug := if _debug == "true" { + "set -x pipefail" + } else { + "" + } + +default: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + just install + just test + +# Deletes ephemeral project files (i.e., cleans the project). +clean: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + rm -rf node_modules + + +# Install dependencies +install: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + npm install + +# Executes commands via `npm`. Equivalent to `npm run`. Provides arbitrary command chaining inside of Docker from project root (i.e., `just positron run test`) +run *args: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + npm run {{ args }} + + +# Executes Cypress tests +test: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + echo {{ os() }} + if [ {{ os() }} == "linux" ]; then + xvfb-run -a npm test + else + npm test + fi diff --git a/justfile b/justfile index 4781d5fb69..84f587f7ec 100644 --- a/justfile +++ b/justfile @@ -180,6 +180,13 @@ pre-release: ./scripts/is-pre-release.bash +positron *args: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + just _with_docker just extensions/positron/{{ args }} + # Runs the CLI via `go run`. run *args: #!/usr/bin/env bash