diff --git a/.github/workflows/auto-bump-llamacpp.yml b/.github/workflows/auto-bump-llamacpp.yml deleted file mode 100644 index f16185620..000000000 --- a/.github/workflows/auto-bump-llamacpp.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Auto Bump llama.cpp -on: - schedule: - - cron: '0 2 * * *' - workflow_dispatch: - -jobs: - auto-bump: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Check changes llama.cpp master HEAD and push update if any - id: git-status - run: | - cd llama.cpp/ - git fetch origin - git checkout master - git reset --hard origin/master - cd ../ - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update llama.cpp - title: "chore: Auto bump llama.cpp version" - branch: bump-llamacpp - branch-suffix: timestamp - labels: "type: chore" - reviewers: tikikun - assignees: vuonghoainam - delete-branch: true - add-paths : "llama.cpp" - base: main - diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..a6c29964f --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,106 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: + - main + tags: ["v[0-9]+.[0-9]+.[0-9]+"] + paths: + [ + ".github/scripts/**", + ".github/workflows/build.yml", + ".github/workflows/codeql-analysis.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", + ".github/workflows/codeql-analysis.yml", + "**/CMakeLists.txt", + "**/Makefile", + "**/*.h", + "**/*.hpp", + "**/*.c", + "**/*.cpp", + "**/*.cu", + "**/*.cc", + "**/*.cxx", + "llama.cpp", + "!docs/**", + "!.gitignore", + "!README.md", + ] + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["c-cpp"] + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + run: | + ./install_deps.sh + mkdir build && cd build + cmake .. + CC=gcc-8 make -j $(sysctl -n hw.ncp) + ls -la + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/controllers/health.h b/controllers/health.h index c45d92b8e..9d4a71689 100644 --- a/controllers/health.h +++ b/controllers/health.h @@ -5,11 +5,12 @@ using namespace drogon; -class health : public drogon::HttpSimpleController -{ - public: - void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function &&callback) override; - PATH_LIST_BEGIN - PATH_ADD("/healthz", Get); - PATH_LIST_END +class health : public drogon::HttpSimpleController { +public: + void asyncHandleHttpRequest( + const HttpRequestPtr &req, + std::function &&callback) override; + PATH_LIST_BEGIN + PATH_ADD("/healthz", Get); + PATH_LIST_END }; diff --git a/controllers/llamaCPP.cc b/controllers/llamaCPP.cc index 849940d01..d30fd93b5 100644 --- a/controllers/llamaCPP.cc +++ b/controllers/llamaCPP.cc @@ -13,7 +13,6 @@ using namespace inferences; using json = nlohmann::json; -// To store state of each inference request struct State { bool isStopped = false; int task_id; diff --git a/controllers/processManager.cc b/controllers/processManager.cc index 13849ac93..2874a3860 100644 --- a/controllers/processManager.cc +++ b/controllers/processManager.cc @@ -2,10 +2,10 @@ #include #include -void processManager::destroy(const HttpRequestPtr &req, - std::function &&callback) { +void processManager::destroy( + const HttpRequestPtr &req, + std::function &&callback) { LOG_INFO << "Program is exitting, goodbye!"; exit(0); return; }; -// Add definition of your processing function here diff --git a/controllers/processManager.h b/controllers/processManager.h index dcc4b47f6..7abfbe2d4 100644 --- a/controllers/processManager.h +++ b/controllers/processManager.h @@ -8,16 +8,12 @@ using namespace drogon; class processManager : public drogon::HttpController { public: METHOD_LIST_BEGIN - // use METHOD_ADD to add your custom processing function here; - // METHOD_ADD(processManager::get, "/{2}/{1}", Get); // path is - // /processManager/{arg2}/{arg1} + METHOD_ADD(processManager::destroy, "/destroy", Delete); // path is /processManager/{arg1}/{arg2}/list METHOD_LIST_END - // your declaration of processing function maybe like this: + void destroy(const HttpRequestPtr &req, std::function &&callback); - // void your_method_name(const HttpRequestPtr& req, std::function &&callback, double p1, int p2) const; };