Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

.github: always run tests, and other helpful fixes (#9348)

Blake Mizerany0d694793f25a
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 431bc3282..bb0e8d90b 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -140,6 +140,13 @@ jobs:
env:
CMAKE_GENERATOR: Ninja
+ go_mod_tidy:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: check that 'go mod tidy' is clean
+ run: go mod tidy --diff || (echo "Please run 'go mod tidy'." && exit 1)
+
test:
strategy:
matrix:
@@ -149,14 +156,81 @@ jobs:
CGO_ENABLED: '1'
GOEXPERIMENT: 'synctest'
steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-go@v5
+ - name: checkout
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
+
+ - name: cache restore
+ uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
+ with:
+ # Note: unlike the other setups, this is only grabbing the mod download
+ # cache, rather than the whole mod directory, as the download cache
+ # contains zips that can be unpacked in parallel faster than they can be
+ # fetched and extracted by tar
+ path: |
+ ~/.cache/go-build
+ ~/go/pkg/mod/cache
+ ~\AppData\Local\go-build
+ # NOTE: The -3- here should be incremented when the scheme of data to be
+ # cached changes (e.g. path above changes).
+ key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-3-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
+ restore-keys: |
+ ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-3-${{ hashFiles('**/go.sum') }}
+ ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-3-
+
+ - name: Setup Go
+ uses: actions/setup-go@v5
with:
+ # The caching strategy of setup-go is less than ideal, and wastes
+ # time by not saving artifacts due to small failures like the linter
+ # complaining, etc. This means subsequent have to rebuild their world
+ # again until all checks pass. For instance, if you mispell a word,
+ # you're punished until you fix it. This is more hostile than
+ # helpful.
+ cache: false
+
go-version-file: go.mod
+
+ # TODO(bmizerany): replace this heavy tool with just the
+ # tools/checks/binaries we want and then make them all run in parallel
+ # across jobs, not on a single tiny vm on Github Actions.
- uses: golangci/golangci-lint-action@v6
with:
args: --timeout 10m0s -v
- - run: go test ./...
+
+ - name: go test
+ # Do not skip tests in the face of linter errors, or 'go mod tidy'
+ # checks, which are secondary to the tests. Tests trump linters.
+ if: always()
+ run: go test -count=1 -benchtime=1x ./...
+
+ # It is tempting to run this in a platform independent way, but the past
+ # shows this codebase will see introductions of platform specific code
+ # generation, and so we need to check this per platform to ensure we
+ # don't abuse go generate on specific platforms.
+ - name: check that 'go generate' is clean
+ run: |
+ go generate ./...
+ git diff --name-only --exit-code || (echo "Please run 'go generate ./...'." && exit 1)
+
+ - name: cache save
+ # Always save the cache, even if the job fails. The artifacts produced
+ # during the building of test binaries are not all for naught. They can
+ # be used to speed up subsequent runs.
+ if: always()
+
+ uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
+ with:
+ # Note: unlike the other setups, this is only grabbing the mod download
+ # cache, rather than the whole mod directory, as the download cache
+ # contains zips that can be unpacked in parallel faster than they can be
+ # fetched and extracted by tar
+ path: |
+ ~/.cache/go-build
+ ~/go/pkg/mod/cache
+ ~\AppData\Local\go-build
+ # NOTE: The -3- here should be incremented when the scheme of data to be
+ # cached changes (e.g. path above changes).
+ key: ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-3-${{ hashFiles('**/go.sum') }}-${{ github.run_id }}
patches:
runs-on: ubuntu-latest
diff --git a/ml/backend/ggml/ggml/src/ggml-metal/ggml-metal-embed.metal b/ml/backend/ggml/ggml/src/ggml-metal/ggml-metal-embed.metal
index 2e51b87a0..f10966df3 100644
--- a/ml/backend/ggml/ggml/src/ggml-metal/ggml-metal-embed.metal
+++ b/ml/backend/ggml/ggml/src/ggml-metal/ggml-metal-embed.metal
@@ -1,4 +1,4 @@
-// Code generated Fri Jan 10 13:05:45 PST 2025. DO NOT EDIT.
+// Code generated by go generate. DO NOT EDIT.
#define GGML_COMMON_DECL_METAL
#define GGML_COMMON_IMPL_METAL
#if defined(GGML_METAL_EMBED_LIBRARY)
diff --git a/ml/backend/ggml/ggml/src/ggml-metal/metal.go b/ml/backend/ggml/ggml/src/ggml-metal/metal.go
index 1025e205d..eb65dfdea 100644
--- a/ml/backend/ggml/ggml/src/ggml-metal/metal.go
+++ b/ml/backend/ggml/ggml/src/ggml-metal/metal.go
@@ -2,7 +2,7 @@
package metal
-//go:generate sh -c "{ echo // Code generated $(date). DO NOT EDIT.; sed -e '/__embed_ggml-common.h__/r ../ggml-common.h' -e '/__embed_ggml-common.h__/d' -e '/#include \"ggml-metal-impl.h\"/r ggml-metal-impl.h' -e '/#include \"ggml-metal-impl.h\"/d' ggml-metal.metal; } >ggml-metal-embed.metal"
+//go:generate sh -c "{ echo // Code generated by 'go generate'. DO NOT EDIT.; sed -e '/__embed_ggml-common.h__/r ../ggml-common.h' -e '/__embed_ggml-common.h__/d' -e '/#include \"ggml-metal-impl.h\"/r ggml-metal-impl.h' -e '/#include \"ggml-metal-impl.h\"/d' ggml-metal.metal; } >ggml-metal-embed.metal"
// #cgo CPPFLAGS: -DGGML_METAL_EMBED_LIBRARY -I.. -I../../include
// #cgo LDFLAGS: -framework Metal -framework MetalKit