From: Adam Tazi Date: Sun, 18 Jun 2023 08:15:58 +0000 (-0700) Subject: ci : introduce Github Actions CI workflow (#247) X-Git-Tag: upstream/0.0.1642~1405 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=886f1c830be4b31a3cb3fcf83626934104100dd1;p=pkg%2Fggml%2Fsources%2Fggml ci : introduce Github Actions CI workflow (#247) * Introduce Github Actions CI workflow for the ggml repo This commit integrates a Github Actions CI workflow that compiles and tests the codebase on both Ubuntu 22.04 and macOS 12 Monterey. The workflow is triggered on pull requests against the main branch and on every push to the main branch. To accommodate the resource constraints of the Github-hosted runners, a `GGML_NITER` environment variable is introduced, allowing tests to run within a reasonable time frame. `test-grad0.c` is modified to use this variable instead of `GGML_NLOOP`. The workflow file includes: - A build strategy for both Ubuntu and MacOS. - An environment setup with variables `GGML_NLOOP` and `GGML_NITER`. - A step to limit the number of threads used by `test2.c` for efficient execution. - A typical build process with steps for environment creation, CMake configuration, building, and verbose testing with a timeout. * main to master --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7a4b9351 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + + runs-on: ${{ matrix.os }} + + env: + GGML_NLOOP: 35 + GGML_NITER: 1 + + steps: + - uses: actions/checkout@v2 + + - name: Set GGML_NTHREADS for Ubuntu + run: echo "GGML_NTHREADS=2" >> $GITHUB_ENV + if: matrix.os == 'ubuntu-latest' + + - name: Set GGML_NTHREADS for MacOS + run: echo "GGML_NTHREADS=3" >> $GITHUB_ENV + if: matrix.os == 'macos-latest' + + - name: Create Build Environment + run: mkdir build + + - name: Configure CMake + working-directory: ./build + run: cmake .. + + - name: Build + working-directory: ./build + run: make + + - name: Test + working-directory: ./build + run: ctest --verbose --timeout 900 \ No newline at end of file diff --git a/tests/test-grad0.c b/tests/test-grad0.c index ec505922..f9db7da3 100644 --- a/tests/test-grad0.c +++ b/tests/test-grad0.c @@ -350,7 +350,7 @@ int main(int argc, const char ** argv) { // original loop: 1000 int niter = 4; - const char *env = getenv("GGML_NLOOP"); + const char *env = getenv("GGML_NITER"); if (env != NULL) { niter = atoi(env); }