diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..1617034 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,40 @@ +# GitHub Actions Workflows + +## Flutter CI Pipeline + +The `flutter-ci.yml` workflow automatically runs on every commit and pull request to the main branches (main, master, develop). + +### What it does: + +1. **Analyze Job** (runs on Ubuntu): + - Checks code formatting with `dart format` + - Runs static analysis with `flutter analyze` + - Ensures code quality standards are met + +2. **Build Job** (runs on macOS): + - Builds the application for macOS + - Verifies that the build completes successfully + - Catches build-time errors before merging + +> **Note:** Linux and Windows builds are currently commented out as the application doesn't support these platforms yet. They can be enabled in the future by uncommenting the relevant sections in the workflow file. + +### Running locally: + +Before pushing your changes, you can run these checks locally: + +```bash +# Format your code +dart format . + +# Analyze your code +flutter analyze + +# Build for macOS +flutter build macos --release +``` + +### Troubleshooting: + +- If the format check fails, run `dart format .` to auto-format your code +- If analyze fails, fix the reported issues in your code +- If build fails, check the build logs for specific error messages diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml new file mode 100644 index 0000000..0e124b3 --- /dev/null +++ b/.github/workflows/flutter-ci.yml @@ -0,0 +1,95 @@ +name: Flutter CI + +on: + push: + branches: [ "main", "master", "develop" ] + pull_request: + branches: [ "main", "master", "develop" ] + +permissions: + contents: read + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: '3.9.2' + channel: 'stable' + cache: true + + - name: Install dependencies + run: flutter pub get + + - name: Verify formatting + run: dart format --output=none --set-exit-if-changed . + + - name: Analyze project + run: flutter analyze --no-fatal-infos + + build: + name: Build + runs-on: ${{ matrix.os }} + needs: analyze + + strategy: + fail-fast: false + matrix: + # Linux and Windows builds commented out - not supported yet + # os: [ubuntu-latest, macos-latest, windows-latest] + os: [macos-latest] + include: + # - os: ubuntu-latest + # build-target: linux + # build-path: build/linux/x64/release/bundle + - os: macos-latest + build-target: macos + build-path: build/macos/Build/Products/Release + # - os: windows-latest + # build-target: windows + # build-path: build/windows/x64/runner/Release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: '3.9.2' + channel: 'stable' + cache: true + + # Linux dependencies - not needed yet + # - name: Install Linux dependencies + # if: matrix.os == 'ubuntu-latest' + # run: | + # sudo apt-get update -y + # sudo apt-get install -y ninja-build libgtk-3-dev + + - name: Install dependencies + run: flutter pub get + + - name: Enable platform + run: flutter config --enable-${{ matrix.build-target }}-desktop + + - name: Build application + run: flutter build ${{ matrix.build-target }} --release + + - name: Verify build output + shell: bash + run: | + if [ -d "${{ matrix.build-path }}" ]; then + echo "Build successful - output found at ${{ matrix.build-path }}" + ls -la "${{ matrix.build-path }}" || true + else + echo "Build output directory not found at expected path: ${{ matrix.build-path }}" + exit 1 + fi