Automatically Generate Releases for Mac, Linux, Windows (#81)
* trying to build for arm * cross compiling? * only mac * gh actions * fix * fixing dash * ensure that its executable * adding back windows * unindent * typo * oops * runs on * more release stuff * more release stuff * fix workflow * adding back linux builds * conditional stuff
This commit is contained in:
parent
2cbe79694a
commit
99f3908c51
2 changed files with 94 additions and 235 deletions
322
.github/workflows/build.yml
vendored
322
.github/workflows/build.yml
vendored
|
@ -36,15 +36,18 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
make
|
make
|
||||||
|
|
||||||
|
- name: Zip executables
|
||||||
|
run: zip alpaca-linux.zip chat
|
||||||
|
|
||||||
- name: Archive production artifacts
|
- name: Archive production artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ubuntu
|
name: linux
|
||||||
path: |
|
path: |
|
||||||
chat
|
alpaca-linux.zip
|
||||||
|
|
||||||
|
|
||||||
macOS-latest:
|
macos-latest:
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -60,39 +63,45 @@ jobs:
|
||||||
- name: Build
|
- name: Build
|
||||||
id: make_build
|
id: make_build
|
||||||
run: |
|
run: |
|
||||||
make
|
make chat_mac
|
||||||
|
|
||||||
|
- name: Codesign executable
|
||||||
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
||||||
|
env:
|
||||||
|
MACOS_CERTIFICATE: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
||||||
|
MACOS_CERTIFICATE_PWD: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
|
||||||
|
KEYCHAIN_PWD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||||
|
MACOS_CERT_ID: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_ID }}
|
||||||
|
|
||||||
|
run: |
|
||||||
|
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
|
||||||
|
security create-keychain -p $KEYCHAIN_PWD build.keychain
|
||||||
|
security default-keychain -s build.keychain
|
||||||
|
security unlock-keychain -p $KEYCHAIN_PWD build.keychain
|
||||||
|
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
|
||||||
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PWD build.keychain
|
||||||
|
/usr/bin/codesign --options runtime --force -s $MACOS_CERT_ID ./chat_mac -v
|
||||||
|
|
||||||
|
- name: Zip executables
|
||||||
|
run: zip alpaca-mac.zip chat_mac
|
||||||
|
|
||||||
|
- name: Notarize executables
|
||||||
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
||||||
|
env:
|
||||||
|
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.AC_USERNAME }}
|
||||||
|
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.AC_PASSWORD }}
|
||||||
|
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
|
||||||
|
run: |
|
||||||
|
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
|
||||||
|
xcrun notarytool submit "alpaca-mac.zip" --keychain-profile "notarytool-profile" --wait
|
||||||
|
|
||||||
- name: Archive production artifacts
|
- name: Archive production artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: macos
|
name: macos
|
||||||
path: |
|
path: |
|
||||||
chat
|
alpaca-mac.zip
|
||||||
|
|
||||||
# macos-arm64:
|
|
||||||
# runs-on: macos-arm64
|
|
||||||
|
|
||||||
# steps:
|
|
||||||
# - name: Clone
|
|
||||||
# id: checkout
|
|
||||||
# uses: actions/checkout@v1
|
|
||||||
|
|
||||||
# - name: Dependencies
|
|
||||||
# id: depends
|
|
||||||
# run: |
|
|
||||||
# brew update
|
|
||||||
|
|
||||||
# - name: Build
|
|
||||||
# id: make_build
|
|
||||||
# run: |
|
|
||||||
# make
|
|
||||||
|
|
||||||
# - name: Archive production artifacts
|
|
||||||
# uses: actions/upload-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: macos
|
|
||||||
# path: |
|
|
||||||
# chat
|
|
||||||
|
|
||||||
windows-latest:
|
windows-latest:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
@ -110,227 +119,70 @@ jobs:
|
||||||
cmake ..
|
cmake ..
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
||||||
- name: Set commit hash variables
|
|
||||||
id: commit
|
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
|
||||||
uses: pr-mpt/actions-commit-hash@v2
|
|
||||||
|
|
||||||
- name: Pack artifacts
|
- name: Pack artifacts
|
||||||
id: pack_artifacts
|
id: pack_artifacts
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
|
||||||
run: |
|
run: |
|
||||||
7z a alpaca-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-x64.zip .\build\Release\*
|
7z a alpaca-win.zip .\build\Release\*
|
||||||
|
|
||||||
|
- name: Archive production artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: windows
|
||||||
|
path: |
|
||||||
|
alpaca-win.zip
|
||||||
|
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
||||||
|
needs:
|
||||||
|
- windows-latest
|
||||||
|
- macos-latest
|
||||||
|
- ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download all workflow run artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- name: Set commit hash variables
|
||||||
|
id: commit
|
||||||
|
uses: pr-mpt/actions-commit-hash@v2
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
id: create_release
|
id: create_release
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
|
||||||
uses: zendesk/action-create-release@v1
|
uses: zendesk/action-create-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}
|
tag_name: ${{ steps.commit.outputs.short }}
|
||||||
|
|
||||||
- name: Upload release
|
- name: Upload windows release
|
||||||
id: upload_release
|
|
||||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
|
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: .\alpaca-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-x64.zip
|
asset_path: windows/alpaca-win.zip
|
||||||
asset_name: alpaca-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-x64.zip
|
asset_name: alpaca-win.zip
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
# ubuntu-latest-gcc:
|
- name: Upload mac release
|
||||||
# runs-on: ubuntu-latest
|
uses: actions/upload-release-asset@v1
|
||||||
#
|
env:
|
||||||
# strategy:
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# matrix:
|
with:
|
||||||
# build: [Debug, Release]
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
#
|
asset_path: macos/alpaca-mac.zip
|
||||||
# steps:
|
asset_name: alpaca-mac.zip
|
||||||
# - name: Clone
|
asset_content_type: application/octet-stream
|
||||||
# uses: actions/checkout@v1
|
|
||||||
#
|
- name: Upload linux release
|
||||||
# - name: Dependencies
|
|
||||||
# run: |
|
uses: actions/upload-release-asset@v1
|
||||||
# sudo apt-get update
|
env:
|
||||||
# sudo apt-get install build-essential
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# sudo apt-get install cmake
|
with:
|
||||||
#
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
# - name: Configure
|
asset_path: linux/alpaca-linux.zip
|
||||||
# run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
asset_name: alpaca-linux.zip
|
||||||
#
|
asset_content_type: application/octet-stream
|
||||||
# - name: Build
|
|
||||||
# run: |
|
|
||||||
# make
|
|
||||||
#
|
|
||||||
# ubuntu-latest-clang:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
#
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# build: [Debug, Release]
|
|
||||||
#
|
|
||||||
# steps:
|
|
||||||
# - name: Clone
|
|
||||||
# uses: actions/checkout@v1
|
|
||||||
#
|
|
||||||
# - name: Dependencies
|
|
||||||
# run: |
|
|
||||||
# sudo apt-get update
|
|
||||||
# sudo apt-get install build-essential
|
|
||||||
# sudo apt-get install cmake
|
|
||||||
#
|
|
||||||
# - name: Configure
|
|
||||||
# run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
|
|
||||||
#
|
|
||||||
# - name: Build
|
|
||||||
# run: |
|
|
||||||
# make
|
|
||||||
#
|
|
||||||
# ubuntu-latest-gcc-sanitized:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
#
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# sanitizer: [ADDRESS, THREAD, UNDEFINED]
|
|
||||||
#
|
|
||||||
# steps:
|
|
||||||
# - name: Clone
|
|
||||||
# uses: actions/checkout@v1
|
|
||||||
#
|
|
||||||
# - name: Dependencies
|
|
||||||
# run: |
|
|
||||||
# sudo apt-get update
|
|
||||||
# sudo apt-get install build-essential
|
|
||||||
# sudo apt-get install cmake
|
|
||||||
#
|
|
||||||
# - name: Configure
|
|
||||||
# run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
|
|
||||||
#
|
|
||||||
# - name: Build
|
|
||||||
# run: |
|
|
||||||
# make
|
|
||||||
#
|
|
||||||
# windows:
|
|
||||||
# runs-on: windows-latest
|
|
||||||
#
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# build: [Release]
|
|
||||||
# arch: [Win32, x64]
|
|
||||||
# include:
|
|
||||||
# - arch: Win32
|
|
||||||
# s2arc: x86
|
|
||||||
# - arch: x64
|
|
||||||
# s2arc: x64
|
|
||||||
#
|
|
||||||
# steps:
|
|
||||||
# - name: Clone
|
|
||||||
# uses: actions/checkout@v1
|
|
||||||
#
|
|
||||||
# - name: Add msbuild to PATH
|
|
||||||
# uses: microsoft/setup-msbuild@v1
|
|
||||||
#
|
|
||||||
# - name: Configure
|
|
||||||
# run: >
|
|
||||||
# cmake -S . -B ./build -A ${{ matrix.arch }}
|
|
||||||
# -DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
|
||||||
#
|
|
||||||
# - name: Build
|
|
||||||
# run: |
|
|
||||||
# cd ./build
|
|
||||||
# msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
|
|
||||||
#
|
|
||||||
# - name: Upload binaries
|
|
||||||
# uses: actions/upload-artifact@v1
|
|
||||||
# with:
|
|
||||||
# name: llama-bin-${{ matrix.arch }}
|
|
||||||
# path: build/bin/${{ matrix.build }}
|
|
||||||
#
|
|
||||||
# windows-blas:
|
|
||||||
# runs-on: windows-latest
|
|
||||||
#
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# build: [Release]
|
|
||||||
# arch: [Win32, x64]
|
|
||||||
# blas: [ON]
|
|
||||||
# include:
|
|
||||||
# - arch: Win32
|
|
||||||
# obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
|
|
||||||
# s2arc: x86
|
|
||||||
# - arch: x64
|
|
||||||
# obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
|
|
||||||
# s2arc: x64
|
|
||||||
#
|
|
||||||
# steps:
|
|
||||||
# - name: Clone
|
|
||||||
# uses: actions/checkout@v1
|
|
||||||
#
|
|
||||||
# - name: Add msbuild to PATH
|
|
||||||
# uses: microsoft/setup-msbuild@v1
|
|
||||||
#
|
|
||||||
# - name: Fetch OpenBLAS
|
|
||||||
# if: matrix.blas == 'ON'
|
|
||||||
# run: |
|
|
||||||
# C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
|
|
||||||
# 7z x blas.zip -oblas -y
|
|
||||||
# copy blas/include/cblas.h .
|
|
||||||
# copy blas/include/openblas_config.h .
|
|
||||||
# echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
|
|
||||||
#
|
|
||||||
# - name: Configure
|
|
||||||
# run: >
|
|
||||||
# cmake -S . -B ./build -A ${{ matrix.arch }}
|
|
||||||
# -DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
|
||||||
# -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
|
|
||||||
# -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
|
|
||||||
#
|
|
||||||
# - name: Build
|
|
||||||
# run: |
|
|
||||||
# cd ./build
|
|
||||||
# msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
|
|
||||||
#
|
|
||||||
# - name: Copy libopenblas.dll
|
|
||||||
# if: matrix.blas == 'ON'
|
|
||||||
# run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
|
|
||||||
#
|
|
||||||
# - name: Upload binaries
|
|
||||||
# if: matrix.blas == 'ON'
|
|
||||||
# uses: actions/upload-artifact@v1
|
|
||||||
# with:
|
|
||||||
# name: llama-blas-bin-${{ matrix.arch }}
|
|
||||||
# path: build/bin/${{ matrix.build }}
|
|
||||||
#
|
|
||||||
# emscripten:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
#
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# build: [Release]
|
|
||||||
#
|
|
||||||
# steps:
|
|
||||||
# - name: Clone
|
|
||||||
# uses: actions/checkout@v1
|
|
||||||
#
|
|
||||||
# - name: Dependencies
|
|
||||||
# run: |
|
|
||||||
# wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
|
|
||||||
# tar -xvf master.tar.gz
|
|
||||||
# emsdk-master/emsdk update
|
|
||||||
# emsdk-master/emsdk install latest
|
|
||||||
# emsdk-master/emsdk activate latest
|
|
||||||
#
|
|
||||||
# - name: Configure
|
|
||||||
# run: echo "tmp"
|
|
||||||
#
|
|
||||||
# - name: Build
|
|
||||||
# run: |
|
|
||||||
# pushd emsdk-master
|
|
||||||
# source ./emsdk_env.sh
|
|
||||||
# popd
|
|
||||||
# emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
|
||||||
# make
|
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -194,6 +194,13 @@ clean:
|
||||||
chat: chat.cpp ggml.o utils.o
|
chat: chat.cpp ggml.o utils.o
|
||||||
$(CXX) $(CXXFLAGS) chat.cpp ggml.o utils.o -o chat $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) chat.cpp ggml.o utils.o -o chat $(LDFLAGS)
|
||||||
|
|
||||||
|
chat_mac: chat.cpp ggml.c utils.cpp
|
||||||
|
$(CC) $(CFLAGS) -c ggml.c -o ggml_x86.o -target x86_64-apple-macos
|
||||||
|
$(CC) $(CFLAGS) -c ggml.c -o ggml_arm.o -target arm64-apple-macos
|
||||||
|
|
||||||
|
$(CXX) $(CXXFLAGS) chat.cpp ggml_x86.o utils.cpp -o chat_x86 $(LDFLAGS) -target x86_64-apple-macos
|
||||||
|
$(CXX) $(CXXFLAGS) chat.cpp ggml_arm.o utils.cpp -o chat_arm $(LDFLAGS) -target arm64-apple-macos
|
||||||
|
lipo -create -output chat_mac chat_x86 chat_arm
|
||||||
|
|
||||||
quantize: quantize.cpp ggml.o utils.o
|
quantize: quantize.cpp ggml.o utils.o
|
||||||
$(CXX) $(CXXFLAGS) quantize.cpp ggml.o utils.o -o quantize $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) quantize.cpp ggml.o utils.o -o quantize $(LDFLAGS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue