Update CI workflow and fix Flutter API compatibility #12
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-server: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| cache: "npm" | |
| cache-dependency-path: server/package-lock.json | |
| - name: Install dependencies | |
| working-directory: server | |
| run: npm ci | |
| - name: Run linter | |
| working-directory: server | |
| run: npm run lint | |
| - name: Run tests | |
| working-directory: server | |
| run: npm test | |
| - name: Build | |
| working-directory: server | |
| run: npm run build | |
| test-mobile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Match local Flutter exactly: 3.35.3 (stable) | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.35.3" | |
| channel: "stable" | |
| cache: true | |
| # JDK 17 is the current default for modern Android/Gradle | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| cache: gradle | |
| # Android SDK & licenses for building APKs | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Show Flutter version (sanity check) | |
| run: flutter --version | |
| - name: Install dependencies | |
| working-directory: mobile | |
| run: flutter pub get | |
| - name: Analyze code | |
| working-directory: mobile | |
| run: flutter analyze | |
| - name: Run tests | |
| working-directory: mobile | |
| run: flutter test | |
| - name: Build APK (release) | |
| working-directory: mobile | |
| run: flutter build apk --release | |
| test-integration: | |
| runs-on: ubuntu-latest | |
| needs: [test-server, test-mobile] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| cache: "npm" | |
| cache-dependency-path: server/package-lock.json | |
| - name: Install server dependencies | |
| working-directory: server | |
| run: npm ci | |
| - name: Start server | |
| working-directory: server | |
| run: | | |
| npm run build | |
| npm start & | |
| # give the server a moment to boot | |
| sleep 10 | |
| - name: Test API endpoints | |
| run: | | |
| curl -fsS http://localhost:3000/health | |
| curl -fsS -X POST http://localhost:3000/api/clean \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"url":"https://example.com?utm_source=test"}' |