From 0d6e1e95222a769afca6b60d51a80fa81530e4ce Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 16:57:46 +0200 Subject: [PATCH 01/10] Add CI configuration for macOS and Linux builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Copy GitHub Actions workflow from nhac project - Remove Android-specific build steps - Configure release workflow for DMG and Flatpak files only - Update all scripts and configurations for aks project - Use self-hosted runners with [self-hosted, macOS] and [self-hosted, Linux] tags 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/ci.yml | 131 +++++++++++++++++++++++++++++++ scripts/ci-build-linux-native.sh | 62 +++++++++++++++ scripts/ci-build-macos.sh | 60 ++++++++++++++ scripts/ci-test.sh | 51 ++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100755 scripts/ci-build-linux-native.sh create mode 100755 scripts/ci-build-macos.sh create mode 100755 scripts/ci-test.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ab60413 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,131 @@ +name: CI + +on: + push: + branches: [ main, master ] + tags: + - 'v*' + pull_request: + branches: [ main, master ] + workflow_dispatch: + +jobs: + test: + name: Run Tests + runs-on: [self-hosted, macOS] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + run: | + flutter --version + flutter doctor -v + + - name: Get dependencies + run: flutter pub get + + - name: Run tests + run: ./scripts/ci-test.sh + + build-macos: + name: Build macOS + runs-on: [self-hosted, macOS] + needs: test + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + run: | + flutter --version + flutter doctor -v + + - name: Get dependencies + run: flutter pub get + + - name: Build macOS app + run: ./scripts/ci-build-macos.sh + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: aks-macos + path: | + build/macos/Build/Products/Release/aks.app + *.dmg + retention-days: 7 + + build-linux: + name: Build Linux (Flatpak) + runs-on: [self-hosted, Linux] + needs: test + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache Flutter dependencies + uses: actions/cache@v4 + with: + path: | + ~/.pub-cache + key: ${{ runner.os }}-flutter-${{ hashFiles('pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-flutter- + + - name: Cache Flatpak build artifacts + uses: actions/cache@v4 + with: + path: | + .flatpak-builder/build + .flatpak-builder/ccache + key: ${{ runner.os }}-flatpak-build-${{ hashFiles('dev.myyc.aks.yaml') }} + restore-keys: | + ${{ runner.os }}-flatpak-build- + + - name: Setup Flutter + run: | + export PATH="$PATH:$HOME/flutter/bin" + flutter --version + flutter doctor -v + + - name: Get dependencies + run: | + export PATH="$PATH:$HOME/flutter/bin" + flutter pub get + + - name: Build Linux app + run: | + export PATH="$PATH:$HOME/flutter/bin" + ./scripts/ci-build-linux-native.sh + + - name: Upload Linux Flatpak + uses: actions/upload-artifact@v4 + with: + name: aks-linux-flatpak + path: aks.flatpak + retention-days: 7 + + + release: + name: Create Release + runs-on: [self-hosted, macOS] + needs: [build-macos, build-linux] + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + aks-macos/aks.app + aks-linux-flatpak/aks.flatpak + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/scripts/ci-build-linux-native.sh b/scripts/ci-build-linux-native.sh new file mode 100755 index 0000000..2f3b345 --- /dev/null +++ b/scripts/ci-build-linux-native.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -e + +echo "===================================" +echo "Building aks for Linux (Native)" +echo "===================================" + +# Add Flutter to PATH if not already there +export PATH="$PATH:$HOME/flutter/bin" + +# Clean previous builds +echo "Cleaning previous builds..." +flutter clean + +# Get dependencies +echo "Getting dependencies..." +flutter pub get + +# Build Linux app +echo "Building Linux app (release mode)..." +flutter build linux --release --tree-shake-icons + +# Check if build was successful +if [ ! -f "build/linux/x64/release/bundle/aks" ]; then + echo "Error: Linux build failed" + exit 1 +fi + +echo "Linux build complete!" + +# Generate icons if needed +if [ -f "generate_app_icons.py" ]; then + echo "Generating app icons..." + python3 generate_app_icons.py || true +fi + +# Build Flatpak if manifest exists and flatpak-builder is available +if [ -f "dev.myyc.aks.yaml" ] && command -v flatpak-builder &> /dev/null; then + echo "===================================" + echo "Building Flatpak" + echo "===================================" + + # Ensure Flatpak runtime is installed + flatpak install --user -y flathub org.freedesktop.Platform//24.08 || true + flatpak install --user -y flathub org.freedesktop.Sdk//24.08 || true + + # Build Flatpak (using cache if available) + # First build creates the app + flatpak-builder --ccache --keep-build-dirs --repo=repo build-dir dev.myyc.aks.yaml + + # Build single-file bundle + flatpak build-bundle repo aks.flatpak dev.myyc.aks + + echo "Flatpak build complete!" +else + echo "Skipping Flatpak build (flatpak-builder not found or manifest missing)" +fi + + +echo "===================================" +echo "Linux builds completed successfully!" +echo "===================================" \ No newline at end of file diff --git a/scripts/ci-build-macos.sh b/scripts/ci-build-macos.sh new file mode 100755 index 0000000..614eb27 --- /dev/null +++ b/scripts/ci-build-macos.sh @@ -0,0 +1,60 @@ +#!/bin/bash +set -e + +echo "===================================" +echo "Building aks for macOS" +echo "===================================" + +# Flutter should be available via Homebrew in PATH + +# Clean previous builds +echo "Cleaning previous builds..." +flutter clean + +# Get dependencies +echo "Getting dependencies..." +flutter pub get + +# Run code generation if needed +if [ -f "build_runner.yaml" ]; then + echo "Running code generation..." + flutter pub run build_runner build --delete-conflicting-outputs +fi + +# Build macOS app +echo "Building macOS app..." +flutter build macos --release + +# Check if build was successful +if [ ! -d "build/macos/Build/Products/Release/aks.app" ]; then + echo "Error: macOS build failed - app bundle not found" + exit 1 +fi + +# Get version from pubspec.yaml +VERSION=$(grep "^version:" pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1) +echo "Built version: $VERSION" + +# Optional: Create a DMG for distribution +if command -v create-dmg &> /dev/null; then + echo "Creating DMG..." + create-dmg \ + --volname "aks" \ + --window-pos 200 120 \ + --window-size 600 400 \ + --icon-size 100 \ + --icon "aks.app" 150 150 \ + --hide-extension "aks.app" \ + --app-drop-link 450 150 \ + --no-internet-enable \ + "aks-$VERSION.dmg" \ + "build/macos/Build/Products/Release/" + echo "DMG created: aks-$VERSION.dmg" +else + echo "Note: create-dmg not found, skipping DMG creation" + echo "Install with: npm install -g create-dmg" +fi + +echo "===================================" +echo "macOS build completed successfully!" +echo "====================================" \ No newline at end of file diff --git a/scripts/ci-test.sh b/scripts/ci-test.sh new file mode 100755 index 0000000..6ceac7d --- /dev/null +++ b/scripts/ci-test.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -e + +echo "===================================" +echo "Running aks tests" +echo "===================================" + +# Flutter should be available via Homebrew in PATH + +# Get dependencies first +echo "Getting dependencies..." +flutter pub get + +# Analyze code for issues +echo "Running Flutter analyze..." +flutter analyze --no-fatal-infos --no-fatal-warnings || { + echo "Warning: Flutter analyze found issues (continuing anyway)" +} + +# Format check (optional - can be strict) +echo "Checking code formatting..." +dart format --set-exit-if-changed --output=none . || { + echo "Warning: Code formatting issues found" + echo "Run 'dart format .' to fix formatting" + # Uncomment the next line to make formatting checks strict + # exit 1 +} + +# Run tests +echo "Running unit tests..." +if [ -d "test" ] && [ "$(ls -A test/*.dart 2>/dev/null)" ]; then + flutter test --coverage --no-pub + + # If you want to check coverage threshold (requires lcov) + if command -v lcov &> /dev/null && [ -f "coverage/lcov.info" ]; then + echo "Generating coverage report..." + lcov --summary coverage/lcov.info + fi +else + echo "No tests found in test/ directory" +fi + +# Run integration tests if they exist +if [ -d "integration_test" ] && [ "$(ls -A integration_test/*.dart 2>/dev/null)" ]; then + echo "Running integration tests..." + flutter test integration_test/ +fi + +echo "===================================" +echo "All tests completed!" +echo "====================================" \ No newline at end of file From f49528b70b45bd1872710b48bfe8c7c08ecd5a21 Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 17:06:58 +0200 Subject: [PATCH 02/10] Fix CI test failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update widget test to use AksApp instead of non-existent MyApp - Add native library build step to CI test script before running tests - This ensures libraw_processor.so and libvulkan_processor.so are available 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/ci-test.sh | 8 ++++++++ test/widget_test.dart | 17 ++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/ci-test.sh b/scripts/ci-test.sh index 6ceac7d..10dabf9 100755 --- a/scripts/ci-test.sh +++ b/scripts/ci-test.sh @@ -26,6 +26,14 @@ dart format --set-exit-if-changed --output=none . || { # exit 1 } +# Build native libraries for tests +echo "Building native libraries..." +if [ -f "scripts/build_test_libs.sh" ]; then + bash scripts/build_test_libs.sh +else + echo "Warning: build_test_libs.sh not found, skipping native library build" +fi + # Run tests echo "Running unit tests..." if [ -d "test" ] && [ "$(ls -A test/*.dart 2>/dev/null)" ]; then diff --git a/test/widget_test.dart b/test/widget_test.dart index 15525db..27ad270 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -11,20 +11,11 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:aks/main.dart'; void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { + testWidgets('App loads correctly', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); + await tester.pumpWidget(const AksApp()); - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); + // Verify that the app loads without crashing + expect(find.byType(MaterialApp), findsOneWidget); }); } From 6f18460de32328c367c81d871ff59ca61c1be93e Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 17:35:10 +0200 Subject: [PATCH 03/10] Refactor tests to run on appropriate platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split CI workflow into platform-specific test jobs - Create ci-test-common.sh for platform-independent tests (models, widgets) - Create ci-test-linux.sh for Linux-specific tests (Vulkan, RAW processing) - Add @TestOn('linux') tags to Linux-specific test files - Update test_helper.dart to be platform-aware and only build libraries on Linux - This prevents cross-platform compilation issues (e.g., Linux shaders on macOS) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/ci.yml | 34 +++++++++++--- scripts/ci-test-common.sh | 46 ++++++++++++++++++ scripts/ci-test-linux.sh | 36 ++++++++++++++ test/processors/crop_comparison_test.dart | 2 + test/processors/debug_crop_test.dart | 2 + .../processors/processor_comparison_test.dart | 2 + test/test_helper.dart | 47 ++++++++++++++++--- 7 files changed, 156 insertions(+), 13 deletions(-) create mode 100755 scripts/ci-test-common.sh create mode 100755 scripts/ci-test-linux.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab60413..b9ce7e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ on: workflow_dispatch: jobs: - test: - name: Run Tests + test-common: + name: Run Common Tests runs-on: [self-hosted, macOS] steps: - name: Checkout code @@ -25,13 +25,35 @@ jobs: - name: Get dependencies run: flutter pub get - - name: Run tests - run: ./scripts/ci-test.sh + - name: Run common tests + run: ./scripts/ci-test-common.sh + + test-linux: + name: Run Linux-Specific Tests + runs-on: [self-hosted, Linux] + needs: test-common + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Flutter + run: | + export PATH="$PATH:$HOME/flutter/bin" + flutter --version + flutter doctor -v + + - name: Get dependencies + run: | + export PATH="$PATH:$HOME/flutter/bin" + flutter pub get + + - name: Run Linux-specific tests + run: ./scripts/ci-test-linux.sh build-macos: name: Build macOS runs-on: [self-hosted, macOS] - needs: test + needs: [test-common, test-linux] steps: - name: Checkout code uses: actions/checkout@v4 @@ -59,7 +81,7 @@ jobs: build-linux: name: Build Linux (Flatpak) runs-on: [self-hosted, Linux] - needs: test + needs: [test-common, test-linux] steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/scripts/ci-test-common.sh b/scripts/ci-test-common.sh new file mode 100755 index 0000000..442f172 --- /dev/null +++ b/scripts/ci-test-common.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +echo "===================================" +echo "Running aks common tests" +echo "==================================" + +# Flutter should be available via Homebrew in PATH + +# Get dependencies first +echo "Getting dependencies..." +flutter pub get + +# Analyze code for issues +echo "Running Flutter analyze..." +flutter analyze --no-fatal-infos --no-fatal-warnings || { + echo "Warning: Flutter analyze found issues (continuing anyway)" +} + +# Format check (optional - can be strict) +echo "Checking code formatting..." +dart format --set-exit-if-changed --output=none . || { + echo "Warning: Code formatting issues found" + echo "Run 'dart format .' to fix formatting" + # Uncomment the next line to make formatting checks strict + # exit 1 +} + +# Run common tests (exclude platform-specific tests) +echo "Running common tests..." +if [ -d "test" ] && [ "$(ls -A test/*.dart 2>/dev/null)" ]; then + # Run tests excluding platform-specific directories + flutter test --exclude-tags=linux --coverage --no-pub test/models/ test/widget_test.dart + + # If you want to check coverage threshold (requires lcov) + if command -v lcov &> /dev/null && [ -f "coverage/lcov.info" ]; then + echo "Generating coverage report..." + lcov --summary coverage/lcov.info + fi +else + echo "No tests found in test/ directory" +fi + +echo "===================================" +echo "Common tests completed!" +echo "====================================" \ No newline at end of file diff --git a/scripts/ci-test-linux.sh b/scripts/ci-test-linux.sh new file mode 100755 index 0000000..21f68d0 --- /dev/null +++ b/scripts/ci-test-linux.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +echo "===================================" +echo "Running aks Linux-specific tests" +echo "==================================" + +# Add Flutter to PATH if not already there +export PATH="$PATH:$HOME/flutter/bin" + +# Get dependencies first +echo "Getting dependencies..." +flutter pub get + +# Build native Linux libraries for tests +echo "Building Linux native libraries..." +if [ -f "scripts/build_test_libs.sh" ]; then + bash scripts/build_test_libs.sh +else + echo "Warning: build_test_libs.sh not found, skipping native library build" +fi + +# Run Linux-specific tests +echo "Running Linux-specific tests..." +if [ -d "test/processors" ] && [ "$(ls -A test/processors/*.dart 2>/dev/null)" ]; then + # Run tests with linux tag only + flutter test --tags=linux --no-pub test/processors/ + + echo "Linux-specific tests completed!" +else + echo "No Linux-specific tests found" +fi + +echo "===================================" +echo "Linux tests completed!" +echo "====================================" \ No newline at end of file diff --git a/test/processors/crop_comparison_test.dart b/test/processors/crop_comparison_test.dart index 13db13a..ef722b0 100644 --- a/test/processors/crop_comparison_test.dart +++ b/test/processors/crop_comparison_test.dart @@ -3,6 +3,8 @@ import 'dart:typed_data'; import 'dart:math' as math; import 'dart:ui' as ui; import 'package:flutter_test/flutter_test.dart'; + +@TestOn('linux') import 'package:aks/services/processors/cpu_processor.dart'; import 'package:aks/services/processors/vulkan_processor.dart'; import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; diff --git a/test/processors/debug_crop_test.dart b/test/processors/debug_crop_test.dart index 9b44a87..8436ad5 100644 --- a/test/processors/debug_crop_test.dart +++ b/test/processors/debug_crop_test.dart @@ -1,5 +1,7 @@ import 'dart:typed_data'; import 'package:flutter_test/flutter_test.dart'; + +@TestOn('linux') import 'package:aks/services/processors/vulkan_processor.dart'; import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; import 'package:aks/models/crop_state.dart'; diff --git a/test/processors/processor_comparison_test.dart b/test/processors/processor_comparison_test.dart index 2c7c636..79c8dda 100644 --- a/test/processors/processor_comparison_test.dart +++ b/test/processors/processor_comparison_test.dart @@ -2,6 +2,8 @@ import 'dart:io'; import 'dart:typed_data'; import 'dart:math' as math; import 'package:flutter_test/flutter_test.dart'; + +@TestOn('linux') import 'package:aks/services/processors/cpu_processor.dart'; import 'package:aks/services/processors/vulkan_processor.dart'; import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; diff --git a/test/test_helper.dart b/test/test_helper.dart index e1c6455..9774eb1 100644 --- a/test/test_helper.dart +++ b/test/test_helper.dart @@ -1,15 +1,36 @@ import 'dart:io'; +import 'package:flutter/foundation.dart' show TargetPlatform; /// Test helper to ensure native libraries are built before running tests class TestHelper { static bool _initialized = false; - /// Ensure test environment is set up + /// Ensure test environment is set up for the current platform static Future ensureInitialized() async { if (_initialized) return; - print('Checking test environment...'); + print('Checking test environment for ${currentPlatform}...'); + // Only build Linux libraries on Linux + if (currentPlatform == 'linux') { + await _ensureLinuxLibraries(); + } else { + print('Skipping native library build on $currentPlatform'); + } + + _initialized = true; + } + + /// Get current platform string + static String get currentPlatform { + if (Platform.isLinux) return 'linux'; + if (Platform.isMacOS) return 'macos'; + if (Platform.isWindows) return 'windows'; + return 'unknown'; + } + + /// Ensure Linux native libraries are built and available + static Future _ensureLinuxLibraries() async { // Check if libraries exist final librawPath = 'linux/libraw_processor.so'; final vulkanPath = 'linux/libvulkan_processor.so'; @@ -33,7 +54,7 @@ class TestHelper { } if (needsBuild) { - print('Building native libraries...'); + print('Building Linux native libraries...'); // Check if build script exists final buildScript = File('scripts/build_test_libs.sh'); @@ -54,12 +75,24 @@ class TestHelper { throw Exception('Failed to build native libraries'); } - print('Native libraries built successfully'); + print('Linux native libraries built successfully'); } else { - print('All native libraries found'); + print('All Linux native libraries found'); + } + } + + /// Check if a specific library is available + static bool isLibraryAvailable(String libraryName) { + switch (libraryName) { + case 'vulkan': + return currentPlatform == 'linux' && + File('linux/libvulkan_processor.so').existsSync(); + case 'raw': + return currentPlatform == 'linux' && + File('linux/libraw_processor.so').existsSync(); + default: + return false; } - - _initialized = true; } /// Clean up test artifacts if needed From d65243262b3707305ac409eeedf4fbf1c9ddc839 Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 17:42:17 +0200 Subject: [PATCH 04/10] Fix CI dependencies to unblock macOS build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - macOS build now only depends on test-common, not test-linux - This allows macOS build to start immediately after common tests pass - Linux build still depends on both test jobs as expected - Prevents Linux-specific tests from blocking macOS builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9ce7e2..6133b09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: build-macos: name: Build macOS runs-on: [self-hosted, macOS] - needs: [test-common, test-linux] + needs: test-common steps: - name: Checkout code uses: actions/checkout@v4 From e10fc7f92078a75e54c09f28326df54a2f81f8dc Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 18:07:24 +0200 Subject: [PATCH 05/10] Reorganize tests by platform directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move Linux-specific tests to test/linux/ directory - Update import paths from ../test_helper.dart to ../../test_helper.dart - Remove @TestOn('linux') annotations - Update CI scripts to run tests from appropriate directories - ci-test-common.sh runs test/ excluding test/linux/ - ci-test-linux.sh runs only test/linux/ - Remove empty test/processors/ directory 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/ci-test-common.sh | 4 ++-- scripts/ci-test-linux.sh | 6 +++--- test/{processors => linux}/crop_comparison_test.dart | 3 +-- test/{processors => linux}/debug_crop_test.dart | 3 +-- test/{processors => linux}/processor_comparison_test.dart | 3 +-- 5 files changed, 8 insertions(+), 11 deletions(-) rename test/{processors => linux}/crop_comparison_test.dart (99%) rename test/{processors => linux}/debug_crop_test.dart (98%) rename test/{processors => linux}/processor_comparison_test.dart (99%) diff --git a/scripts/ci-test-common.sh b/scripts/ci-test-common.sh index 442f172..74d19b2 100755 --- a/scripts/ci-test-common.sh +++ b/scripts/ci-test-common.sh @@ -29,8 +29,8 @@ dart format --set-exit-if-changed --output=none . || { # Run common tests (exclude platform-specific tests) echo "Running common tests..." if [ -d "test" ] && [ "$(ls -A test/*.dart 2>/dev/null)" ]; then - # Run tests excluding platform-specific directories - flutter test --exclude-tags=linux --coverage --no-pub test/models/ test/widget_test.dart + # Run tests in test/ directory but exclude test/linux/ + flutter test --coverage --no-pub test/ --exclude "test/linux/**" # If you want to check coverage threshold (requires lcov) if command -v lcov &> /dev/null && [ -f "coverage/lcov.info" ]; then diff --git a/scripts/ci-test-linux.sh b/scripts/ci-test-linux.sh index 21f68d0..d2059de 100755 --- a/scripts/ci-test-linux.sh +++ b/scripts/ci-test-linux.sh @@ -22,9 +22,9 @@ fi # Run Linux-specific tests echo "Running Linux-specific tests..." -if [ -d "test/processors" ] && [ "$(ls -A test/processors/*.dart 2>/dev/null)" ]; then - # Run tests with linux tag only - flutter test --tags=linux --no-pub test/processors/ +if [ -d "test/linux" ] && [ "$(ls -A test/linux/*.dart 2>/dev/null)" ]; then + # Run tests in test/linux/ directory + flutter test --no-pub test/linux/ echo "Linux-specific tests completed!" else diff --git a/test/processors/crop_comparison_test.dart b/test/linux/crop_comparison_test.dart similarity index 99% rename from test/processors/crop_comparison_test.dart rename to test/linux/crop_comparison_test.dart index ef722b0..3959b9e 100644 --- a/test/processors/crop_comparison_test.dart +++ b/test/linux/crop_comparison_test.dart @@ -4,7 +4,6 @@ import 'dart:math' as math; import 'dart:ui' as ui; import 'package:flutter_test/flutter_test.dart'; -@TestOn('linux') import 'package:aks/services/processors/cpu_processor.dart'; import 'package:aks/services/processors/vulkan_processor.dart'; import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; @@ -13,7 +12,7 @@ import 'package:aks/models/adjustments.dart'; import 'package:aks/models/crop_state.dart'; import 'package:aks/services/raw_processor.dart'; import 'package:aks/services/image_processor.dart'; -import '../test_helper.dart'; +import '../../test_helper.dart'; void main() { group('CPU vs GPU Crop Comparison Tests', () { diff --git a/test/processors/debug_crop_test.dart b/test/linux/debug_crop_test.dart similarity index 98% rename from test/processors/debug_crop_test.dart rename to test/linux/debug_crop_test.dart index 8436ad5..a60c609 100644 --- a/test/processors/debug_crop_test.dart +++ b/test/linux/debug_crop_test.dart @@ -1,13 +1,12 @@ import 'dart:typed_data'; import 'package:flutter_test/flutter_test.dart'; -@TestOn('linux') import 'package:aks/services/processors/vulkan_processor.dart'; import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; import 'package:aks/models/crop_state.dart'; import 'package:aks/services/processors/image_processor_interface.dart'; import 'package:aks/services/raw_processor.dart'; -import '../test_helper.dart'; +import '../../test_helper.dart'; void main() { test('Debug crop calculations', () async { diff --git a/test/processors/processor_comparison_test.dart b/test/linux/processor_comparison_test.dart similarity index 99% rename from test/processors/processor_comparison_test.dart rename to test/linux/processor_comparison_test.dart index 79c8dda..cdcd6be 100644 --- a/test/processors/processor_comparison_test.dart +++ b/test/linux/processor_comparison_test.dart @@ -3,7 +3,6 @@ import 'dart:typed_data'; import 'dart:math' as math; import 'package:flutter_test/flutter_test.dart'; -@TestOn('linux') import 'package:aks/services/processors/cpu_processor.dart'; import 'package:aks/services/processors/vulkan_processor.dart'; import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; @@ -13,7 +12,7 @@ import 'package:aks/models/edit_pipeline.dart'; import 'package:aks/models/crop_state.dart'; import 'package:aks/services/raw_processor.dart'; import 'package:aks/services/image_processor.dart'; -import '../test_helper.dart'; +import '../../test_helper.dart'; void main() { group('Processor Comparison Tests', () { From 6f4fc7e50abfec361238c9bc84ce4bd36c76e23e Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 18:14:25 +0200 Subject: [PATCH 06/10] Fix flutter test command in CI script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove non-existent --exclude option and explicitly specify test directories to run only platform-independent tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/ci-test-common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci-test-common.sh b/scripts/ci-test-common.sh index 74d19b2..971ceee 100755 --- a/scripts/ci-test-common.sh +++ b/scripts/ci-test-common.sh @@ -30,7 +30,8 @@ dart format --set-exit-if-changed --output=none . || { echo "Running common tests..." if [ -d "test" ] && [ "$(ls -A test/*.dart 2>/dev/null)" ]; then # Run tests in test/ directory but exclude test/linux/ - flutter test --coverage --no-pub test/ --exclude "test/linux/**" + # Run specific test directories instead of using non-existent --exclude + flutter test --coverage --no-pub test/models/ test/widget_test.dart # If you want to check coverage threshold (requires lcov) if command -v lcov &> /dev/null && [ -f "coverage/lcov.info" ]; then From 0f5766449ac79b77d04d3e9ea3daeb48110c8ed0 Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 18:22:53 +0200 Subject: [PATCH 07/10] Fix import paths in Linux test files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change from ../../test_helper.dart to ../test_helper.dart 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- test/linux/crop_comparison_test.dart | 2 +- test/linux/debug_crop_test.dart | 2 +- test/linux/processor_comparison_test.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/linux/crop_comparison_test.dart b/test/linux/crop_comparison_test.dart index 3959b9e..e612568 100644 --- a/test/linux/crop_comparison_test.dart +++ b/test/linux/crop_comparison_test.dart @@ -12,7 +12,7 @@ import 'package:aks/models/adjustments.dart'; import 'package:aks/models/crop_state.dart'; import 'package:aks/services/raw_processor.dart'; import 'package:aks/services/image_processor.dart'; -import '../../test_helper.dart'; +import '../test_helper.dart'; void main() { group('CPU vs GPU Crop Comparison Tests', () { diff --git a/test/linux/debug_crop_test.dart b/test/linux/debug_crop_test.dart index a60c609..cc5fb20 100644 --- a/test/linux/debug_crop_test.dart +++ b/test/linux/debug_crop_test.dart @@ -6,7 +6,7 @@ import 'package:aks/services/processors/vulkan/vulkan_bindings.dart'; import 'package:aks/models/crop_state.dart'; import 'package:aks/services/processors/image_processor_interface.dart'; import 'package:aks/services/raw_processor.dart'; -import '../../test_helper.dart'; +import '../test_helper.dart'; void main() { test('Debug crop calculations', () async { diff --git a/test/linux/processor_comparison_test.dart b/test/linux/processor_comparison_test.dart index cdcd6be..208f0ff 100644 --- a/test/linux/processor_comparison_test.dart +++ b/test/linux/processor_comparison_test.dart @@ -12,7 +12,7 @@ import 'package:aks/models/edit_pipeline.dart'; import 'package:aks/models/crop_state.dart'; import 'package:aks/services/raw_processor.dart'; import 'package:aks/services/image_processor.dart'; -import '../../test_helper.dart'; +import '../test_helper.dart'; void main() { group('Processor Comparison Tests', () { From 259d20fc2f1351a534f6fae219a41f822c8d62be Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 18:49:35 +0200 Subject: [PATCH 08/10] Fix crop comparison test expectations and square crop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed incorrect aspect ratio expectations in crop tests: - Portrait crop: Expected 2:3 (0.667), actual 0.5 (300x600) - Square crop: Fixed to create actual square (400x400) instead of 400x480 - Updated test to use proper square region with equal width/height Also updated test descriptions to clarify they test crop regions, not aspect-ratio-constrained crops. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- test/linux/crop_comparison_test.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/linux/crop_comparison_test.dart b/test/linux/crop_comparison_test.dart index e612568..3fcfb03 100644 --- a/test/linux/crop_comparison_test.dart +++ b/test/linux/crop_comparison_test.dart @@ -191,8 +191,8 @@ void main() { print(' Pixels with diff > 1: $diffCount'); } - test('Portrait crop (2:3) on landscape image', () async { - // This is the failing case - portrait crop on landscape image + test('Portrait crop region on landscape image', () async { + // Portrait crop region (full height, center 30%) final cropRect = CropRect( left: 0.35, top: 0.0, @@ -219,9 +219,9 @@ void main() { verifyPortraitOrientation(cpuResult, 'CPU Portrait crop'); verifyPortraitOrientation(gpuResult, 'GPU Portrait crop'); - // Verify aspect ratio (2:3 = 0.667) - verifyAspectRatio(cpuResult, 2.0/3.0, 'CPU Portrait crop'); - verifyAspectRatio(gpuResult, 2.0/3.0, 'GPU Portrait crop'); + // Verify aspect ratio (should be 300x600 = 0.5) + verifyAspectRatio(cpuResult, 0.5, 'CPU Portrait crop'); + verifyAspectRatio(gpuResult, 0.5, 'GPU Portrait crop'); // Verify pixel content verifyPixelContent(cpuResult, gpuResult, 'Portrait crop content'); @@ -251,15 +251,17 @@ void main() { verifyPixelContent(cpuResult, gpuResult, 'Landscape crop content'); }); - test('Square crop (1:1) on landscape image', () async { + test('Square crop region on landscape image', () async { + // For a square crop on 1000x600, we need equal width and height + // Let's make it 400x400: width=40% (0.3-0.7), height=66.7% (0.1667-0.8333) final cropRect = CropRect( left: 0.3, - top: 0.1, + top: 0.1667, right: 0.7, - bottom: 0.9, + bottom: 0.8333, ); - print('\n=== Testing Square Crop (1:1) on Landscape Image ==='); + print('\n=== Testing Square Crop Region on Landscape Image ==='); final cpuResult = await processCropWithCPU(testPixels, imageWidth, imageHeight, cropRect); final gpuResult = await processCropWithGPU(testPixels, imageWidth, imageHeight, cropRect); From 75671e5ae3a0d6bf0a8214bb38bdca6a1f155fc3 Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 19:07:39 +0200 Subject: [PATCH 09/10] Remove DMG creation from CI builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DMG creation step was causing timeouts during macOS builds due to AppleScript execution issues in the CI environment. This change: - Removes DMG from CI upload artifacts - Adds CI detection to skip DMG creation entirely - Matches the successful pattern used in nhac project This should resolve the macOS build timeouts while still allowing manual DMG creation when needed for releases. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/ci.yml | 1 - scripts/ci-build-macos.sh | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6133b09..7aae31a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,6 @@ jobs: name: aks-macos path: | build/macos/Build/Products/Release/aks.app - *.dmg retention-days: 7 build-linux: diff --git a/scripts/ci-build-macos.sh b/scripts/ci-build-macos.sh index 614eb27..d2f34c0 100755 --- a/scripts/ci-build-macos.sh +++ b/scripts/ci-build-macos.sh @@ -36,7 +36,10 @@ VERSION=$(grep "^version:" pubspec.yaml | cut -d' ' -f2 | cut -d'+' -f1) echo "Built version: $VERSION" # Optional: Create a DMG for distribution -if command -v create-dmg &> /dev/null; then +# Skip DMG creation in CI environments to avoid timeouts +if [ "$CI" = "true" ] || [ "$GITHUB_ACTIONS" = "true" ]; then + echo "Running in CI environment, skipping DMG creation" +elif command -v create-dmg &> /dev/null; then echo "Creating DMG..." create-dmg \ --volname "aks" \ From e41e58dd5e31e700fce2dc217249c8bb8c0daabc Mon Sep 17 00:00:00 2001 From: myyc Date: Wed, 10 Sep 2025 19:11:40 +0200 Subject: [PATCH 10/10] Remove caching from Linux builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed both Flutter dependencies and Flatpak build artifacts caching from the Linux build job. This simplifies the CI pipeline and avoids potential issues with cache corruption or stale build artifacts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/ci.yml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7aae31a..f6e66a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,25 +85,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Cache Flutter dependencies - uses: actions/cache@v4 - with: - path: | - ~/.pub-cache - key: ${{ runner.os }}-flutter-${{ hashFiles('pubspec.lock') }} - restore-keys: | - ${{ runner.os }}-flutter- - - - name: Cache Flatpak build artifacts - uses: actions/cache@v4 - with: - path: | - .flatpak-builder/build - .flatpak-builder/ccache - key: ${{ runner.os }}-flatpak-build-${{ hashFiles('dev.myyc.aks.yaml') }} - restore-keys: | - ${{ runner.os }}-flatpak-build- - - name: Setup Flutter run: | export PATH="$PATH:$HOME/flutter/bin"