Skip to content

Commit

Permalink
Adds CI for Positron extension (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein authored Oct 26, 2023
1 parent 4180b83 commit af2479f
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/bats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ jobs:
- run: chmod -R +x ./bin
- run: just bats
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runner: [ubuntu-latest]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
jobs:
agent:
uses: ./.github/workflows/agent.yaml
extensions:
uses: ./.github/workflows/extensions.yaml
web:
uses: ./.github/workflows/web.yaml
build:
Expand All @@ -18,3 +16,9 @@ jobs:
cypress:
needs: build
uses: ./.github/workflows/cypress.yaml

# Extensions
jupyterlab:
uses: ./.github/workflows/jupyterlab.yaml
positron:
uses: ./.github/workflows/positron.yaml
29 changes: 29 additions & 0 deletions .github/workflows/positron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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 ci
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: just positron ci
8 changes: 6 additions & 2 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ concurrency:
jobs:
agent:
uses: ./.github/workflows/agent.yaml
extensions:
uses: ./.github/workflows/extensions.yaml
web:
uses: ./.github/workflows/web.yaml
build:
Expand All @@ -19,3 +17,9 @@ jobs:
cypress:
needs: build
uses: ./.github/workflows/cypress.yaml

# Extensions
jupyterlab:
uses: ./.github/workflows/jupyterlab.yaml
positron:
uses: ./.github/workflows/positron.yaml
3 changes: 1 addition & 2 deletions extensions/positron/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
out
dist
node_modules
.vscode-test-web/
.vscode-test/
*.vsix
5
77 changes: 77 additions & 0 deletions extensions/positron/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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 {
""
}

# Executes continuous integration workflow (i.e., this is what GitHub Actions uses)
ci:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}
just install
just lint
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

default:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}
just install
just test


# Install dependencies
install:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}
npm install

# Performs static code analysis with ESLint
lint:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}
npm run lint

# 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 npm test
test:
#!/usr/bin/env bash
set -eou pipefail
{{ _with_debug }}
if [ {{ os() }} == "linux" ]; then
xvfb-run -a npm test
else
npm test
fi
2 changes: 1 addition & 1 deletion extensions/positron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"pretest": "npm run compile",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
Expand Down
1 change: 1 addition & 0 deletions extensions/positron/src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';
Expand Down
7 changes: 7 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af2479f

Please sign in to comment.