Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit af43dc0

Browse files
chore: rename cortex-js folder to platform (#1033)
1 parent c5b4544 commit af43dc0

File tree

230 files changed

+29
-313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+29
-313
lines changed

.github/workflows/cortex-build.yml

Lines changed: 4 additions & 288 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: CI Cortex Release
22

33
on:
44
push:
5-
tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*", "!v[0-9]+.[0-9]+.[0-9]+-cortex-js", "!v[0-9]+.[0-9]+.[0-9]+-[0-9]+-cortex-js"]
6-
paths: ["cortex-cpp/**", "cortex-js/**"]
5+
tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*", "!v[0-9]+.[0-9]+.[0-9]+-platform", "!v[0-9]+.[0-9]+.[0-9]+-[0-9]+-platform"]
6+
paths: ["cortex-cpp/**", "platform/**"]
77
workflow_dispatch:
88

99
jobs:
@@ -223,237 +223,8 @@ jobs:
223223

224224
## cortex-cpp node binding
225225

226-
build-cortex-single-binary:
227-
runs-on: ${{ matrix.runs-on }}
228-
needs: [create-draft-release, build-and-test]
229-
timeout-minutes: 40
230-
strategy:
231-
fail-fast: false
232-
matrix:
233-
include:
234-
- os: "linux"
235-
name: "amd64"
236-
runs-on: "ubuntu-20-04"
237-
238-
- os: "windows"
239-
name: "amd64"
240-
runs-on: "windows-2019"
241-
242-
- os: "mac"
243-
name: "amd64"
244-
runs-on: "macos-13"
245-
246-
- os: "mac"
247-
name: "arm64"
248-
runs-on: "macos-latest"
249-
steps:
250-
- name: Clone
251-
id: checkout
252-
uses: actions/checkout@v3
253-
with:
254-
submodules: recursive
255-
256-
- uses: actions/setup-dotnet@v3
257-
if: runner.os == 'Windows'
258-
with:
259-
dotnet-version: "8.0.x"
260-
261-
- name: Install jq
262-
uses: dcarbone/[email protected]
263-
264-
- uses: actions/setup-node@v3
265-
with:
266-
node-version: "20.x"
267-
registry-url: "https://registry.npmjs.org"
268-
269-
- name: "Update version by tag"
270-
working-directory: cortex-js
271-
shell: bash
272-
run: |
273-
echo "Version: ${{ needs.create-draft-release.outputs.version }}"
274-
# Update the version in package.json
275-
jq --arg version "${{ needs.create-draft-release.outputs.version }}" '.version = $version' package.json > /tmp/package.json
276-
mv /tmp/package.json package.json
277-
278-
- name: Install choco on Windows
279-
if: runner.os == 'Windows'
280-
run: |
281-
choco install make -y
282-
283-
- uses: actions/setup-node@v3
284-
with:
285-
node-version: "20.x"
286-
registry-url: "https://registry.npmjs.org"
287-
288-
- uses: actions/setup-python@v3
289-
with:
290-
python-version: "3.10"
291-
292-
- run: pip3 install --upgrade setuptools
293-
if: runner.os == 'macOS'
294-
295-
- run: yarn install && yarn build:binary
296-
working-directory: ./cortex-js
297-
298-
- name: Get Cer for code signing
299-
if: runner.os == 'macOS'
300-
run: base64 -d <<< "$NOTARIZE_P8_BASE64" > /tmp/notary-key.p8
301-
shell: bash
302-
env:
303-
NOTARIZE_P8_BASE64: ${{ secrets.NOTARIZE_P8_BASE64 }}
304-
305-
- uses: apple-actions/import-codesign-certs@v2
306-
continue-on-error: true
307-
if: runner.os == 'macOS'
308-
with:
309-
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
310-
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
311-
312-
- name: update app info
313-
run: |
314-
cd cortex-js
315-
make update-app-info
316-
317-
- name: copy bin file macos
318-
if: runner.os == 'macOS'
319-
run: |
320-
cd cortex-js
321-
mkdir -p installer
322-
which cp
323-
which mv
324-
npm install -g cpx
325-
npx cpx ./dist/cortexso ./
326-
mv cortexso cortex
327-
328-
- name: Code Signing macOS
329-
if: runner.os == 'macOS'
330-
run: |
331-
cd cortex-js
332-
./dist/cortexso --help
333-
echo "--------"
334-
./cortex --help
335-
make codesign-binary CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
336-
337-
# install quill
338-
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b /usr/local/bin
339-
340-
# Notarize the binary
341-
quill notarize ./cortex
342-
env:
343-
QUILL_NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }}
344-
QUILL_NOTARY_ISSUER: ${{ secrets.NOTARY_ISSUER }}
345-
QUILL_NOTARY_KEY: "/tmp/notary-key.p8"
346-
347-
- name: Create MacOS PKG Installer
348-
if: runner.os == 'macOS'
349-
run: |
350-
cd cortex-js
351-
echo "--------"
352-
npx cpx ./cortex ./installer
353-
./installer/cortex --help
354-
pkgbuild --identifier ai.cortex.pkg --install-location ./usr/local/bin/ --root ./installer cortex-installer.pkg
355-
make codesign-installer CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
356-
357-
# Notary the installer
358-
xcrun notarytool submit cortex-installer.pkg --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --wait
359-
360-
- name: Create Linux DEB Installer
361-
if: runner.os == 'Linux'
362-
run: |
363-
cd cortex-js
364-
mkdir -p cortexso/DEBIAN
365-
mkdir -p cortexso/usr/local/bin
366-
sed "s/Version:/Version: ${{ needs.create-draft-release.outputs.version }}/g" control.template > cortexso/DEBIAN/control
367-
cp cortex cortexso/usr/local/bin/cortex
368-
dpkg-deb --build cortexso
369-
370-
- run: |
371-
cd cortex-js
372-
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
373-
make codesign-binary CODE_SIGN=true CORTEX_VERSION="0.${{ needs.create-draft-release.outputs.version }}" AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}"
374-
name: Code Signing Windows
375-
shell: cmd
376-
if: runner.os == 'Windows'
377-
378-
- name: Update version in installer.iss using sed
379-
if: runner.os == 'Windows'
380-
shell: bash
381-
run: |
382-
cd cortex-js
383-
sed -i "s/AppVersion=1.0/AppVersion=${{ needs.create-draft-release.outputs.version }}/g" installer.iss
384-
cat installer.iss
385-
386-
- name: Compile .ISS to .EXE Installer
387-
uses: Minionguyjpro/[email protected]
388-
if: runner.os == 'Windows'
389-
with:
390-
path: cortex-js/installer.iss
391-
options: /O+
392-
393-
- run: |
394-
cd cortex-js
395-
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
396-
make codesign-installer CODE_SIGN=true CORTEX_VERSION="0.${{ needs.create-draft-release.outputs.version }}" AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}"
397-
name: Code Signing Windows
398-
shell: cmd
399-
if: runner.os == 'Windows'
400-
401-
- name: Post-Bundle
402-
run: |
403-
cd cortex-js
404-
make postbundle
405-
406-
- name: Upload Cortex Installer
407-
uses: actions/[email protected]
408-
if: runner.os != 'Linux'
409-
env:
410-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
411-
with:
412-
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
413-
asset_path: ./cortex-js/cortex-installer.tar.gz
414-
asset_name: cortex-installer-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.tar.gz
415-
asset_content_type: application/gzip
416-
417-
- name: Upload Cortex Installer
418-
uses: actions/[email protected]
419-
if: runner.os == 'Windows'
420-
env:
421-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
422-
with:
423-
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
424-
asset_path: ./cortex-js/setup.exe
425-
asset_name: cortex-installer-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.exe
426-
asset_content_type: application/octet-stream
427-
428-
- uses: actions/[email protected]
429-
env:
430-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
431-
with:
432-
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
433-
asset_path: ./cortex-js/cortex.tar.gz
434-
asset_name: cortex-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.tar.gz
435-
asset_content_type: application/gzip
436-
437-
- uses: actions/[email protected]
438-
if: runner.os == 'Linux'
439-
env:
440-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
441-
with:
442-
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
443-
asset_path: ./cortex-js/cortexso.deb
444-
asset_name: cortex-installer-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.deb
445-
asset_content_type: application/gzip
446-
447-
# Upload artifact for package manager
448-
- name: Upload Artifact
449-
if: runner.os == 'Linux'
450-
uses: actions/upload-artifact@v2
451-
with:
452-
name: cortex-linux
453-
path: ./cortex-js/cortex
454-
455226
update_release_draft:
456-
needs: [build-and-test, build-cortex-single-binary]
227+
needs: [build-and-test]
457228
permissions:
458229
# write permission is required to create a github release
459230
contents: write
@@ -476,59 +247,4 @@ jobs:
476247
env:
477248
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
478249

479-
480-
# Add jobs with approval
481-
public_package_manager:
482-
needs: [create-draft-release, update_release_draft]
483-
runs-on: ubuntu-latest
484-
environment: package-manager
485-
permissions:
486-
contents: read
487-
steps:
488-
- name: checkout
489-
uses: actions/checkout@v4
490-
491-
- name: Download artifact
492-
uses: actions/download-artifact@v2
493-
with:
494-
name: cortex-linux
495-
path: ./cortex-linux
496-
497-
- name: install dependencies
498-
run: |
499-
ls -al ./cortex-linux
500-
sudo apt-get install dput devscripts build-essential debhelper-compat pbuilder debootstrap devscripts -y
501-
502-
- name: import gpg key with subkey
503-
uses: crazy-max/ghaction-import-gpg@v4
504-
with:
505-
gpg_private_key: ${{ secrets.HOMEBREW_GPG_PRIVATE_KEY }}
506-
passphrase: ${{ secrets.HOMEBREW_GPG_PASSPHRASE }}
507-
fingerprint: ${{ secrets.HOMEBREW_GPG_FINGERPRINT }}
508-
509-
- run: |
510-
mkdir -p package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian
511-
cp package-managers-template/launchpad/cortexso/debian/* package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/
512-
cp ./cortex-linux/cortex package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/
513-
514-
- name: Get release notes
515-
id: release_notes
516-
run: |
517-
RELEASE_NOTES="cortex update to version ${{ needs.create-draft-release.outputs.version }}"
518-
echo "RELEASE_NOTES=${RELEASE_NOTES}" >> $GITHUB_ENV
519-
520-
- name: Update change log
521-
run: |
522-
sed -i "s/VERSION/${{ needs.create-draft-release.outputs.version }}/g" package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/changelog
523-
sed -i "s/CHANGELOG_HERE/${{ env.RELEASE_NOTES }}/g" package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/changelog
524-
timestamp=$(date -u +"%a, %d %b %Y %H:%M:%S +0000")
525-
sed -i "s/TIME_HERE/${timestamp}/g" package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/changelog
526-
527-
- name: Build package
528-
run: |
529-
cd package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}
530-
echo "y" | debuild -S -sa -k${{ secrets.HOMEBREW_GPG_FINGERPRINT }}
531-
sudo pbuilder create --distribution jammy --debootstrapopts --variant=buildd
532-
sudo pbuilder build ../cortexso_${{ needs.create-draft-release.outputs.version }}.dsc
533-
dput ppa:homebrew-computer/main ../cortexso_${{ needs.create-draft-release.outputs.version }}_source.changes
534-
250+

.github/workflows/cortex-js-openai-coverage.yml renamed to .github/workflows/platform-openai-coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
node-version: 20
3737

3838
- run: npm install -g yarn && yarn install && yarn build
39-
working-directory: ./cortex-js
39+
working-directory: ./platform
4040

4141
- name: install python venv
4242
run: |
@@ -46,7 +46,7 @@ jobs:
4646
4747
- name: Run test
4848
run: |
49-
node cortex-js/dist/src/command.js --address 127.0.0.1 --port 4010 > cortex.log
49+
node platform/dist/src/command.js --address 127.0.0.1 --port 4010 > cortex.log
5050
sleep 3
5151
wget --no-verbose -O api.json http://127.0.0.1:4010/api-json
5252
cat api.json
@@ -108,7 +108,7 @@ jobs:
108108
- name: Clean up
109109
if: always()
110110
run: |
111-
node cortex-js/dist/src/command.js stop
111+
node platform/dist/src/command.js stop
112112
rm -rf /tmp/jan
113113
rm -rf openai-python
114114
rm -rf report.html

.github/workflows/cortex-js-quality-gate.yml renamed to .github/workflows/platform-quality-gate.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: CI test for cortex-js
1+
name: CI test for platform
22
on:
33
pull_request:
44
paths:
5-
- "cortex-js/**"
6-
- .github/workflows/cortex-js-quality-gate.yml
5+
- "platform/**"
6+
- .github/workflows/platform-quality-gate.yml
77
workflow_dispatch:
88
jobs:
99
build-and-publish-plugins:
@@ -19,7 +19,7 @@ jobs:
1919
node-version: "20.x"
2020
registry-url: "https://registry.npmjs.org"
2121
- run: yarn install && yarn build
22-
working-directory: ./cortex-js
22+
working-directory: ./platform
2323
- run: yarn test
2424
name: run tests
25-
working-directory: ./cortex-js
25+
working-directory: ./platform

0 commit comments

Comments
 (0)