Skip to content

Commit 8c81fbb

Browse files
authored
Feature universal bin file macos (#471)
Co-authored-by: Hien To <[email protected]>
1 parent b510b7e commit 8c81fbb

File tree

3 files changed

+36
-131
lines changed

3 files changed

+36
-131
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
schedule:
55
- cron: "0 20 * * *" # At 8 PM UTC, which is 3 AM UTC+7
66
push:
7-
branches:
8-
- main
97
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
108
paths:
119
[
@@ -297,11 +295,9 @@ jobs:
297295
mkdir -p nitro
298296
cp llama.cpp/ggml-metal.metal nitro/
299297
cp build/nitro nitro/
300-
tar -czvf nitro.tar.gz nitro
301298
302299
- name: Upload Artifact
303300
uses: actions/upload-artifact@v2
304-
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
305301
with:
306302
name: nitro-mac-arm64
307303
path: ./nitro
@@ -330,16 +326,6 @@ jobs:
330326
chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }}
331327
rm -rf uploads/
332328
333-
- uses: actions/[email protected]
334-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
335-
env:
336-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
337-
with:
338-
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
339-
asset_path: ./nitro.tar.gz
340-
asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-arm64.tar.gz
341-
asset_content_type: application/gzip
342-
343329
macOS-amd64-build:
344330
runs-on: macos-latest
345331
needs: [create-draft-release, set-nitro-version]
@@ -375,11 +361,9 @@ jobs:
375361
run: |
376362
mkdir -p nitro
377363
cp build/nitro nitro/
378-
tar -czvf nitro.tar.gz nitro
379364
380365
- name: Upload Artifact
381366
uses: actions/upload-artifact@v2
382-
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
383367
with:
384368
name: nitro-mac-amd64
385369
path: ./nitro
@@ -400,14 +384,48 @@ jobs:
400384
chmod +x ../.github/scripts/e2e-test-whisper-linux-and-mac.sh && ../.github/scripts/e2e-test-whisper-linux-and-mac.sh ./nitro ${{ env.WHISPER_MODEL_URL }}
401385
rm -rf uploads/
402386
387+
universal-nitro-artifact-macos:
388+
runs-on: macos-latest
389+
needs: [create-draft-release, set-nitro-version, macOS-silicon-build, macOS-amd64-build]
390+
if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success'
391+
timeout-minutes: 20
392+
permissions:
393+
contents: write
394+
steps:
395+
- name: download artifact amd64
396+
uses: actions/download-artifact@v2
397+
with:
398+
name: nitro-mac-amd64
399+
path: ./nitro-mac-amd64
400+
401+
- name: download artifact arm64
402+
uses: actions/download-artifact@v2
403+
with:
404+
name: nitro-mac-arm64
405+
path: ./nitro-mac-arm64
406+
407+
- name: bundle universal binary
408+
run: |
409+
mkdir -p nitro
410+
ls ./nitro-mac-amd64
411+
lipo -create ./nitro-mac-amd64/nitro ./nitro-mac-arm64/nitro -output ./nitro/nitro
412+
cp ./nitro-mac-arm64/ggml-metal.metal ./nitro/ggml-metal.metal
413+
tar -czvf nitro.tar.gz nitro
414+
415+
- name: Upload Artifact
416+
uses: actions/upload-artifact@v2
417+
with:
418+
name: nitro-mac-universal
419+
path: ./nitro
420+
403421
- uses: actions/[email protected]
404422
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
405423
env:
406424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
407425
with:
408426
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
409427
asset_path: ./nitro.tar.gz
410-
asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.tar.gz
428+
asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-universal.tar.gz
411429
asset_content_type: application/gzip
412430

413431
windows-amd64-build:

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 112 deletions
This file was deleted.

install.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ create_uninstall_script() {
7373

7474
# Determine OS and architecture
7575
OS=$(uname -s)
76-
ARCH=$(uname -m)
7776
VERSION="latest"
7877
GPU=""
7978

@@ -130,7 +129,7 @@ case $OS in
130129
FILE_NAME="nitro-${VERSION}-linux-amd64${GPU}${CUDA_VERSION}.tar.gz"
131130
;;
132131
Darwin)
133-
ARCH_FORMAT=$( [[ "$ARCH" == "arm64" ]] && echo "mac-arm64" || echo "mac-amd64")
132+
ARCH_FORMAT="mac-universal"
134133
FILE_NAME="nitro-${VERSION}-${ARCH_FORMAT}.tar.gz"
135134
;;
136135
*)

0 commit comments

Comments
 (0)