test+chore: measure pro coverage, move image advice to chat, 100% on … #1143
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 | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| lint: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Install SwiftLint | ||
| run: brew install swiftlint | ||
| - name: Lint | ||
| run: npm run lint | ||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Type check | ||
| run: npx tsc --noEmit | ||
| test: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Check out pro submodule (private; skipped on open-core forks) | ||
| # When the PRO_SUBMODULE_PAT secret is present (this org's CI), pull the private | ||
| # pro/ submodule so the pro-dependent suites (TTS/MCP/audio) run against the REAL | ||
| # package — a green run then actually exercises pro, not a stub. Forks without the | ||
| # secret skip this: proExists=false and jest runs the open-core suite instead. | ||
| if: ${{ secrets.PRO_SUBMODULE_PAT != '' }} | ||
| env: | ||
| PRO_PAT: ${{ secrets.PRO_SUBMODULE_PAT }} | ||
| run: | | ||
| git config --global url."https://x-access-token:${PRO_PAT}@github.com/".insteadOf "https://github.com/" | ||
| git submodule update --init --recursive pro | ||
| git config --global --unset url."https://x-access-token:${PRO_PAT}@github.com/".insteadOf || true | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| - name: Install JS dependencies | ||
| run: npm ci | ||
| - name: Run Jest tests | ||
| run: npx jest --coverage --forceExit | ||
| - name: Install Android NDK | ||
| # Configuring the native modules (op-sqlite etc.) needs the pinned NDK; the macOS | ||
| # runner doesn't ship it, so the android test task failed at configure with | ||
| # "Failed to install ndk;...". Install the version android/build.gradle forces. | ||
| run: | | ||
| SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" | ||
| yes | "$SDKMANAGER" "ndk;27.1.12297006" >/dev/null | ||
| - name: Run Android tests | ||
| run: cd android && ./gradlew :app:testDebugUnitTest --rerun-tasks | ||
| - name: Run iOS tests | ||
| run: | | ||
| cd ios && xcodebuild test \ | ||
| -workspace OffgridMobile.xcworkspace \ | ||
| -scheme OffgridMobile \ | ||
| -destination 'platform=iOS Simulator,name=iPhone 16' \ | ||
| -only-testing:OffgridMobileTests \ | ||
| 2>&1 | (xcpretty 2>/dev/null || cat) | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./coverage/lcov.info | ||
| fail_ci_if_error: false | ||
| - name: Upload iOS test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ios-test-results | ||
| path: ~/Library/Developer/Xcode/DerivedData/**/Logs/Test/*.xcresult | ||
| if-no-files-found: ignore | ||
| - name: Upload Android test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: android-test-results | ||
| path: android/app/build/reports/tests/ | ||
| if-no-files-found: ignore | ||
| android-build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| - name: Free disk space | ||
| # The native C++ builds (react-native-audio-api, op-sqlite) exhausted the runner | ||
| # disk ("LLVM ERROR: IO failure on output stream: No space left on device"). | ||
| # Reclaim large preinstalled toolchains we don't use; keep the Android SDK/NDK. | ||
| run: | | ||
| sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL || true | ||
| sudo docker image prune --all --force || true | ||
| df -h | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build Android Debug | ||
| run: cd android && ./gradlew assembleDebug | ||
| - name: Build Android Release | ||
| run: cd android && ./gradlew assembleRelease | ||