From 3a811135eee9184a0d559542a0d477ac1f210c03 Mon Sep 17 00:00:00 2001 From: Hien To Date: Fri, 1 Dec 2023 02:08:01 +0700 Subject: [PATCH] Add nightly build ci --- .github/workflows/build.yml | 84 ++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cd93ab96..bd5b8f878 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,8 @@ name: CI on: + schedule: + - cron: '0 16 * * *' # At 4 PM UTC, which is 11 AM UTC+7 push: branches: - main @@ -9,6 +11,7 @@ on: pull_request: types: [opened, synchronize, reopened] paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cc', '**/*.cxx', '!docs/**', '!.gitignore'] + workflow_dispatch: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} @@ -74,6 +77,17 @@ jobs: 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' + with: + name: nitro-linux-amd64 + path: ./nitro + + - name: Run e2e testing + shell: bash + run: | # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} @@ -122,6 +136,17 @@ jobs: 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' + with: + name: nitro-linux-amd64-cuda + path: ./nitro + + - name: Run e2e testing + shell: bash + run: | # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} @@ -154,7 +179,7 @@ jobs: continue-on-error: true run: | brew update - brew install cmake gcc@8 + brew install cmake - name: Build id: cmake_build @@ -172,6 +197,17 @@ jobs: 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' + with: + name: nitro-mac-arm64 + path: ./nitro + + - name: Run e2e testing + shell: bash + run: | # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} @@ -220,6 +256,17 @@ jobs: 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' + with: + name: nitro-mac-amd64 + path: ./nitro + + - name: Run e2e testing + shell: bash + run: | # run e2e testing cd nitro chmod +x ../.github/scripts/e2e-test-linux-and-mac.sh && ../.github/scripts/e2e-test-linux-and-mac.sh ./nitro ${{ env.MODEL_URL }} @@ -291,6 +338,17 @@ jobs: robocopy build\bin\Release .\build\Release llama.dll 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' + with: + name: nitro-win-amd64 + path: ./nitro + + - name: Run e2e testing + shell: cmd + run: | cd .\build\Release ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} @@ -351,6 +409,17 @@ jobs: robocopy build\bin\Release .\build\Release llama.dll 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' + with: + name: nitro-win-amd64 + path: ./nitro + + - name: run e2e testing + shell: cmd + run: | cd .\build\Release ..\..\.github\scripts\e2e-test-windows.bat .\nitro.exe ${{ env.MODEL_URL }} @@ -365,6 +434,7 @@ jobs: 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-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] permissions: contents: write @@ -374,3 +444,15 @@ jobs: - uses: release-drafter/release-drafter@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + noti-discord: + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + needs: [ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] + runs-on: ubuntu-latest + steps: + - 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 }} \ No newline at end of file