ci: improve workflow performance and reliability #1308
Workflow file for this run
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: | |
| pull_request: | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**/*.md' | |
| - '.prettierrc' | |
| - '**/*ignore' | |
| push: | |
| branches: | |
| - master | |
| - next | |
| - rc | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**/*.md' | |
| - '.prettierrc' | |
| - '**/*ignore' | |
| workflow_call: | |
| env: | |
| NODE_VERSION: '20' | |
| jobs: | |
| test: | |
| name: Unit + Type Check / Node.js ${{ matrix.node }} / OS ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| node: [20, 22, 24] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type Check | |
| run: npm run test:types | |
| - name: Run Unit Tests + Coverage | |
| run: npm run test:coverage | |
| - name: Upload coverage results to Coveralls | |
| uses: coverallsapp/github-action@v2 | |
| if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20' }} | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| path-to-lcov: ./test/coverage/lcov.info | |
| security: | |
| name: Security audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run security audit | |
| run: npm audit --audit-level=moderate | |
| - name: Run dependency vulnerability check | |
| run: npx audit-ci --moderate | |
| deno-tests: | |
| name: Deno Tests / ${{ matrix.deno }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| deno: ['1.x', '2.x'] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Deno | |
| uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: ${{ matrix.deno }} | |
| - name: Setup Supabase CLI | |
| uses: supabase/setup-cli@v1 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Start Supabase | |
| run: supabase start | |
| - name: Install dependencies and build | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Run Deno Tests | |
| run: | | |
| cd test/deno | |
| npm ci | |
| npm test || npm test | |
| # - name: Run integration and browser tests on Deno 2.x only | |
| # if: ${{ matrix.deno == '2.x' }} | |
| # run: | | |
| # npm run test:integration:browser | |
| - name: Stop Supabase | |
| if: always() | |
| run: supabase stop | |
| node-integration: | |
| name: Node Integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Setup Supabase CLI | |
| uses: supabase/setup-cli@v1 | |
| with: | |
| version: latest | |
| - name: Start Supabase | |
| run: supabase start | |
| - name: Install dependencies and build | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Run integration tests | |
| run: npm run test:integration || npm run test:integration | |
| - name: Stop Supabase | |
| if: always() | |
| run: supabase stop | |
| next-integration: | |
| name: Next.js Integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Setup Supabase CLI | |
| uses: supabase/setup-cli@v1 | |
| with: | |
| version: latest | |
| - name: Start Supabase | |
| run: supabase start | |
| - name: Install Playwright browsers and dependencies | |
| run: npx playwright install --with-deps | |
| - name: Run integration tests | |
| run: | | |
| cd test/integration/next | |
| npm ci | |
| npx playwright install | |
| npm run test | |
| - name: Stop Supabase | |
| if: always() | |
| run: supabase stop | |
| expo-tests: | |
| name: Expo Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Setup Supabase CLI | |
| uses: supabase/setup-cli@v1 | |
| with: | |
| version: latest | |
| - name: Start Supabase | |
| run: supabase start | |
| - name: Install dependencies and build | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Build and test expo | |
| run: | | |
| PKG=$(npm pack) | |
| echo "Packed: $PKG" | |
| cd test/integration/expo | |
| npm install | |
| npm install "../../../$PKG" | |
| npm test || npm test | |
| - name: Stop Supabase | |
| if: always() | |
| run: supabase stop |