Skip to content

Commit b6b3dc7

Browse files
authored
Merge pull request #238 from Context-Engine-AI/feature/restore-github-workflows
feat: restore GitHub Actions workflows
2 parents a3e5b4e + d496c16 commit b6b3dc7

File tree

4 files changed

+279
-0
lines changed

4 files changed

+279
-0
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ test ]
6+
pull_request:
7+
branches: [ test ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
qdrant:
15+
image: qdrant/qdrant:latest
16+
ports:
17+
- 6333:6333
18+
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v4
25+
with:
26+
version: "0.5.27"
27+
28+
- name: Set up Python
29+
run: uv python install 3.11
30+
31+
- name: Cache uv dependencies
32+
uses: actions/cache@v3
33+
with:
34+
path: ~/.cache/uv
35+
key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-uv-
38+
39+
- name: Cache embedding models
40+
uses: actions/cache@v3
41+
with:
42+
path: ~/.cache/huggingface
43+
key: ${{ runner.os }}-embeddings-bge-base-en-v1.5
44+
restore-keys: |
45+
${{ runner.os }}-embeddings-
46+
47+
- name: Install dependencies
48+
run: uv sync --locked --extra test
49+
50+
- name: Wait for Qdrant to be ready
51+
run: |
52+
timeout 60 bash -c 'until curl -fsS http://localhost:6333/readyz; do sleep 2; done'
53+
54+
- name: Set environment variables
55+
run: |
56+
echo "QDRANT_URL=http://localhost:6333" >> $GITHUB_ENV
57+
echo "PYTHONPATH=${{ github.workspace }}/scripts:$PYTHONPATH" >> $GITHUB_ENV
58+
echo "CI=true" >> $GITHUB_ENV
59+
echo "USE_TREE_SITTER=1" >> $GITHUB_ENV
60+
61+
- name: Pre-download embedding model
62+
run: |
63+
uv run python -c "from fastembed import TextEmbedding; m = TextEmbedding(model_name='BAAI/bge-base-en-v1.5'); list(m.embed(['test']))"
64+
65+
- name: Run tests
66+
run: uv run python -m pytest -q --junitxml=test-results.xml
67+
68+
- name: Upload test results
69+
uses: actions/upload-artifact@v4
70+
if: always()
71+
with:
72+
name: test-results
73+
path: test-results.xml
74+
retention-days: 7
75+
76+
- name: Test Summary
77+
uses: test-summary/action@v2
78+
if: always()
79+
with:
80+
paths: test-results.xml

.github/workflows/deploy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy Context Engine Landing Page
2+
3+
on:
4+
push:
5+
branches:
6+
- test # Trigger on test branch (their default)
7+
workflow_dispatch: # Allow manual triggers
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
cache: 'npm'
32+
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v4
35+
with:
36+
static_site_generator: sveltekit
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Build landing page
42+
env:
43+
NODE_ENV: production
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
VITE_CTX_LOGIN_URL: ${{ secrets.VITE_CTX_LOGIN_URL }}
46+
run: npm run build
47+
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: build/
52+
53+
deploy:
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
runs-on: ubuntu-latest
58+
needs: build
59+
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

.github/workflows/publish-cli.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish ctxce CLI to npm
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- test
8+
paths:
9+
- "ctx-mcp-bridge/package.json"
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Use Node.js 20
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: "20"
26+
registry-url: "https://registry.npmjs.org"
27+
28+
- name: Check bridge version change
29+
id: version_check
30+
shell: bash
31+
run: |
32+
set -euo pipefail
33+
34+
PKG_PATH="ctx-mcp-bridge/package.json"
35+
CURRENT_VERSION="$(node -p "require('./' + process.env.PKG_PATH).version")"
36+
37+
PREVIOUS_VERSION=""
38+
if git cat-file -e "${{ github.event.before }}:${PKG_PATH}" 2>/dev/null; then
39+
PREVIOUS_VERSION="$(git show "${{ github.event.before }}:${PKG_PATH}" | node -e 'let d="";process.stdin.on("data",c=>d+=c);process.stdin.on("end",()=>{try{console.log(JSON.parse(d).version||"")}catch(e){console.log("")}})')"
40+
fi
41+
42+
ALREADY_PUBLISHED=false
43+
if npm view "@context-engine-bridge/context-engine-mcp-bridge@${CURRENT_VERSION}" version >/dev/null 2>&1; then
44+
ALREADY_PUBLISHED=true
45+
fi
46+
47+
echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"
48+
echo "previous_version=${PREVIOUS_VERSION}" >> "$GITHUB_OUTPUT"
49+
echo "already_published=${ALREADY_PUBLISHED}" >> "$GITHUB_OUTPUT"
50+
51+
if [[ -n "$CURRENT_VERSION" && "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]]; then
52+
echo "changed=true" >> "$GITHUB_OUTPUT"
53+
else
54+
echo "changed=false" >> "$GITHUB_OUTPUT"
55+
fi
56+
env:
57+
PKG_PATH: "ctx-mcp-bridge/package.json"
58+
59+
- name: Install dependencies
60+
working-directory: ctx-mcp-bridge
61+
run: npm install
62+
63+
- name: Publish to npm
64+
if: steps.version_check.outputs.changed == 'true' && steps.version_check.outputs.already_published != 'true'
65+
working-directory: ctx-mcp-bridge
66+
env:
67+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
run: npm publish --access public --provenance
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish VS Code Extension
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- test
8+
paths:
9+
- "vscode-extension/context-engine-uploader/package.json"
10+
11+
concurrency:
12+
group: vscode-marketplace-publish
13+
cancel-in-progress: false
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Use Node.js 20
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "20"
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.11"
35+
36+
- name: Check extension version change
37+
id: version_check
38+
shell: bash
39+
run: |
40+
set -euo pipefail
41+
42+
FILE="vscode-extension/context-engine-uploader/package.json"
43+
CURRENT_VERSION="$(node -p "require('./' + process.env.FILE).version" )"
44+
45+
PREVIOUS_VERSION=""
46+
if git cat-file -e "${{ github.event.before }}:${FILE}" 2>/dev/null; then
47+
PREVIOUS_VERSION="$(git show "${{ github.event.before }}:${FILE}" | node -e 'let d="";process.stdin.on("data",c=>d+=c);process.stdin.on("end",()=>{try{console.log(JSON.parse(d).version||"")}catch(e){console.log("")}})')"
48+
fi
49+
50+
echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"
51+
echo "previous_version=${PREVIOUS_VERSION}" >> "$GITHUB_OUTPUT"
52+
53+
if [[ -n "$CURRENT_VERSION" && "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]]; then
54+
echo "changed=true" >> "$GITHUB_OUTPUT"
55+
else
56+
echo "changed=false" >> "$GITHUB_OUTPUT"
57+
fi
58+
env:
59+
FILE: "vscode-extension/context-engine-uploader/package.json"
60+
61+
- name: Publish to VS Code Marketplace
62+
if: steps.version_check.outputs.changed == 'true'
63+
shell: bash
64+
env:
65+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
66+
run: |
67+
chmod +x vscode-extension/build/publish-vscode-extension.sh
68+
vscode-extension/build/publish-vscode-extension.sh --bundle-deps

0 commit comments

Comments
 (0)