Learning Pathway #74
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: Supabase API Tests | |
| on: | |
| push: | |
| branches: [ main, staging ] | |
| pull_request: | |
| branches: [ main, staging ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Setup Supabase CLI | |
| uses: supabase/setup-cli@v1 | |
| with: | |
| version: latest | |
| - name: Start Supabase | |
| run: | | |
| supabase start | |
| supabase status | |
| - name: Run Database Migrations | |
| run: supabase db reset | |
| - name: Run Vitest Tests | |
| run: yarn test:vitest | |
| env: | |
| # These values are set by Supabase CLI automatically | |
| SUPABASE_URL: http://localhost:65432 | |
| SUPABASE_SERVICE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU | |
| SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:65433/postgres | |
| - name: Stop Supabase | |
| if: always() | |
| run: supabase stop | |
| - name: Cleanup space | |
| run: | | |
| sudo rm -rf /tmp/* | |
| docker system prune -af |