Skip to content

Commit

Permalink
ci : introduce Github Actions CI workflow (#247)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ad1tazi authored Jun 18, 2023
1 parent b817f87 commit 886f1c8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/test-grad0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 886f1c8

Please sign in to comment.