Remove npm caching from all GitHub Actions workflows #20
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: Test Suite | |
| on: | |
| push: | |
| branches: [main, develop, "feature/*"] | |
| pull_request: | |
| branches: [main, develop] | |
| permissions: | |
| contents: read | |
| env: | |
| CI: true | |
| jobs: | |
| test-server: | |
| name: Test Server | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install dependencies | |
| working-directory: server | |
| run: npm ci | |
| - name: Run tests | |
| working-directory: server | |
| run: npm test | |
| - name: Run linting | |
| working-directory: server | |
| run: npm run lint | |
| - name: Build server | |
| working-directory: server | |
| run: npm run build | |
| test-mobile: | |
| name: Test Mobile App | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: 3.19.5 | |
| channel: stable | |
| cache: true | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: gradle | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Setup environment file | |
| run: cp server/.env.example mobile/.env | |
| - name: Install dependencies | |
| working-directory: mobile | |
| run: flutter pub get | |
| - name: Run tests | |
| working-directory: mobile | |
| run: flutter test | |
| - name: Run analysis | |
| working-directory: mobile | |
| run: flutter analyze | |
| - name: Build APK (debug) | |
| working-directory: mobile | |
| run: flutter build apk --debug | |
| test-integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [test-server] | |
| timeout-minutes: 25 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install dependencies | |
| working-directory: server | |
| run: npm ci | |
| - name: Build server | |
| working-directory: server | |
| run: npm run build | |
| - name: Start server | |
| working-directory: server | |
| run: | | |
| nohup npm start >/tmp/server.log 2>&1 & | |
| # wait up to ~20s for health to pass | |
| for i in {1..20}; do | |
| if curl -fsS http://localhost:3000/health > /dev/null; then | |
| echo "Server is up"; break | |
| fi | |
| sleep 1 | |
| done | |
| # final assert | |
| curl -fsS http://localhost:3000/health > /dev/null | |
| - name: Test API endpoints | |
| run: | | |
| # health | |
| curl -fsS http://localhost:3000/health | |
| # clean | |
| curl -fsS -X POST http://localhost:3000/api/clean \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"url":"https://example.com?utm_source=test"}' | |
| # strategies | |
| curl -fsS http://localhost:3000/api/strategies |