From 9747ce740578c270e68d0152025d1bd913a014db Mon Sep 17 00:00:00 2001 From: Hien To Date: Tue, 5 Mar 2024 17:44:42 +0700 Subject: [PATCH 1/8] Remove always() condition in run github action jobs and remove e2e testing that hang the CI --- .github/workflows/build.yml | 201 +++--------------------------------- 1 file changed, 13 insertions(+), 188 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50a3d23ec..bb743a9b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,11 +47,6 @@ on: ] workflow_dispatch: -env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - LLM_MODEL_URL: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF/resolve/main/tinyllama-1.1b-chat-v0.3.Q2_K.gguf - WHISPER_MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-q5_1.bin - jobs: create-draft-release: runs-on: ubuntu-latest @@ -125,6 +120,7 @@ jobs: runs-on: ubuntu-18-04-cuda-11-7 needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write steps: @@ -158,22 +154,6 @@ jobs: name: nitro-linux-amd64 path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -188,6 +168,7 @@ jobs: runs-on: ubuntu-18-04-cuda-11-7 needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write steps: @@ -231,22 +212,6 @@ jobs: name: nitro-linux-amd64-vulkan path: ./nitro - # - name: Run e2e testing - LLama.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - # rm -rf uploads/ - - # - name: Run e2e testing - Whisper.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # 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 }} - # rm -rf uploads/ - - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -261,6 +226,7 @@ jobs: runs-on: ubuntu-18-04-cuda-${{ matrix.cuda }} needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write strategy: @@ -297,22 +263,6 @@ jobs: name: nitro-linux-amd64-cuda-${{ matrix.cuda }} path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -327,6 +277,7 @@ jobs: runs-on: mac-silicon needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write steps: @@ -367,30 +318,6 @@ jobs: name: nitro-mac-arm64 path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro/ - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # To test with CoreML - if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then - wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-encoder.mlmodelc.zip - unzip ggml-tiny-encoder.mlmodelc.zip - rm ggml-tiny-encoder.mlmodelc.zip - rm -rf /tmp/testwhisper-encoder.mlmodelc - mv ggml-tiny-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc - fi - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -405,6 +332,7 @@ jobs: runs-on: macos-latest needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write steps: @@ -444,22 +372,6 @@ jobs: name: nitro-mac-amd64 path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -470,86 +382,11 @@ jobs: asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.tar.gz asset_content_type: application/gzip - # macOS-amd64-vulkan-build: - # runs-on: macos-latest - # needs: [create-draft-release, set-nitro-version] - # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - # permissions: - # contents: write - # steps: - # - name: Clone - # id: checkout - # uses: actions/checkout@v3 - # with: - # submodules: recursive - - # - name: Dependencies - # id: depends - # continue-on-error: true - # run: | - # brew update - # brew install sdl2 - - # - name: Prepare Vulkan SDK - # uses: humbletim/setup-vulkan-sdk@v1.2.0 - # with: - # vulkan-query-version: 1.3.204.0 - # vulkan-components: Vulkan-Headers, Vulkan-Loader - # vulkan-use-cache: true - - # - name: Build - # id: cmake_build - # run: | - # ./install_deps.sh - # mkdir build && cd build - # cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_VULKAN=ON -DLLAMA_METAL=OFF .. - # CC=gcc-8 make -j $(sysctl -n hw.ncp) - # ls -la - - # - name: Package - # shell: bash - # run: | - # mkdir -p nitro - # cp build/nitro nitro/ - # tar -czvf nitro.tar.gz nitro - - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - # with: - # name: nitro-mac-amd64 - # path: ./nitro - - # - name: Run e2e testing - LLama.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - # rm -rf uploads/ - - # - name: Run e2e testing - Whisper.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # 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 }} - # rm -rf uploads/ - - # - uses: actions/upload-release-asset@v1.0.1 - # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - # asset_path: ./nitro.tar.gz - # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64-vulkan.tar.gz - # asset_content_type: application/gzip - windows-amd64-build: runs-on: windows-latest needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write @@ -608,20 +445,6 @@ jobs: 7z a -ttar temp.tar .\build\Release\* 7z a -tgzip nitro.tar.gz temp.tar - - name: Run e2e testing - Llama.cpp - shell: cmd - run: | - cd build\Release - ..\..\.github\scripts\e2e-test-llama-windows.bat nitro.exe ${{ env.LLM_MODEL_URL }} - rmdir /S /Q .\build\Release\uploads - - - name: Run e2e testing - Whisper.cpp - shell: cmd - run: | - cd build\Release - ..\..\.github\scripts\e2e-test-whisper-windows.bat nitro.exe ${{ env.WHISPER_MODEL_URL }} - rmdir /S /Q .\build\Release\uploads - - name: Upload Artifact uses: actions/upload-artifact@v2 if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' @@ -643,6 +466,7 @@ jobs: runs-on: windows-latest needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write @@ -729,6 +553,7 @@ jobs: runs-on: windows-cuda-${{ matrix.cuda }} needs: [create-draft-release, set-nitro-version] if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + timeout-minutes: 20 permissions: contents: write @@ -822,6 +647,7 @@ jobs: update_release_draft: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + timeout-minutes: 20 needs: [ ubuntu-amd64-build, @@ -830,7 +656,6 @@ jobs: macOS-amd64-build, windows-amd64-build, windows-amd64-cuda-build, - # macOS-amd64-vulkan-build, ubuntu-amd64-vulkan-build, windows-amd64-vulkan-build, ] @@ -844,7 +669,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} noti-discord-nightly: - if: always() && github.event_name == 'schedule' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' + timeout-minutes: 20 + if: github.event_name == 'schedule' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' needs: [ create-draft-release, @@ -854,7 +680,6 @@ jobs: macOS-amd64-build, windows-amd64-build, windows-amd64-cuda-build, - # macOS-amd64-vulkan-build, ubuntu-amd64-vulkan-build, windows-amd64-vulkan-build, ] @@ -883,7 +708,8 @@ jobs: GITHUB_RUN_ID: ${{ github.run_id }} noti-discord-manual: - if: always() && github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' + timeout-minutes: 20 + if: github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' needs: [ create-draft-release, @@ -893,7 +719,6 @@ jobs: macOS-amd64-build, windows-amd64-build, windows-amd64-cuda-build, - # macOS-amd64-vulkan-build, ubuntu-amd64-vulkan-build, windows-amd64-vulkan-build, ] From 356dcda2ade9e8450da95aaa8013033e60c35af7 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 01:39:04 +0700 Subject: [PATCH 2/8] e2e testing change download model url to r2 --- .github/workflows/build.yml | 91 ++++ temp.yaml | 921 ++++++++++++++++++++++++++++++++++++ 2 files changed, 1012 insertions(+) create mode 100644 temp.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb743a9b4..1cdb2d5ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,11 @@ on: ] workflow_dispatch: +env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + LLM_MODEL_URL: https://delta.jan.ai/tinyllama-1.1b-chat-v0.3.Q2_K.gguf + WHISPER_MODEL_URL: https://delta.jan.ai/ggml-tiny-q5_1.bin + jobs: create-draft-release: runs-on: ubuntu-latest @@ -154,6 +159,22 @@ jobs: name: nitro-linux-amd64 path: ./nitro + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -263,6 +284,22 @@ jobs: name: nitro-linux-amd64-cuda-${{ matrix.cuda }} path: ./nitro + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -318,6 +355,30 @@ jobs: name: nitro-mac-arm64 path: ./nitro + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro/ + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # To test with CoreML + if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then + wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-encoder.mlmodelc.zip + unzip ggml-tiny-encoder.mlmodelc.zip + rm ggml-tiny-encoder.mlmodelc.zip + rm -rf /tmp/testwhisper-encoder.mlmodelc + mv ggml-tiny-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc + fi + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -372,6 +433,22 @@ jobs: name: nitro-mac-amd64 path: ./nitro + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') env: @@ -445,6 +522,20 @@ jobs: 7z a -ttar temp.tar .\build\Release\* 7z a -tgzip nitro.tar.gz temp.tar + - name: Run e2e testing - Llama.cpp + shell: cmd + run: | + cd build\Release + ..\..\.github\scripts\e2e-test-llama-windows.bat nitro.exe ${{ env.LLM_MODEL_URL }} + rmdir /S /Q .\build\Release\uploads + + - name: Run e2e testing - Whisper.cpp + shell: cmd + run: | + cd build\Release + ..\..\.github\scripts\e2e-test-whisper-windows.bat nitro.exe ${{ env.WHISPER_MODEL_URL }} + rmdir /S /Q .\build\Release\uploads + - name: Upload Artifact uses: actions/upload-artifact@v2 if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' diff --git a/temp.yaml b/temp.yaml new file mode 100644 index 000000000..8e9e3ef55 --- /dev/null +++ b/temp.yaml @@ -0,0 +1,921 @@ +name: CI + +on: + schedule: + - cron: "0 20 * * *" # At 8 PM UTC, which is 3 AM UTC+7 + push: + branches: + - main + tags: ["v[0-9]+.[0-9]+.[0-9]+"] + paths: + [ + ".github/scripts/**", + ".github/workflows/build.yml", + "**/CMakeLists.txt", + "**/Makefile", + "**/*.h", + "**/*.hpp", + "**/*.c", + "**/*.cpp", + "**/*.cu", + "**/*.cc", + "**/*.cxx", + "llama.cpp", + "!docs/**", + "!.gitignore", + "!README.md", + ] + pull_request: + types: [opened, synchronize, reopened] + paths: + [ + ".github/scripts/**", + ".github/workflows/build.yml", + "**/CMakeLists.txt", + "**/Makefile", + "**/*.h", + "**/*.hpp", + "**/*.c", + "**/*.cpp", + "**/*.cu", + "**/*.cc", + "**/*.cxx", + "llama.cpp", + "!docs/**", + "!.gitignore", + "!README.md", + ] + workflow_dispatch: + +env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + LLM_MODEL_URL: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF/resolve/main/tinyllama-1.1b-chat-v0.3.Q2_K.gguf + WHISPER_MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-q5_1.bin + +jobs: + create-draft-release: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + version: ${{ steps.get_version.outputs.version }} + permissions: + contents: write + steps: + - name: Extract tag name without v prefix + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" + env: + GITHUB_REF: ${{ github.ref }} + - name: Create Draft Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: "${{ env.VERSION }}" + draft: true + prerelease: false + + # Get the latest version of the release + set-nitro-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version_update.outputs.new_version }} + steps: + - name: Get latest release + id: version_update + run: | + ldd --version + if [[ ${{ github.event_name }} == push && ${{ github.ref }} == refs/tags/* ]]; then + echo "VERSION=${GITHUB_REF#refs/tags/}" + NEW_VERSION="${VERSION#v}" + echo "::set-output name=new_version::$NEW_VERSION" + else + # Function to get the latest release tag + get_latest_tag() { + local retries=0 + local max_retries=3 + local tag + while [ $retries -lt $max_retries ]; do + tag=$(curl -s https://api.github.com/repos/janhq/nitro/releases/latest | jq -r .tag_name) + if [ -n "$tag" ] && [ "$tag" != "null" ]; then + echo $tag + return + else + let retries++ + sleep 2 + fi + done + echo "Failed to fetch latest tag after $max_retries attempts." + exit 1 + } + # Get the latest release tag from GitHub API + LATEST_TAG=$(get_latest_tag) + + # Remove the 'v' and append the build number to the version + NEW_VERSION="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}" + echo "New version: $NEW_VERSION" + echo "::set-output name=new_version::$NEW_VERSION" + fi + echo "Version: $NEW_VERSION" + + ubuntu-amd64-build: + runs-on: ubuntu-18-04-cuda-11-7 + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build + id: make_build + run: | + ldd --version + ./install_deps.sh + mkdir build && cd build + cmake -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + make -j $(nproc) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-linux-amd64 + path: ./nitro + + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64.tar.gz + asset_content_type: application/gzip + + ubuntu-amd64-vulkan-build: + runs-on: ubuntu-18-04-cuda-11-7 + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install pkg-config + run: sudo apt-get install -y pkg-config + + - name: Prepare Vulkan SDK + uses: humbletim/setup-vulkan-sdk@v1.2.0 + with: + vulkan-query-version: 1.3.275.0 + vulkan-components: Vulkan-Headers, Vulkan-Loader + vulkan-use-cache: true + + - name: Build + id: make_build + run: | + ldd --version + ./install_deps.sh + mkdir build && cd build + cmake -DLLAMA_NATIVE=OFF -DLLAMA_VULKAN=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + make -j $(nproc) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-linux-amd64-vulkan + path: ./nitro + + # - name: Run e2e testing - LLama.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + # rm -rf uploads/ + + # - name: Run e2e testing - Whisper.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # 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 }} + # rm -rf uploads/ + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-vulkan.tar.gz + asset_content_type: application/gzip + + ubuntu-amd64-cuda-build: + runs-on: ubuntu-18-04-cuda-${{ matrix.cuda }} + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + strategy: + matrix: + cuda: ["12-0", "11-7"] + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build + id: make_build + run: | + ./install_deps.sh + mkdir build && cd build + cmake -DLLAMA_NATIVE=OFF -DLLAMA_CUBLAS=ON -DLLAMA_CUBLAS=ON -DWHISPER_CUBLAS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + make -j $(nproc) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-linux-amd64-cuda-${{ matrix.cuda }} + path: ./nitro + + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-cuda-${{ matrix.cuda }}.tar.gz + asset_content_type: application/gzip + + macOS-silicon-build: + runs-on: mac-silicon + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Dependencies + id: depends + continue-on-error: true + run: | + brew update + brew install cmake sdl2 + + - name: Build + id: cmake_build + run: | + ./install_deps.sh + mkdir build && cd build + cmake -DWHISPER_COREML=1 -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + CC=gcc-8 make -j $(sysctl -n hw.ncpu) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp llama.cpp/ggml-metal.metal nitro/ + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-mac-arm64 + path: ./nitro + + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro/ + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # To test with CoreML + if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then + wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-encoder.mlmodelc.zip + unzip ggml-tiny-encoder.mlmodelc.zip + rm ggml-tiny-encoder.mlmodelc.zip + rm -rf /tmp/testwhisper-encoder.mlmodelc + mv ggml-tiny-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc + fi + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-arm64.tar.gz + asset_content_type: application/gzip + + macOS-amd64-build: + runs-on: macos-latest + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Dependencies + id: depends + continue-on-error: true + run: | + brew update + brew install sdl2 + + - name: Build + id: cmake_build + run: | + ./install_deps.sh + mkdir build && cd build + cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_METAL=OFF .. + CC=gcc-8 make -j $(sysctl -n hw.ncp) + ls -la + + - name: Package + shell: bash + run: | + mkdir -p nitro + cp build/nitro nitro/ + tar -czvf nitro.tar.gz nitro + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-mac-amd64 + path: ./nitro + + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.tar.gz + asset_content_type: application/gzip + + # macOS-amd64-vulkan-build: + # runs-on: macos-latest + # needs: [create-draft-release, set-nitro-version] + # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + # permissions: + # contents: write + # steps: + # - name: Clone + # id: checkout + # uses: actions/checkout@v3 + # with: + # submodules: recursive + + # - name: Dependencies + # id: depends + # continue-on-error: true + # run: | + # brew update + # brew install sdl2 + + # - name: Prepare Vulkan SDK + # uses: humbletim/setup-vulkan-sdk@v1.2.0 + # with: + # vulkan-query-version: 1.3.204.0 + # vulkan-components: Vulkan-Headers, Vulkan-Loader + # vulkan-use-cache: true + + # - name: Build + # id: cmake_build + # run: | + # ./install_deps.sh + # mkdir build && cd build + # cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_VULKAN=ON -DLLAMA_METAL=OFF .. + # CC=gcc-8 make -j $(sysctl -n hw.ncp) + # ls -la + + # - name: Package + # shell: bash + # run: | + # mkdir -p nitro + # cp build/nitro nitro/ + # tar -czvf nitro.tar.gz nitro + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + # with: + # name: nitro-mac-amd64 + # path: ./nitro + + # - name: Run e2e testing - LLama.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + # rm -rf uploads/ + + # - name: Run e2e testing - Whisper.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # 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 }} + # rm -rf uploads/ + + # - uses: actions/upload-release-asset@v1.0.1 + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + # asset_path: ./nitro.tar.gz + # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64-vulkan.tar.gz + # asset_content_type: application/gzip + + windows-amd64-build: + runs-on: windows-latest + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + + steps: + - name: Clone + + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup VSWhere.exe + uses: warrenbuckley/Setup-VSWhere@v1 + with: + version: latest + silent: true + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: Fetch SDL2 and set SDL2_DIR version 2.28.5 + run: | + C:/msys64/usr/bin/wget.exe -qO sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip + 7z x sdl2.zip + echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-2.28.5/cmake" >> $env:GITHUB_ENV + + - name: actions-setup-cmake + uses: jwlawson/actions-setup-cmake@v1.14.1 + + - name: Build + id: cmake_build + shell: cmd + run: | + cmake -S ./nitro_deps -B ./build_deps/nitro_deps + cmake --build ./build_deps/nitro_deps --config Release + mkdir -p build + cd build + cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DWHISPER_SDL2=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} + cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" + + - name: Pack artifacts + id: pack_artifacts + shell: cmd + run: | + robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll + robocopy build\bin\Release\ .\build\Release\ llama.dll + robocopy build\bin\Release\ .\build\Release\ whisper.dll + robocopy .github\patches\windows\ .\build\Release\ msvcp140.dll + robocopy .github\patches\windows\ .\build\Release\ vcruntime140_1.dll + robocopy .github\patches\windows\ .\build\Release\ vcruntime140.dll + robocopy "$env:SDL2_DIR\..\lib\2.28.5\" .\build\Release\ SDL2.dll + dotnet tool install --global AzureSignTool + azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" + 7z a -ttar temp.tar .\build\Release\* + 7z a -tgzip nitro.tar.gz temp.tar + + - name: Run e2e testing - Llama.cpp + shell: cmd + run: | + cd build\Release + ..\..\.github\scripts\e2e-test-llama-windows.bat nitro.exe ${{ env.LLM_MODEL_URL }} + rmdir /S /Q .\build\Release\uploads + + - name: Run e2e testing - Whisper.cpp + shell: cmd + run: | + cd build\Release + ..\..\.github\scripts\e2e-test-whisper-windows.bat nitro.exe ${{ env.WHISPER_MODEL_URL }} + rmdir /S /Q .\build\Release\uploads + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-win-amd64 + path: ./build/Release + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64.tar.gz + asset_content_type: application/gzip + + windows-amd64-vulkan-build: + runs-on: windows-latest + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + + steps: + - name: Clone + + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup VSWhere.exe + uses: warrenbuckley/Setup-VSWhere@v1 + with: + version: latest + silent: true + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: Fetch SDL2 and set SDL2_DIR version 2.28.5 + run: | + C:/msys64/usr/bin/wget.exe -qO sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip + 7z x sdl2.zip + echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-2.28.5/cmake" >> $env:GITHUB_ENV + + - name: actions-setup-cmake + uses: jwlawson/actions-setup-cmake@v1.14.1 + + - name: Prepare Vulkan SDK + uses: humbletim/setup-vulkan-sdk@v1.2.0 + with: + vulkan-query-version: 1.3.275.0 + vulkan-components: Vulkan-Headers, Vulkan-Loader + vulkan-use-cache: true + + - name: Build + id: cmake_build + shell: cmd + run: | + cmake -S ./nitro_deps -B ./build_deps/nitro_deps + cmake --build ./build_deps/nitro_deps --config Release + mkdir -p build + cd build + cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DWHISPER_SDL2=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} + cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" + + - name: Pack artifacts + id: pack_artifacts + shell: cmd + run: | + robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll + robocopy build\bin\Release\ .\build\Release\ llama.dll + robocopy build\bin\Release\ .\build\Release\ whisper.dll + robocopy .github\patches\windows\ .\build\Release\ msvcp140.dll + robocopy .github\patches\windows\ .\build\Release\ vcruntime140_1.dll + robocopy .github\patches\windows\ .\build\Release\ vcruntime140.dll + robocopy "$env:SDL2_DIR\..\lib\2.28.5\" .\build\Release\ SDL2.dll + dotnet tool install --global AzureSignTool + azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" + 7z a -ttar temp.tar .\build\Release\* + 7z a -tgzip nitro.tar.gz temp.tar + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-win-amd64-vulkan + path: ./build/Release + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-vulkan.tar.gz + asset_content_type: application/gzip + + windows-amd64-cuda-build: + runs-on: windows-cuda-${{ matrix.cuda }} + needs: [create-draft-release, set-nitro-version] + if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' + permissions: + contents: write + + strategy: + matrix: + cuda: ["12-0", "11-7"] + + steps: + - name: Setup VSWhere.exe + uses: warrenbuckley/Setup-VSWhere@v1 + with: + version: latest + silent: true + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: Fetch SDL2 and set SDL2_DIR version 2.28.5 + run: | + curl -L -o sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip + 7z x sdl2.zip + echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-2.28.5/cmake" >> $env:GITHUB_ENV + + - name: actions-setup-cmake + uses: jwlawson/actions-setup-cmake@v1.14.1 + + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup VSWhere.exe + uses: warrenbuckley/Setup-VSWhere@v1 + with: + version: latest + silent: true + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: "6.0.x" + + - name: Build + id: cmake_build + shell: cmd + run: | + cmake -S ./nitro_deps -B ./build_deps/nitro_deps + cmake --build ./build_deps/nitro_deps --config Release + mkdir -p build + cd build + cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DWHISPER_SDL2=ON -DWHISPER_CUBLAS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} + cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" + + - name: Pack artifacts + id: pack_artifacts + shell: cmd + run: | + set PATH=%PATH%;C:\Program Files\7-Zip\ + robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll + robocopy build\bin\Release\ .\build\Release\ llama.dll + robocopy build\bin\Release\ .\build\Release\ whisper.dll + robocopy .github\patches\windows\ .\build\Release\ msvcp140.dll + robocopy .github\patches\windows\ .\build\Release\ vcruntime140_1.dll + robocopy .github\patches\windows\ .\build\Release\ vcruntime140.dll + robocopy "$env:SDL2_DIR\..\lib\2.28.5\" .\build\Release\ SDL2.dll + dotnet tool install --global AzureSignTool + %USERPROFILE%\.dotnet\tools\azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" + 7z a -ttar temp.tar .\build\Release\* + 7z a -tgzip nitro.tar.gz temp.tar + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + with: + name: nitro-win-amd64-cuda-${{ matrix.cuda }} + path: ./build/Release + + - uses: actions/upload-release-asset@v1.0.1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-draft-release.outputs.upload_url }} + asset_path: ./nitro.tar.gz + asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-cuda-${{ matrix.cuda }}.tar.gz + asset_content_type: application/gzip + + update_release_draft: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + needs: [ + ubuntu-amd64-build, + ubuntu-amd64-cuda-build, + macOS-silicon-build, + macOS-amd64-build, + windows-amd64-build, + windows-amd64-cuda-build, + # macOS-amd64-vulkan-build, + ubuntu-amd64-vulkan-build, + windows-amd64-vulkan-build, + ] + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + noti-discord-nightly: + if: always() && github.event_name == 'schedule' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' + needs: [ + create-draft-release, + ubuntu-amd64-build, + ubuntu-amd64-cuda-build, + macOS-silicon-build, + macOS-amd64-build, + windows-amd64-build, + windows-amd64-cuda-build, + # macOS-amd64-vulkan-build, + ubuntu-amd64-vulkan-build, + windows-amd64-vulkan-build, + ] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: "0" + token: ${{ secrets.PAT_SERVICE_ACCOUNT }} + - name: Notify Discord + uses: Ilshidur/action-discord@master + with: + args: "Nightly build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + - name: Update README.md with artifact URL + run: | + sed -i "s|||" README.md + git config --global user.email "service@jan.ai" + git config --global user.name "Service Account" + git add README.md + git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" + git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main + env: + GITHUB_RUN_ID: ${{ github.run_id }} + + noti-discord-manual: + if: always() && github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' + needs: [ + create-draft-release, + ubuntu-amd64-build, + ubuntu-amd64-cuda-build, + macOS-silicon-build, + macOS-amd64-build, + windows-amd64-build, + windows-amd64-cuda-build, + # macOS-amd64-vulkan-build, + ubuntu-amd64-vulkan-build, + windows-amd64-vulkan-build, + ] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: "0" + token: ${{ secrets.PAT_SERVICE_ACCOUNT }} + - name: Notify Discord + uses: Ilshidur/action-discord@master + with: + args: "Manual build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + # Update README.md with artifact URL if manual build from main branch + - name: Update README.md with artifact URL + if: github.ref == 'refs/heads/main' + run: | + sed -i "s|||" README.md + git config --global user.email "service@jan.ai" + git config --global user.name "Service Account" + git add README.md + git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" + git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main + env: + GITHUB_RUN_ID: ${{ github.run_id }} From bd2d3e410cf55066ceecbf5e05b6f187fa0b3419 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 02:13:48 +0700 Subject: [PATCH 3/8] e2e testing script change from wget to curl --- .github/scripts/e2e-test-llama-linux-and-mac.sh | 2 +- .github/scripts/e2e-test-whisper-linux-and-mac.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/e2e-test-llama-linux-and-mac.sh b/.github/scripts/e2e-test-llama-linux-and-mac.sh index d7f1b5ab8..021ee4a8a 100644 --- a/.github/scripts/e2e-test-llama-linux-and-mac.sh +++ b/.github/scripts/e2e-test-llama-linux-and-mac.sh @@ -37,7 +37,7 @@ sleep 5 # Check if /tmp/testllm exists, if not, download it if [[ ! -f "/tmp/testllm" ]]; then - wget $DOWNLOAD_URL -O /tmp/testllm + curl $DOWNLOAD_URL --output /tmp/testllm fi # Run the curl commands diff --git a/.github/scripts/e2e-test-whisper-linux-and-mac.sh b/.github/scripts/e2e-test-whisper-linux-and-mac.sh index 90421dff3..ccf55d417 100755 --- a/.github/scripts/e2e-test-whisper-linux-and-mac.sh +++ b/.github/scripts/e2e-test-whisper-linux-and-mac.sh @@ -37,7 +37,7 @@ sleep 5 # Check if /tmp/testwhisper exists, if not, download it if [[ ! -f "/tmp/testwhisper" ]]; then - wget $DOWNLOAD_URL -O /tmp/testwhisper + curl $DOWNLOAD_URL --output /tmp/testwhisper fi # Run the curl commands From 7af74716695b4dd9279cbd1050de72d6890f7d5c Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 02:35:44 +0700 Subject: [PATCH 4/8] Disable e2e testing for ubuntu cuda 11.7 and ubuntu cpu --- .github/workflows/build.yml | 60 ++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cdb2d5ef..28b8bae32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,21 +159,21 @@ jobs: name: nitro-linux-amd64 path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ + # - name: Run e2e testing - LLama.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + # rm -rf uploads/ + + # - name: Run e2e testing - Whisper.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # 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 }} + # rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -284,21 +284,21 @@ jobs: name: nitro-linux-amd64-cuda-${{ matrix.cuda }} path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ + # - name: Run e2e testing - LLama.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + # rm -rf uploads/ + + # - name: Run e2e testing - Whisper.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # 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 }} + # rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') From 156f05e977d09a7d088294c65185ed97a9fe61a8 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 02:41:52 +0700 Subject: [PATCH 5/8] Re-enable e2e testing --- .github/workflows/build.yml | 60 ++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28b8bae32..1cdb2d5ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,21 +159,21 @@ jobs: name: nitro-linux-amd64 path: ./nitro - # - name: Run e2e testing - LLama.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - # rm -rf uploads/ - - # - name: Run e2e testing - Whisper.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # 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 }} - # rm -rf uploads/ + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') @@ -284,21 +284,21 @@ jobs: name: nitro-linux-amd64-cuda-${{ matrix.cuda }} path: ./nitro - # - name: Run e2e testing - LLama.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - # rm -rf uploads/ - - # - name: Run e2e testing - Whisper.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # 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 }} - # rm -rf uploads/ + - name: Run e2e testing - LLama.CPP + shell: bash + run: | + # run e2e testing + cd nitro + chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + rm -rf uploads/ + + - name: Run e2e testing - Whisper.CPP + shell: bash + run: | + # run e2e testing + cd nitro + 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 }} + rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') From 3939beb186793341d7e15a0d9ec89c8c164d1097 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 02:53:12 +0700 Subject: [PATCH 6/8] Enable log for e2e testing command --- .github/scripts/e2e-test-llama-linux-and-mac.sh | 6 +++--- .github/scripts/e2e-test-whisper-linux-and-mac.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/scripts/e2e-test-llama-linux-and-mac.sh b/.github/scripts/e2e-test-llama-linux-and-mac.sh index 021ee4a8a..ac7a00b68 100644 --- a/.github/scripts/e2e-test-llama-linux-and-mac.sh +++ b/.github/scripts/e2e-test-llama-linux-and-mac.sh @@ -21,7 +21,7 @@ range=$((max - min + 1)) PORT=$((RANDOM % range + min)) # Start the binary file -"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log 2>&1 & +"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log & # Get the process id of the binary file pid=$! @@ -48,7 +48,7 @@ response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://1 "ctx_len": 50, "ngl": 32, "embedding": false -}' 2>&1) +}') response2=$( curl -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \ @@ -67,7 +67,7 @@ response2=$( "frequency_penalty": 0, "presence_penalty": 0, "temperature": 0.1 - }' 2>&1 + }' ) error_occurred=0 diff --git a/.github/scripts/e2e-test-whisper-linux-and-mac.sh b/.github/scripts/e2e-test-whisper-linux-and-mac.sh index ccf55d417..b4f6e8e09 100755 --- a/.github/scripts/e2e-test-whisper-linux-and-mac.sh +++ b/.github/scripts/e2e-test-whisper-linux-and-mac.sh @@ -21,7 +21,7 @@ range=$((max - min + 1)) PORT=$((RANDOM % range + min)) # Start the binary file -"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log 2>&1 & +"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log & # Get the process id of the binary file pid=$! @@ -46,7 +46,7 @@ response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://1 --data '{ "model_path": "/tmp/testwhisper", "model_id": "whisper.cpp" -}' 2>&1) +}') response2=$( curl -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/transcriptions" \ @@ -55,7 +55,7 @@ response2=$( --form 'model_id="whisper.cpp"' \ --form 'temperature="0.0"' \ --form 'prompt="The transcript is about OpenAI which makes technology like DALLĀ·E, GPT-3, and ChatGPT with the hope of one day building an AGI system that benefits all of humanity. The president is trying to raly people to support the cause."' \ - 2>&1 + ) error_occurred=0 From 30270193e64ed9e687baee1d548f925db6b646f6 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 03:03:34 +0700 Subject: [PATCH 7/8] Disable e2e testing for cuda since there is no real device, add timeout for curl command and exit 1 if load model crashes nitro --- .../scripts/e2e-test-llama-linux-and-mac.sh | 10 +++++-- .github/workflows/build.yml | 30 +++++++++---------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/scripts/e2e-test-llama-linux-and-mac.sh b/.github/scripts/e2e-test-llama-linux-and-mac.sh index ac7a00b68..7ea7bf44c 100644 --- a/.github/scripts/e2e-test-llama-linux-and-mac.sh +++ b/.github/scripts/e2e-test-llama-linux-and-mac.sh @@ -41,7 +41,7 @@ if [[ ! -f "/tmp/testllm" ]]; then fi # Run the curl commands -response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/inferences/llamacpp/loadModel" \ +response1=$(curl --connect-timeout 60 -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/inferences/llamacpp/loadModel" \ --header 'Content-Type: application/json' \ --data '{ "llama_model_path": "/tmp/testllm", @@ -50,8 +50,14 @@ response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://1 "embedding": false }') +if ! ps -p $pid >/dev/null; then + echo "nitro failed to load model. Logs:" + cat /tmp/nitro.log + exit 1 +fi + response2=$( - curl -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \ + curl --connect-timeout -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \ --header 'Content-Type: application/json' \ --header 'Accept: text/event-stream' \ --header 'Access-Control-Allow-Origin: *' \ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cdb2d5ef..be924d3d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -284,21 +284,21 @@ jobs: name: nitro-linux-amd64-cuda-${{ matrix.cuda }} path: ./nitro - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ + # - name: Run e2e testing - LLama.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} + # rm -rf uploads/ + + # - name: Run e2e testing - Whisper.CPP + # shell: bash + # run: | + # # run e2e testing + # cd nitro + # 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 }} + # rm -rf uploads/ - uses: actions/upload-release-asset@v1.0.1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') From d7d77829c6b930a703124ce1453bc6c2a34723b3 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Mar 2024 08:12:37 +0700 Subject: [PATCH 8/8] Add timeout for curl command --- .../scripts/e2e-test-llama-linux-and-mac.sh | 4 +- .github/scripts/e2e-test-llama-windows.bat | 2 +- .../scripts/e2e-test-whisper-linux-and-mac.sh | 6 +- .github/scripts/e2e-test-whisper-windows.bat | 6 +- temp.yaml | 921 ------------------ 5 files changed, 9 insertions(+), 930 deletions(-) delete mode 100644 temp.yaml diff --git a/.github/scripts/e2e-test-llama-linux-and-mac.sh b/.github/scripts/e2e-test-llama-linux-and-mac.sh index 7ea7bf44c..e97c51f63 100644 --- a/.github/scripts/e2e-test-llama-linux-and-mac.sh +++ b/.github/scripts/e2e-test-llama-linux-and-mac.sh @@ -37,7 +37,7 @@ sleep 5 # Check if /tmp/testllm exists, if not, download it if [[ ! -f "/tmp/testllm" ]]; then - curl $DOWNLOAD_URL --output /tmp/testllm + curl --connect-timeout 300 $DOWNLOAD_URL --output /tmp/testllm fi # Run the curl commands @@ -57,7 +57,7 @@ if ! ps -p $pid >/dev/null; then fi response2=$( - curl --connect-timeout -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \ + curl --connect-timeout 60 -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \ --header 'Content-Type: application/json' \ --header 'Accept: text/event-stream' \ --header 'Access-Control-Allow-Origin: *' \ diff --git a/.github/scripts/e2e-test-llama-windows.bat b/.github/scripts/e2e-test-llama-windows.bat index 7de9c5b67..a6526f358 100644 --- a/.github/scripts/e2e-test-llama-windows.bat +++ b/.github/scripts/e2e-test-llama-windows.bat @@ -47,7 +47,7 @@ rem Wait for a few seconds to let the server start rem Check if %TEMP%\testmodel exists, if not, download it if not exist "%MODEL_PATH%" ( - bitsadmin.exe /transfer "DownloadTestModel" %DOWNLOAD_URL% "%MODEL_PATH%" + curl.exe --connect-timeout 300 %DOWNLOAD_URL% --output "%MODEL_PATH%" ) rem Define JSON strings for curl data diff --git a/.github/scripts/e2e-test-whisper-linux-and-mac.sh b/.github/scripts/e2e-test-whisper-linux-and-mac.sh index b4f6e8e09..4c8a1e9eb 100755 --- a/.github/scripts/e2e-test-whisper-linux-and-mac.sh +++ b/.github/scripts/e2e-test-whisper-linux-and-mac.sh @@ -37,11 +37,11 @@ sleep 5 # Check if /tmp/testwhisper exists, if not, download it if [[ ! -f "/tmp/testwhisper" ]]; then - curl $DOWNLOAD_URL --output /tmp/testwhisper + curl --connect-timeout 300 $DOWNLOAD_URL --output /tmp/testwhisper fi # Run the curl commands -response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/load_model" \ +response1=$(curl --connect-timeout 60 -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/load_model" \ --header 'Content-Type: application/json' \ --data '{ "model_path": "/tmp/testwhisper", @@ -49,7 +49,7 @@ response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://1 }') response2=$( - curl -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/transcriptions" \ + curl --connect-timeout 60 -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/transcriptions" \ --header 'Access-Control-Allow-Origin: *' \ --form 'file=@"../whisper.cpp/samples/jfk.wav"' \ --form 'model_id="whisper.cpp"' \ diff --git a/.github/scripts/e2e-test-whisper-windows.bat b/.github/scripts/e2e-test-whisper-windows.bat index a47b0e004..6eb2037ea 100644 --- a/.github/scripts/e2e-test-whisper-windows.bat +++ b/.github/scripts/e2e-test-whisper-windows.bat @@ -47,7 +47,7 @@ rem Wait for a few seconds to let the server start rem Check if %TEMP%\testwhisper exists, if not, download it if not exist "%MODEL_PATH%" ( - bitsadmin.exe /transfer "DownloadTestModel" %DOWNLOAD_URL% "%MODEL_PATH%" + curl.exe --connect-timeout 300 %DOWNLOAD_URL% --output "%MODEL_PATH%" ) rem Define JSON strings for curl data @@ -55,9 +55,9 @@ call set "MODEL_PATH_STRING=%%MODEL_PATH:\=\\%%" set "curl_data1={\"model_path\":\"%MODEL_PATH_STRING%\",\"model_id\":\"whisper\"}" rem Run the curl commands and capture the status code -curl.exe -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1 +curl.exe --connect-timeout 60 -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1 -curl -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://localhost:%PORT%/v1/audio/transcriptions" ^ +curl --connect-timeout 60 -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://localhost:%PORT%/v1/audio/transcriptions" ^ --form "file=@../..//whisper.cpp/samples/jfk.wav" ^ --form "model_id=whisper" > %TEMP%\response2_code.log 2>&1 diff --git a/temp.yaml b/temp.yaml deleted file mode 100644 index 8e9e3ef55..000000000 --- a/temp.yaml +++ /dev/null @@ -1,921 +0,0 @@ -name: CI - -on: - schedule: - - cron: "0 20 * * *" # At 8 PM UTC, which is 3 AM UTC+7 - push: - branches: - - main - tags: ["v[0-9]+.[0-9]+.[0-9]+"] - paths: - [ - ".github/scripts/**", - ".github/workflows/build.yml", - "**/CMakeLists.txt", - "**/Makefile", - "**/*.h", - "**/*.hpp", - "**/*.c", - "**/*.cpp", - "**/*.cu", - "**/*.cc", - "**/*.cxx", - "llama.cpp", - "!docs/**", - "!.gitignore", - "!README.md", - ] - pull_request: - types: [opened, synchronize, reopened] - paths: - [ - ".github/scripts/**", - ".github/workflows/build.yml", - "**/CMakeLists.txt", - "**/Makefile", - "**/*.h", - "**/*.hpp", - "**/*.c", - "**/*.cpp", - "**/*.cu", - "**/*.cc", - "**/*.cxx", - "llama.cpp", - "!docs/**", - "!.gitignore", - "!README.md", - ] - workflow_dispatch: - -env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - LLM_MODEL_URL: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF/resolve/main/tinyllama-1.1b-chat-v0.3.Q2_K.gguf - WHISPER_MODEL_URL: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-q5_1.bin - -jobs: - create-draft-release: - runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} - version: ${{ steps.get_version.outputs.version }} - permissions: - contents: write - steps: - - name: Extract tag name without v prefix - id: get_version - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" - env: - GITHUB_REF: ${{ github.ref }} - - name: Create Draft Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: "${{ env.VERSION }}" - draft: true - prerelease: false - - # Get the latest version of the release - set-nitro-version: - runs-on: ubuntu-latest - outputs: - version: ${{ steps.version_update.outputs.new_version }} - steps: - - name: Get latest release - id: version_update - run: | - ldd --version - if [[ ${{ github.event_name }} == push && ${{ github.ref }} == refs/tags/* ]]; then - echo "VERSION=${GITHUB_REF#refs/tags/}" - NEW_VERSION="${VERSION#v}" - echo "::set-output name=new_version::$NEW_VERSION" - else - # Function to get the latest release tag - get_latest_tag() { - local retries=0 - local max_retries=3 - local tag - while [ $retries -lt $max_retries ]; do - tag=$(curl -s https://api.github.com/repos/janhq/nitro/releases/latest | jq -r .tag_name) - if [ -n "$tag" ] && [ "$tag" != "null" ]; then - echo $tag - return - else - let retries++ - sleep 2 - fi - done - echo "Failed to fetch latest tag after $max_retries attempts." - exit 1 - } - # Get the latest release tag from GitHub API - LATEST_TAG=$(get_latest_tag) - - # Remove the 'v' and append the build number to the version - NEW_VERSION="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}" - echo "New version: $NEW_VERSION" - echo "::set-output name=new_version::$NEW_VERSION" - fi - echo "Version: $NEW_VERSION" - - ubuntu-amd64-build: - runs-on: ubuntu-18-04-cuda-11-7 - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Build - id: make_build - run: | - ldd --version - ./install_deps.sh - mkdir build && cd build - cmake -DLLAMA_NATIVE=OFF -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - make -j $(nproc) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-linux-amd64 - path: ./nitro - - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64.tar.gz - asset_content_type: application/gzip - - ubuntu-amd64-vulkan-build: - runs-on: ubuntu-18-04-cuda-11-7 - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install pkg-config - run: sudo apt-get install -y pkg-config - - - name: Prepare Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.0 - with: - vulkan-query-version: 1.3.275.0 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - - name: Build - id: make_build - run: | - ldd --version - ./install_deps.sh - mkdir build && cd build - cmake -DLLAMA_NATIVE=OFF -DLLAMA_VULKAN=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - make -j $(nproc) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-linux-amd64-vulkan - path: ./nitro - - # - name: Run e2e testing - LLama.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - # rm -rf uploads/ - - # - name: Run e2e testing - Whisper.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # 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 }} - # rm -rf uploads/ - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-vulkan.tar.gz - asset_content_type: application/gzip - - ubuntu-amd64-cuda-build: - runs-on: ubuntu-18-04-cuda-${{ matrix.cuda }} - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - strategy: - matrix: - cuda: ["12-0", "11-7"] - - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Build - id: make_build - run: | - ./install_deps.sh - mkdir build && cd build - cmake -DLLAMA_NATIVE=OFF -DLLAMA_CUBLAS=ON -DLLAMA_CUBLAS=ON -DWHISPER_CUBLAS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - make -j $(nproc) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-linux-amd64-cuda-${{ matrix.cuda }} - path: ./nitro - - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-linux-amd64-cuda-${{ matrix.cuda }}.tar.gz - asset_content_type: application/gzip - - macOS-silicon-build: - runs-on: mac-silicon - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Dependencies - id: depends - continue-on-error: true - run: | - brew update - brew install cmake sdl2 - - - name: Build - id: cmake_build - run: | - ./install_deps.sh - mkdir build && cd build - cmake -DWHISPER_COREML=1 -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. - CC=gcc-8 make -j $(sysctl -n hw.ncpu) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp llama.cpp/ggml-metal.metal nitro/ - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-mac-arm64 - path: ./nitro - - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro/ - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # To test with CoreML - if [[ ! -f "/tmp/testwhisper-encoder.mlmodelc" ]]; then - wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny-encoder.mlmodelc.zip - unzip ggml-tiny-encoder.mlmodelc.zip - rm ggml-tiny-encoder.mlmodelc.zip - rm -rf /tmp/testwhisper-encoder.mlmodelc - mv ggml-tiny-encoder.mlmodelc /tmp/testwhisper-encoder.mlmodelc - fi - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-arm64.tar.gz - asset_content_type: application/gzip - - macOS-amd64-build: - runs-on: macos-latest - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Dependencies - id: depends - continue-on-error: true - run: | - brew update - brew install sdl2 - - - name: Build - id: cmake_build - run: | - ./install_deps.sh - mkdir build && cd build - cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_METAL=OFF .. - CC=gcc-8 make -j $(sysctl -n hw.ncp) - ls -la - - - name: Package - shell: bash - run: | - mkdir -p nitro - cp build/nitro nitro/ - tar -czvf nitro.tar.gz nitro - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-mac-amd64 - path: ./nitro - - - name: Run e2e testing - LLama.CPP - shell: bash - run: | - # run e2e testing - cd nitro - chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - rm -rf uploads/ - - - name: Run e2e testing - Whisper.CPP - shell: bash - run: | - # run e2e testing - cd nitro - 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 }} - rm -rf uploads/ - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64.tar.gz - asset_content_type: application/gzip - - # macOS-amd64-vulkan-build: - # runs-on: macos-latest - # needs: [create-draft-release, set-nitro-version] - # if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - # permissions: - # contents: write - # steps: - # - name: Clone - # id: checkout - # uses: actions/checkout@v3 - # with: - # submodules: recursive - - # - name: Dependencies - # id: depends - # continue-on-error: true - # run: | - # brew update - # brew install sdl2 - - # - name: Prepare Vulkan SDK - # uses: humbletim/setup-vulkan-sdk@v1.2.0 - # with: - # vulkan-query-version: 1.3.204.0 - # vulkan-components: Vulkan-Headers, Vulkan-Loader - # vulkan-use-cache: true - - # - name: Build - # id: cmake_build - # run: | - # ./install_deps.sh - # mkdir build && cd build - # cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} -DLLAMA_VULKAN=ON -DLLAMA_METAL=OFF .. - # CC=gcc-8 make -j $(sysctl -n hw.ncp) - # ls -la - - # - name: Package - # shell: bash - # run: | - # mkdir -p nitro - # cp build/nitro nitro/ - # tar -czvf nitro.tar.gz nitro - - # - name: Upload Artifact - # uses: actions/upload-artifact@v2 - # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - # with: - # name: nitro-mac-amd64 - # path: ./nitro - - # - name: Run e2e testing - LLama.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # chmod +x ../.github/scripts/e2e-test-llama-linux-and-mac.sh && ../.github/scripts/e2e-test-llama-linux-and-mac.sh ./nitro ${{ env.LLM_MODEL_URL }} - # rm -rf uploads/ - - # - name: Run e2e testing - Whisper.CPP - # shell: bash - # run: | - # # run e2e testing - # cd nitro - # 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 }} - # rm -rf uploads/ - - # - uses: actions/upload-release-asset@v1.0.1 - # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - # asset_path: ./nitro.tar.gz - # asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-mac-amd64-vulkan.tar.gz - # asset_content_type: application/gzip - - windows-amd64-build: - runs-on: windows-latest - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - - steps: - - name: Clone - - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 - - - name: Fetch SDL2 and set SDL2_DIR version 2.28.5 - run: | - C:/msys64/usr/bin/wget.exe -qO sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip - 7z x sdl2.zip - echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-2.28.5/cmake" >> $env:GITHUB_ENV - - - name: actions-setup-cmake - uses: jwlawson/actions-setup-cmake@v1.14.1 - - - name: Build - id: cmake_build - shell: cmd - run: | - cmake -S ./nitro_deps -B ./build_deps/nitro_deps - cmake --build ./build_deps/nitro_deps --config Release - mkdir -p build - cd build - cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DWHISPER_SDL2=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} - cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - - - name: Pack artifacts - id: pack_artifacts - shell: cmd - run: | - robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll - robocopy build\bin\Release\ .\build\Release\ llama.dll - robocopy build\bin\Release\ .\build\Release\ whisper.dll - robocopy .github\patches\windows\ .\build\Release\ msvcp140.dll - robocopy .github\patches\windows\ .\build\Release\ vcruntime140_1.dll - robocopy .github\patches\windows\ .\build\Release\ vcruntime140.dll - robocopy "$env:SDL2_DIR\..\lib\2.28.5\" .\build\Release\ SDL2.dll - dotnet tool install --global AzureSignTool - azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" - 7z a -ttar temp.tar .\build\Release\* - 7z a -tgzip nitro.tar.gz temp.tar - - - name: Run e2e testing - Llama.cpp - shell: cmd - run: | - cd build\Release - ..\..\.github\scripts\e2e-test-llama-windows.bat nitro.exe ${{ env.LLM_MODEL_URL }} - rmdir /S /Q .\build\Release\uploads - - - name: Run e2e testing - Whisper.cpp - shell: cmd - run: | - cd build\Release - ..\..\.github\scripts\e2e-test-whisper-windows.bat nitro.exe ${{ env.WHISPER_MODEL_URL }} - rmdir /S /Q .\build\Release\uploads - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-win-amd64 - path: ./build/Release - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64.tar.gz - asset_content_type: application/gzip - - windows-amd64-vulkan-build: - runs-on: windows-latest - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - - steps: - - name: Clone - - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 - - - name: Fetch SDL2 and set SDL2_DIR version 2.28.5 - run: | - C:/msys64/usr/bin/wget.exe -qO sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip - 7z x sdl2.zip - echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-2.28.5/cmake" >> $env:GITHUB_ENV - - - name: actions-setup-cmake - uses: jwlawson/actions-setup-cmake@v1.14.1 - - - name: Prepare Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.0 - with: - vulkan-query-version: 1.3.275.0 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - - name: Build - id: cmake_build - shell: cmd - run: | - cmake -S ./nitro_deps -B ./build_deps/nitro_deps - cmake --build ./build_deps/nitro_deps --config Release - mkdir -p build - cd build - cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DWHISPER_SDL2=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} - cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - - - name: Pack artifacts - id: pack_artifacts - shell: cmd - run: | - robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll - robocopy build\bin\Release\ .\build\Release\ llama.dll - robocopy build\bin\Release\ .\build\Release\ whisper.dll - robocopy .github\patches\windows\ .\build\Release\ msvcp140.dll - robocopy .github\patches\windows\ .\build\Release\ vcruntime140_1.dll - robocopy .github\patches\windows\ .\build\Release\ vcruntime140.dll - robocopy "$env:SDL2_DIR\..\lib\2.28.5\" .\build\Release\ SDL2.dll - dotnet tool install --global AzureSignTool - azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" - 7z a -ttar temp.tar .\build\Release\* - 7z a -tgzip nitro.tar.gz temp.tar - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-win-amd64-vulkan - path: ./build/Release - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-vulkan.tar.gz - asset_content_type: application/gzip - - windows-amd64-cuda-build: - runs-on: windows-cuda-${{ matrix.cuda }} - needs: [create-draft-release, set-nitro-version] - if: always() && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.set-nitro-version.result == 'success' - permissions: - contents: write - - strategy: - matrix: - cuda: ["12-0", "11-7"] - - steps: - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 - - - name: Fetch SDL2 and set SDL2_DIR version 2.28.5 - run: | - curl -L -o sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip - 7z x sdl2.zip - echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-2.28.5/cmake" >> $env:GITHUB_ENV - - - name: actions-setup-cmake - uses: jwlawson/actions-setup-cmake@v1.14.1 - - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup VSWhere.exe - uses: warrenbuckley/Setup-VSWhere@v1 - with: - version: latest - silent: true - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: "6.0.x" - - - name: Build - id: cmake_build - shell: cmd - run: | - cmake -S ./nitro_deps -B ./build_deps/nitro_deps - cmake --build ./build_deps/nitro_deps --config Release - mkdir -p build - cd build - cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DWHISPER_SDL2=ON -DWHISPER_CUBLAS=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} - cmake --build . --config Release -j "%NUMBER_OF_PROCESSORS%" - - - name: Pack artifacts - id: pack_artifacts - shell: cmd - run: | - set PATH=%PATH%;C:\Program Files\7-Zip\ - robocopy build_deps\_install\bin\ .\build\Release\ zlib.dll - robocopy build\bin\Release\ .\build\Release\ llama.dll - robocopy build\bin\Release\ .\build\Release\ whisper.dll - robocopy .github\patches\windows\ .\build\Release\ msvcp140.dll - robocopy .github\patches\windows\ .\build\Release\ vcruntime140_1.dll - robocopy .github\patches\windows\ .\build\Release\ vcruntime140.dll - robocopy "$env:SDL2_DIR\..\lib\2.28.5\" .\build\Release\ SDL2.dll - dotnet tool install --global AzureSignTool - %USERPROFILE%\.dotnet\tools\azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\build\Release\nitro.exe" - 7z a -ttar temp.tar .\build\Release\* - 7z a -tgzip nitro.tar.gz temp.tar - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' - with: - name: nitro-win-amd64-cuda-${{ matrix.cuda }} - path: ./build/Release - - - uses: actions/upload-release-asset@v1.0.1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-draft-release.outputs.upload_url }} - asset_path: ./nitro.tar.gz - asset_name: nitro-${{ needs.create-draft-release.outputs.version }}-win-amd64-cuda-${{ matrix.cuda }}.tar.gz - asset_content_type: application/gzip - - update_release_draft: - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - needs: [ - ubuntu-amd64-build, - ubuntu-amd64-cuda-build, - macOS-silicon-build, - macOS-amd64-build, - windows-amd64-build, - windows-amd64-cuda-build, - # macOS-amd64-vulkan-build, - ubuntu-amd64-vulkan-build, - windows-amd64-vulkan-build, - ] - permissions: - contents: write - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - noti-discord-nightly: - if: always() && github.event_name == 'schedule' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' - needs: [ - create-draft-release, - ubuntu-amd64-build, - ubuntu-amd64-cuda-build, - macOS-silicon-build, - macOS-amd64-build, - windows-amd64-build, - windows-amd64-cuda-build, - # macOS-amd64-vulkan-build, - ubuntu-amd64-vulkan-build, - windows-amd64-vulkan-build, - ] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: "0" - token: ${{ secrets.PAT_SERVICE_ACCOUNT }} - - name: Notify Discord - uses: Ilshidur/action-discord@master - with: - args: "Nightly build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - - name: Update README.md with artifact URL - run: | - sed -i "s|||" README.md - git config --global user.email "service@jan.ai" - git config --global user.name "Service Account" - git add README.md - git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" - git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main - env: - GITHUB_RUN_ID: ${{ github.run_id }} - - noti-discord-manual: - if: always() && github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-silicon-build.result == 'success' && needs.macOS-amd64-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' - needs: [ - create-draft-release, - ubuntu-amd64-build, - ubuntu-amd64-cuda-build, - macOS-silicon-build, - macOS-amd64-build, - windows-amd64-build, - windows-amd64-cuda-build, - # macOS-amd64-vulkan-build, - ubuntu-amd64-vulkan-build, - windows-amd64-vulkan-build, - ] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: "0" - token: ${{ secrets.PAT_SERVICE_ACCOUNT }} - - name: Notify Discord - uses: Ilshidur/action-discord@master - with: - args: "Manual build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - # Update README.md with artifact URL if manual build from main branch - - name: Update README.md with artifact URL - if: github.ref == 'refs/heads/main' - run: | - sed -i "s|||" README.md - git config --global user.email "service@jan.ai" - git config --global user.name "Service Account" - git add README.md - git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" - git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main - env: - GITHUB_RUN_ID: ${{ github.run_id }}