ci: typecheck the extension and run the Android unit tests #766
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: | |
| workflow_dispatch: | |
| inputs: null | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| defaults: | |
| run: | |
| working-directory: ./extension | |
| jobs: | |
| build-on-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Check out Git repository | |
| uses: actions/checkout@v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Get npm cache directory | |
| id: npm-cache-dir | |
| run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT" | |
| - uses: actions/cache@v6 | |
| id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | |
| with: | |
| path: ${{ steps.npm-cache-dir.outputs.dir }} | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install npm Packages | |
| # if: steps.npm-cache.outputs.cache-hit != 'true' | |
| run: npm i | |
| - name: Lint | |
| run: npm run lint | |
| - name: Typecheck | |
| run: npm run typecheck | |
| - name: Test Unit | |
| run: npm test | |
| - name: Build | |
| run: npm run build | |
| - name: 'Upload Artifact' | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: minded-download | |
| path: extension/minded.zip | |
| android-unit-tests: | |
| # The Android host has its own JVM test suite (decision engine, detection | |
| # confidence, widget copy rules, sync-data serialization). It never ran in | |
| # CI before, so a regression there only surfaced on a device. Pure JVM | |
| # tests, so no emulator and no web bundle are needed (assets/ only holds | |
| # a .gitkeep; the WebView bundle is a build-time artifact). | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: ./android | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| cache: gradle | |
| - name: Android unit tests | |
| run: ./gradlew :app:testDebugUnitTest --console=plain | |
| - name: Upload test reports | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: android-unit-test-reports | |
| path: android/app/build/reports/tests/ |