Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error bin file macos #819

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 19 additions & 41 deletions .github/workflows/cortex-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,6 @@ jobs:
cd cortex-cpp
make run-e2e-test RUN_TESTS=true LLM_MODEL_URL=${{ env.LLM_MODEL_URL }} EMBEDDING_MODEL_URL=${{ env.EMBEDDING_MODEL_URL }}

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
path: ./cortex-cpp/cortex-cpp

- uses: actions/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
Expand Down Expand Up @@ -352,7 +346,7 @@ jobs:

- os: "mac"
name: "arm64"
runs-on: "macos-latest"
runs-on: "macos-silicon"
steps:
- name: Clone
id: checkout
Expand Down Expand Up @@ -410,6 +404,7 @@ jobs:
CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}

- uses: apple-actions/import-codesign-certs@v2
continue-on-error: true
if: runner.os == 'macOS'
with:
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
Expand All @@ -420,18 +415,33 @@ jobs:
cd cortex-js
make update-app-info

- name: copy bin file macos
if: runner.os == 'macOS'
run: |
cd cortex-js
mkdir -p installer
which cp
which mv
npm install -g cpx
npx cpx ./dist/cortexso-macos ./
mv cortexso-macos cortex

- name: Code Signing macOS
if: runner.os == 'macOS'
run: |
cd cortex-js
./dist/cortexso-macos --help
echo "--------"
./cortex --help
make codesign-binary CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"

- name: Create MacOS PKG Installer
if: runner.os == 'macOS'
run: |
cd cortex-js
mkdir installer
cp cortex installer/cortex
echo "--------"
npx cpx ./cortex ./installer
./installer/cortex --help
pkgbuild --identifier ai.cortex.pkg --install-location ./usr/local/bin/ --root ./installer cortex-installer.pkg
make codesign-installer CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"

Expand Down Expand Up @@ -485,38 +495,6 @@ jobs:
cd cortex-js
make postbundle

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: cortex-${{ matrix.os }}-${{ matrix.name }}
path: |
./cortex-js/cortex
./cortex-js/cortex.exe

- name: Upload Windows Installer
if: runner.os == 'Windows'
uses: actions/upload-artifact@v2
with:
name: cortex-installer-${{ matrix.os }}-${{ matrix.name }}
path: |
./cortex-js/setup.exe

- name: Upload Linux Installer
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: cortex-installer-${{ matrix.os }}-${{ matrix.name }}
path: |
./cortex-js/cortexso.deb

- name: Upload MacOS Installer
if: runner.os == 'macOS'
uses: actions/upload-artifact@v2
with:
name: cortex-installer-${{ matrix.os }}-${{ matrix.name }}
path: |
./cortex-js/cortex-installer.pkg

- name: Upload Cortex Installer
uses: actions/[email protected]
if: runner.os != 'Linux'
Expand Down
8 changes: 3 additions & 5 deletions cortex-js/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ ifeq ($(OS),Windows_NT)
@powershell -Command 'npx resedit --in $(CORTEX_EXE_IN) --out $(CORTEX_EXE_OUT) --icon "1,cortex.ico" --no-grow --company-name "Homebrew Computer Pte Ltd" --file-description "cortex cli" --file-version "$(CORTEX_VERSION)" --internal-name "cortex" --product-name "cortex" --product-version "$(CORTEX_VERSION)"'
else ifeq ($(shell uname -s),Linux)
@cp ./dist/cortexso-linux ./cortex
else
@cp ./dist/cortexso-macos ./cortex
endif

codesign-binary:
Expand Down Expand Up @@ -59,10 +57,10 @@ ifeq ($(OS),Windows_NT)
@powershell -Command "7z a -ttar temp.tar cortex.exe; 7z a -tgzip cortex.tar.gz temp.tar;"
@powershell -Command "7z a -ttar temp2.tar setup.exe; 7z a -tgzip cortex-installer.tar.gz temp2.tar;"
else ifeq ($(shell uname -s),Linux)
@chmod +x cortex;
@chmod +x cortex; \
tar -czvf cortex.tar.gz cortex;
else
@chmod +x cortex;
tar -czvf cortex.tar.gz cortex;
@chmod +x cortex; \
tar -czvf cortex.tar.gz cortex; \
tar -czvf cortex-installer.tar.gz cortex-installer.pkg;
endif
2 changes: 1 addition & 1 deletion cortex-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dev": "nest dev",
"compile": "npx ncc build ./dist/src/command.js -o command",
"build": "nest build",
"build:binary": "yarn build && yarn compile && npx -q patch-package && npx @yao-pkg/pkg .",
"build:binary": "yarn build && yarn compile && npx -q patch-package && npx @yao-pkg/pkg . --options 'max-old-space-size=30720,tls-min-v1.0,expose-gc'",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"build:extensions": "run-script-os",
"build:extensions:windows": "powershell -command \"$jobs = Get-ChildItem -Path './src/extensions' -Directory | ForEach-Object { Start-Job -Name ($_.Name) -ScriptBlock { param($_dir); try { Set-Location $_dir; yarn; yarn build; Write-Output 'Build successful in ' + $_dir } catch { Write-Error 'Error in ' + $_dir; throw } } -ArgumentList $_.FullName }; $jobs | Wait-Job; $jobs | ForEach-Object { Receive-Job -Job $_ -Keep } | ForEach-Object { Write-Host $_ }; $failed = $jobs | Where-Object { $_.State -ne 'Completed' -or $_.ChildJobs[0].JobStateInfo.State -ne 'Completed' }; if ($failed) { Exit 1 }\"",
Expand Down
Loading