From 3a2d10b17b37da0176e016e0b7847efe89f60877 Mon Sep 17 00:00:00 2001 From: aomizu Date: Wed, 4 Jun 2025 11:19:44 +0900 Subject: [PATCH] added github workflow --- .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++++ README.md | 2 ++ main_test.go | 10 +++++++ pkg/utils/utils_test.go | 25 ++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 main_test.go create mode 100644 pkg/utils/utils_test.go diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8604e9a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: Build + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24.3' + + - name: Install Fyne dependencies + run: | + # Install required system dependencies for Fyne + brew install pkg-config + + - name: Install Fyne CLI + run: go install fyne.io/fyne/v2/cmd/fyne@latest + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Download dependencies + run: go mod download + + - name: Verify dependencies + run: go mod verify + + - name: Run tests + run: go test -v ./... + + - name: Build application + run: make build + + - name: Verify build output + run: | + ls -la TurtleSilicon.app/ + ls -la TurtleSilicon.app/Contents/Resources/ + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: TurtleSilicon-macos + path: TurtleSilicon.app/ + retention-days: 30 diff --git a/README.md b/README.md index 253476d..bce2979 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # TurtleSilicon TurtleSilicon Logo +[![Build](https://github.com/tairasu/TurtleSilicon/actions/workflows/build.yml/badge.svg)](https://github.com/tairasu/TurtleSilicon/actions/workflows/build.yml) +
Turtle WoW FPS on Apple Silicon TurtleSilicon Application diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..64e753e --- /dev/null +++ b/main_test.go @@ -0,0 +1,10 @@ +package main + +import ( + "testing" +) + +func TestMain(t *testing.T) { + // Basic test to ensure the main package can be imported and tested + t.Log("TurtleSilicon main package test passed") +} diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go new file mode 100644 index 0000000..3b3db9a --- /dev/null +++ b/pkg/utils/utils_test.go @@ -0,0 +1,25 @@ +package utils + +import ( + "os" + "path/filepath" + "testing" +) + +func TestPathExists(t *testing.T) { + // Test with a path that should exist (current directory) + currentDir, err := os.Getwd() + if err != nil { + t.Fatalf("Failed to get current directory: %v", err) + } + + if !PathExists(currentDir) { + t.Errorf("PathExists(%s) = false, want true", currentDir) + } + + // Test with a path that should not exist + nonExistentPath := filepath.Join(currentDir, "this-path-should-not-exist-12345") + if PathExists(nonExistentPath) { + t.Errorf("PathExists(%s) = true, want false", nonExistentPath) + } +}