fix(ci): wrong ref name placement on download badge #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Test | |
| on: | |
| push: | |
| branches: | |
| - flutter | |
| paths-ignore: | |
| - "**.md" | |
| - ".gitignore" | |
| - "LICENSE" | |
| pull_request: | |
| branches: | |
| - flutter | |
| paths-ignore: | |
| - "**.md" | |
| - ".gitignore" | |
| - "LICENSE" | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| analyze: | |
| name: Analyze & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.x" | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Dart analyze | |
| run: flutter analyze --no-fatal-infos | |
| - name: Run unit tests | |
| run: flutter test --reporter=github | |
| continue-on-error: true | |
| prepare-dummy-binaries: | |
| name: Prepare dummy binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create dummy binary placeholders | |
| run: | | |
| mkdir -p assets/binaries/android/arm64-v8a | |
| mkdir -p assets/binaries/android/armeabi-v7a | |
| mkdir -p assets/binaries/android/x86_64 | |
| printf '\x7fELF' > assets/binaries/android/arm64-v8a/yt-dlp | |
| printf '\x7fELF' > assets/binaries/android/armeabi-v7a/yt-dlp | |
| printf '\x7fELF' > assets/binaries/android/x86_64/yt-dlp | |
| find assets/binaries -type f | sort | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dummy-binaries | |
| path: assets/binaries | |
| retention-days: 1 | |
| test-linux: | |
| name: Build Test — Linux | |
| needs: [analyze, prepare-dummy-binaries] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Flutter system dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y \ | |
| clang cmake ninja-build pkg-config \ | |
| libgtk-3-dev liblzma-dev libstdc++-12-dev | |
| - name: Download dummy binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dummy-binaries | |
| path: assets/binaries | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.x" | |
| channel: stable | |
| cache: true | |
| - run: flutter pub get | |
| - name: Build Linux (debug) | |
| run: flutter build linux --debug --dart-define=PORTABLE=false | |
| - name: Verify build output | |
| run: | | |
| EXE=$(find build/linux/x64/debug/bundle -maxdepth 1 -type f ! -name "*.so" | head -1) | |
| if [ -n "$EXE" ]; then | |
| echo "✓ Linux OK — $EXE" | |
| else | |
| ls -la build/linux/x64/debug/bundle/ && exit 1 | |
| fi | |
| test-windows: | |
| name: Build Test — Windows | |
| needs: [analyze, prepare-dummy-binaries] | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download dummy binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dummy-binaries | |
| path: assets/binaries | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.x" | |
| channel: stable | |
| cache: true | |
| - run: flutter pub get | |
| - name: Build Windows (debug) | |
| run: flutter build windows --debug --dart-define=PORTABLE=false | |
| - name: Verify build output | |
| shell: pwsh | |
| run: | | |
| $exe = "build\windows\x64\runner\Debug\frameextractor.exe" | |
| if (Test-Path $exe) { | |
| Write-Host "✓ Windows OK" | |
| } else { | |
| Write-Error "✗ Not found: $exe"; exit 1 | |
| } | |
| test-android: | |
| name: Build Test — Android | |
| needs: [analyze, prepare-dummy-binaries] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download dummy binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dummy-binaries | |
| path: assets/binaries | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.x" | |
| channel: stable | |
| cache: true | |
| - run: flutter pub get | |
| - name: Build Android APK (debug) | |
| run: flutter build apk --debug --dart-define=PORTABLE=false | |
| - name: Verify APK exists | |
| run: | | |
| APK="build/app/outputs/flutter-apk/app-debug.apk" | |
| [ -f "$APK" ] && echo "✓ Android OK — $(du -h $APK | cut -f1)" || (echo "✗ APK not found" && exit 1) | |
| all-tests-pass: | |
| name: All build tests passed | |
| needs: [analyze, test-linux, test-windows, test-android] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check all jobs | |
| run: | | |
| echo "analyze: ${{ needs.analyze.result }}" | |
| echo "test-linux: ${{ needs.test-linux.result }}" | |
| echo "test-windows: ${{ needs.test-windows.result }}" | |
| echo "test-android: ${{ needs.test-android.result }}" | |
| if [[ \ | |
| "${{ needs.analyze.result }}" == "success" && \ | |
| "${{ needs.test-linux.result }}" == "success" && \ | |
| "${{ needs.test-windows.result }}" == "success" && \ | |
| "${{ needs.test-android.result }}" == "success" \ | |
| ]]; then | |
| echo "✅ All build tests passed." | |
| else | |
| echo "❌ One or more build tests failed." | |
| exit 1 | |
| fi |