mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 17:18:49 -04:00
The plan job of the add-on package workflow runs the platform matrix for every add-on. On a publishing event it fails closed when an add-on has no enabled platform. The Tables platform file listed three platforms, all with enabled: false, so every master push failed the plan and nothing was published or signed. Enable the same four platforms as the other first-party add-ons (linux/amd64, linux/arm64, darwin/arm64, darwin/amd64), each with its native runner and the executable-start check. The fail-closed check in the workflow is unchanged. The tests assumed Tables was disabled. The matrix spec now requires at least one enabled platform in the checked-in Tables file. The platform spec covers Tables like the other add-ons. The shell suite builds a disabled copy of the Tables file for the two fail-closed cases. Assisted-by: Claude:claude-sonnet-5-5 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
78 lines
2.7 KiB
Go
78 lines
2.7 KiB
Go
// SPDX-License-Identifier: MIT
|
|
package packaging
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"sort"
|
|
"strings"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
// The release platforms of the packaged first-party add-ons, with the runner
|
|
// that builds and checks each one natively.
|
|
var releasePlatforms = map[string]string{
|
|
"linux/amd64": "ubuntu-24.04",
|
|
"linux/arm64": "ubuntu-24.04-arm",
|
|
"darwin/arm64": "macos-14",
|
|
"darwin/amd64": "macos-15-intel",
|
|
}
|
|
|
|
// nativeChecked records the platforms whose native check has passed on a runner
|
|
// of that platform. A task of group G adds a platform here in the same change
|
|
// that enables it in the five files and shows the passing legs in its pull
|
|
// request. Enabling without this record, or recording without enabling, fails.
|
|
var nativeChecked = map[string]bool{"linux/amd64": true, "linux/arm64": true, "darwin/arm64": true, "darwin/amd64": true}
|
|
|
|
var packagedAddons = []string{"tables", "voice", "face", "fine-tuning", "quantization", "studio", "talk"}
|
|
|
|
var _ = Describe("the packaged add-ons", func() {
|
|
for _, id := range packagedAddons {
|
|
Context(id, func() {
|
|
It("lists every release platform with its runner", func() {
|
|
p, err := loadPlatforms(filepath.Join("..", "..", "..", "addons", id, "package", "platforms.yaml"))
|
|
Expect(err).ToNot(HaveOccurred())
|
|
Expect(p.Addon).To(Equal(id))
|
|
Expect(p.Executable).To(Equal(id))
|
|
got := map[string]string{}
|
|
for _, e := range p.Platforms {
|
|
got[e.Platform] = e.Runner
|
|
Expect(e.NativeCheck).To(Equal(NativeCheckKind), "%s: native check", e.Platform)
|
|
}
|
|
Expect(got).To(HaveLen(len(releasePlatforms)))
|
|
for platform, runner := range releasePlatforms {
|
|
Expect(got[platform]).To(Equal(runner), "platform %s", platform)
|
|
}
|
|
})
|
|
|
|
It("enables a platform exactly when its native check is recorded", func() {
|
|
p, err := loadPlatforms(filepath.Join("..", "..", "..", "addons", id, "package", "platforms.yaml"))
|
|
Expect(err).ToNot(HaveOccurred())
|
|
var enabled []string
|
|
for _, e := range p.Platforms {
|
|
if e.Enabled {
|
|
enabled = append(enabled, e.Platform)
|
|
}
|
|
}
|
|
var recorded []string
|
|
for platform := range nativeChecked {
|
|
recorded = append(recorded, platform)
|
|
}
|
|
sort.Strings(enabled)
|
|
sort.Strings(recorded)
|
|
Expect(enabled).To(Equal(recorded), "enabled platforms and recorded native checks differ")
|
|
})
|
|
|
|
It("has a catalog template", func() {
|
|
b, err := os.ReadFile(filepath.Join("..", "..", "..", "gallery", "addons", id+".yaml.tmpl"))
|
|
Expect(err).ToNot(HaveOccurred())
|
|
for _, want := range []string{`id: "{{addon}}"`, "requireSignature: true"} {
|
|
Expect(strings.Contains(string(b), want)).To(BeTrue(), "template lacks %q", want)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
})
|