name: test concurrency: # For PRs, later CI runs preempt previous ones. e.g. a force push on a PR # cancels running CI jobs and starts all new ones. # # For non-PR pushes, concurrency.group needs to be unique for every distinct # CI run we want to have happen. Use run_id, which in practice means all # non-PR CI runs will be allowed to run without preempting each other. group: ${{ github.workflow }}-$${{ github.pull_request.number || github.run_id }} cancel-in-progress: true on: pull_request: paths: - '**/*' - '!docs/**' - '!README.md' jobs: changes: runs-on: ubuntu-latest outputs: changed: ${{ steps.changes.outputs.changed }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - id: changes run: | changed() { local BASE=${{ github.event.pull_request.base.sha }} local HEAD=${{ github.event.pull_request.head.sha }} local MERGE_BASE=$(git merge-base $BASE $HEAD) git diff-tree -r --no-commit-id --name-only "$MERGE_BASE" "$HEAD" \ | xargs python3 -c "import sys; from pathlib import Path; print(any(Path(x).match(glob) for x in sys.argv[1:] for glob in '$*'.split(' ')))" } echo changed=$(changed 'llama/llama.cpp/**' 'ml/backend/ggml/ggml/**') | tee -a $GITHUB_OUTPUT linux: needs: [changes] if: ${{ needs.changes.outputs.changed == 'True' }} strategy: matrix: include: - container: nvidia/cuda:11.8.0-devel-ubuntu22.04 preset: CUDA - container: rocm/dev-ubuntu-22.04:6.1.2 preset: ROCm extra-packages: rocm-libs runs-on: ubuntu-latest container: ${{ matrix.container }} steps: - uses: actions/checkout@v4 - run: | apt-get update apt-get install -y cmake pkg-config ${{ matrix.extra-packages }} env: DEBIAN_FRONTEND: noninteractive - run: | cmake --preset ${{ matrix.preset }} cmake --build --preset ${{ matrix.preset }} --parallel test: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} env: CGO_ENABLED: '1' steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: go.mod - uses: golangci/golangci-lint-action@v6 with: args: --timeout 10m0s -v - run: go test ./... patches: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Verify patches apply cleanly and do not change files run: | make -f Makefile2 clean checkout sync git diff --compact-summary --exit-code