From e0c8bf340bc839bc221794df13dcdb1741f3d43c Mon Sep 17 00:00:00 2001 From: Antoine Aflalo <197810+Belphemur@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:58:50 -0400 Subject: [PATCH] ci: add test preparation --- .github/workflows/test.yml | 5 +++++ cmd/cbzoptimizer/main.go | 2 ++ cmd/test-setup/main.go | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 cmd/test-setup/main.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f1e6ae..6513026 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,11 @@ jobs: - name: Install gotestsum run: go install gotest.tools/gotestsum@latest + - name: Setup test environment + run: | + go build -tags testsetup -o test-setup ./cmd/test-setup + ./test-setup + - name: Run tests run: | mkdir -p test-results diff --git a/cmd/cbzoptimizer/main.go b/cmd/cbzoptimizer/main.go index ffcb203..62a5f2e 100644 --- a/cmd/cbzoptimizer/main.go +++ b/cmd/cbzoptimizer/main.go @@ -1,3 +1,5 @@ +//go:build ignore + package main import ( diff --git a/cmd/test-setup/main.go b/cmd/test-setup/main.go new file mode 100644 index 0000000..575b276 --- /dev/null +++ b/cmd/test-setup/main.go @@ -0,0 +1,19 @@ +//go:build testsetup +// +build testsetup + +package main + +import ( + "fmt" + "log" + + "github.com/belphemur/CBZOptimizer/v2/pkg/converter/webp" +) + +func main() { + fmt.Println("Setting up WebP encoder for tests...") + if err := webp.PrepareEncoder(); err != nil { + log.Fatalf("Failed to prepare WebP encoder: %v", err) + } + fmt.Println("WebP encoder setup complete.") +}