fix(ci/test_rpm): git ownership mismatch on rpm test #40
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-debian: | |
| name: Build Test — Linux (Debian) | |
| 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 \ | |
| dpkg-dev fakeroot | |
| - 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 | |
| - name: Get Flutter dependencies | |
| 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 build OK - $EXE" | |
| else | |
| ls -la build/linux/x64/debug/bundle/ && exit 1 | |
| fi | |
| - name: Verify rpmbuild available | |
| run: | | |
| rpmbuild --version | |
| echo "✓ rpmbuild available" | |
| test-linux-fedora: | |
| name: Build Test — Linux (Fedora) | |
| needs: [analyze, prepare-dummy-binaries] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: fedora:latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: | | |
| sudo dnf install @development-tools -y | |
| sudo dnf install -y \ | |
| clang cmake ninja-build pkg-config \ | |
| gtk3-devel xz-devel libstdc++-devel \ | |
| rpm-build jq | |
| - name: Download dummy binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dummy-binaries | |
| path: assets/binaries | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.x" | |
| channel: stable | |
| cache: true | |
| - name: Configure Git safe directory | |
| run: | | |
| sudo git config --global --add safe.directory '*' | |
| - name: Get Flutter dependencies | |
| run: flutter pub get | |
| - name: Build Linux (debug) | |
| run: flutter build linux --debug --dart-define=PORTABLE=false | |
| - name: Create RPM spec file | |
| run: | | |
| mkdir -p rpmbuild/SPECS | |
| cat > rpmbuild/SPECS/frameextractor.spec << 'EOF' | |
| Name: frameextractor | |
| Version: 1.0.0 | |
| Release: 1%{?dist} | |
| Summary: Frame Extractor Application | |
| License: GPL | |
| %description | |
| A Flutter-based frame extraction tool. | |
| %prep | |
| %build | |
| %install | |
| mkdir -p %{buildroot}/opt/frameextractor | |
| cp -r build/linux/x64/debug/bundle/* %{buildroot}/opt/frameextractor/ | |
| %files | |
| /opt/frameextractor/* | |
| %changelog | |
| * Wed Apr 01 2026 Builder <build@example.com> - 1.0.0-1 | |
| - Initial release | |
| EOF | |
| - name: Build RPM package | |
| run: | | |
| rpmbuild -bb rpmbuild/SPECS/frameextractor.spec | |
| - name: Verify RPM created | |
| run: | | |
| ls -la rpmbuild/RPMS/*/frameextractor-*.rpm | |
| rpmbuild --version | |
| echo "✓ RPM build OK" | |
| 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 | |
| - name: Get Flutter dependencies | |
| 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 build 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 | |
| - name: Get Flutter dependencies | |
| run: flutter pub get | |
| - name: Setup release signing | |
| env: | |
| KEYSTORE_B64: ${{ secrets.KEYSTORE_BASE64 }} | |
| if: env.KEYSTORE_B64 != '' | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/app/keystore.jks | |
| cat > android/key.properties << EOF | |
| storePassword=${{ secrets.STORE_PASSWORD }} | |
| keyPassword=${{ secrets.KEY_PASSWORD }} | |
| keyAlias=${{ secrets.KEY_ALIAS }} | |
| storeFile=keystore.jks | |
| EOF | |
| echo "SIGNING_CONFIGURED=true" >> $GITHUB_ENV | |
| - name: Build Android APK (debug) | |
| run: flutter build apk --debug --dart-define=PORTABLE=false | |
| - name: Verify APK signing | |
| if: env.SIGNING_CONFIGURED == 'true' | |
| run: | | |
| for apk in \ | |
| build/app/outputs/flutter-apk/app-arm64-v8a-release.apk \ | |
| build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk \ | |
| build/app/outputs/flutter-apk/app-x86_64-release.apk; do | |
| echo "Verifying $apk..." | |
| $ANDROID_HOME/build-tools/$(ls $ANDROID_HOME/build-tools | tail -1)/apksigner \ | |
| verify --verbose "$apk" 2>&1 | grep -E "Verified|error" || true | |
| done | |
| echo "✓ APK signing verified" | |
| - name: Verify APK exists | |
| run: | | |
| APK="build/app/outputs/flutter-apk/app-debug.apk" | |
| [ -f "$APK" ] \ | |
| && echo "✓ Android build OK — $(du -h $APK | cut -f1)" \ | |
| || (echo "✗ APK not found" && exit 1) | |
| all-tests-pass: | |
| name: All build tests passed | |
| needs: | |
| [ | |
| analyze, | |
| test-linux-debian, | |
| test-linux-fedora, | |
| test-windows, | |
| test-android, | |
| ] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check all jobs | |
| run: | | |
| echo "analyze: ${{ needs.analyze.result }}" | |
| echo "test-linux-debian: ${{ needs.test-linux-debian.result }}" | |
| echo "test-linux-fedora: ${{ needs.test-linux-fedora.result }}" | |
| echo "test-windows: ${{ needs.test-windows.result }}" | |
| echo "test-android: ${{ needs.test-android.result }}" | |
| if [[ \ | |
| "${{ needs.analyze.result }}" == "success" && \ | |
| "${{ needs.test-linux-debian.result }}" == "success" && \ | |
| "${{ needs.test-linux-fedora.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 |