Skip to content

Commit 47d6d9c

Browse files
committed
Initial commit
0 parents  commit 47d6d9c

21 files changed

+998
-0
lines changed

.github/workflows/build.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: '*'
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Base Setup
22+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
23+
24+
- name: Install dependencies
25+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
26+
27+
- name: Build the extension
28+
run: |
29+
set -eux
30+
python -m pip install .[test]
31+
32+
pytest -vv -r ap --cov jupyter_ai_litellm
33+
jupyter server extension list
34+
jupyter server extension list 2>&1 | grep -ie "jupyter_ai_litellm.*OK"
35+
36+
- name: Package the extension
37+
run: |
38+
set -eux
39+
40+
pip install build
41+
python -m build
42+
pip uninstall -y "jupyter_ai_litellm" jupyterlab
43+
44+
- name: Upload extension packages
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: extension-artifacts
48+
path: dist/jupyter_ai_litellm*
49+
if-no-files-found: error
50+
51+
test_isolated:
52+
needs: build
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Install Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.9'
60+
architecture: 'x64'
61+
- uses: actions/download-artifact@v4
62+
with:
63+
name: extension-artifacts
64+
- name: Install and Test
65+
run: |
66+
set -eux
67+
68+
pip install "jupyterlab>=4.0.0,<5" jupyter_ai_litellm*.whl
69+
70+
jupyter server extension list
71+
jupyter server extension list 2>&1 | grep -ie "jupyter_ai_litellm.*OK"
72+
73+
check_links:
74+
name: Check Links
75+
runs-on: ubuntu-latest
76+
timeout-minutes: 15
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
80+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["main"]
5+
pull_request:
6+
branches: ["*"]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check_release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Base Setup
19+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
20+
- name: Check Release
21+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
22+
with:
23+
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Upload Distributions
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: jupyter_ai_litellm-releaser-dist-${{ github.run_number }}
30+
path: .jupyter_releaser_checkout/dist
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Enforce PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, edited, synchronize]
6+
jobs:
7+
enforce-label:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- name: enforce-triage-label
13+
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1

.github/workflows/prep-release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Step 1: Prep Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version_spec:
6+
description: "New Version Specifier"
7+
default: "next"
8+
required: false
9+
branch:
10+
description: "The branch to target"
11+
required: false
12+
post_version_spec:
13+
description: "Post Version Specifier"
14+
required: false
15+
# silent:
16+
# description: "Set a placeholder in the changelog and don't publish the release."
17+
# required: false
18+
# type: boolean
19+
since:
20+
description: "Use PRs with activity since this date or git reference"
21+
required: false
22+
since_last_stable:
23+
description: "Use PRs with activity since the last stable git tag"
24+
required: false
25+
type: boolean
26+
jobs:
27+
prep_release:
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
steps:
32+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
33+
34+
- name: Prep Release
35+
id: prep-release
36+
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
version_spec: ${{ github.event.inputs.version_spec }}
40+
# silent: ${{ github.event.inputs.silent }}
41+
post_version_spec: ${{ github.event.inputs.post_version_spec }}
42+
branch: ${{ github.event.inputs.branch }}
43+
since: ${{ github.event.inputs.since }}
44+
since_last_stable: ${{ github.event.inputs.since_last_stable }}
45+
46+
- name: "** Next Step **"
47+
run: |
48+
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Step 2: Publish Release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: "The target branch"
7+
required: false
8+
release_url:
9+
description: "The URL of the draft GitHub release"
10+
required: false
11+
steps_to_skip:
12+
description: "Comma separated list of steps to skip"
13+
required: false
14+
15+
jobs:
16+
publish_release:
17+
runs-on: ubuntu-latest
18+
environment: release
19+
permissions:
20+
id-token: write
21+
steps:
22+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
23+
24+
- uses: actions/create-github-app-token@v1
25+
id: app-token
26+
with:
27+
app-id: ${{ vars.APP_ID }}
28+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
29+
30+
- name: Populate Release
31+
id: populate-release
32+
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
33+
with:
34+
token: ${{ steps.app-token.outputs.token }}
35+
branch: ${{ github.event.inputs.branch }}
36+
release_url: ${{ github.event.inputs.release_url }}
37+
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
38+
39+
- name: Finalize Release
40+
id: finalize-release
41+
env:
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
44+
with:
45+
token: ${{ steps.app-token.outputs.token }}
46+
release_url: ${{ steps.populate-release.outputs.release_url }}
47+
48+
- name: "** Next Step **"
49+
if: ${{ success() }}
50+
run: |
51+
echo "Verify the final release"
52+
echo ${{ steps.finalize-release.outputs.release_url }}
53+
54+
- name: "** Failure Message **"
55+
if: ${{ failure() }}
56+
run: |
57+
echo "Failed to Publish the Draft Release Url:"
58+
echo ${{ steps.populate-release.outputs.release_url }}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Update Playwright Snapshots
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
update-snapshots:
13+
if: >
14+
(
15+
github.event.issue.author_association == 'OWNER' ||
16+
github.event.issue.author_association == 'COLLABORATOR' ||
17+
github.event.issue.author_association == 'MEMBER' ||
18+
github.event.comment.author_association == 'OWNER' ||
19+
github.event.comment.author_association == 'COLLABORATOR' ||
20+
github.event.comment.author_association == 'MEMBER'
21+
) && github.event.issue.pull_request && contains(github.event.comment.body, 'please update snapshots')
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: React to the triggering comment
26+
run: |
27+
gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1'
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Get PR Info
37+
id: pr
38+
env:
39+
PR_NUMBER: ${{ github.event.issue.number }}
40+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GH_REPO: ${{ github.repository }}
42+
COMMENT_AT: ${{ github.event.comment.created_at }}
43+
run: |
44+
pr="$(gh api /repos/${GH_REPO}/pulls/${PR_NUMBER})"
45+
head_sha="$(echo "$pr" | jq -r .head.sha)"
46+
pushed_at="$(echo "$pr" | jq -r .pushed_at)"
47+
48+
if [[ $(date -d "$pushed_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) ]]; then
49+
echo "Updating is not allowed because the PR was pushed to (at $pushed_at) after the triggering comment was issued (at $COMMENT_AT)"
50+
exit 1
51+
fi
52+
53+
echo "head_sha=$head_sha" >> $GITHUB_OUTPUT
54+
55+
- name: Checkout the branch from the PR that triggered the job
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: gh pr checkout ${{ github.event.issue.number }}
59+
60+
- name: Validate the fetched branch HEAD revision
61+
env:
62+
EXPECTED_SHA: ${{ steps.pr.outputs.head_sha }}
63+
run: |
64+
actual_sha="$(git rev-parse HEAD)"
65+
66+
if [[ "$actual_sha" != "$EXPECTED_SHA" ]]; then
67+
echo "The HEAD of the checked out branch ($actual_sha) differs from the HEAD commit available at the time when trigger comment was submitted ($EXPECTED_SHA)"
68+
exit 1
69+
fi
70+
71+
- name: Base Setup
72+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
73+
74+
- name: Install dependencies
75+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
76+
77+
- name: Install extension
78+
run: |
79+
set -eux
80+
jlpm
81+
python -m pip install .
82+
83+
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
84+
with:
85+
github_token: ${{ secrets.GITHUB_TOKEN }}
86+
# Playwright knows how to start JupyterLab server
87+
start_server_script: 'null'
88+
test_folder: ui-tests
89+
npm_client: jlpm

0 commit comments

Comments
 (0)