feat: switch to a local postgres database for prisma #269
Workflow file for this run
This file contains 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 ] | |
env: | |
NODE_VER: 22.5 | |
jobs: | |
testCodebase: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Use Node.js ${{ env.NODE_VER }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
cache: 'pnpm' | |
- name: Install deps | |
run: pnpm i | |
- name: Check linting | |
run: pnpm lint | |
- name: Check typecheck | |
run: pnpm typecheck | |
testCli: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: false | |
- name: Use Node.js ${{ env.NODE_VER }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
cache: 'pnpm' | |
- name: Install deps | |
run: pnpm i | |
- name: Run the CI with default options | |
run: pnpm dev:ci | |
# setup the database inside the generated app | |
- name: app:init the database | |
run: cd my-sidebase-app && npx prisma db push | |
# code should be 100% correct at the start | |
- name: app:check linting | |
run: cd my-sidebase-app && pnpm lint | |
- name: app:check typing | |
run: cd my-sidebase-app && npm exec nuxi prepare && pnpm run typecheck | |
# start dev-app, all of the following adapted from https://stackoverflow.com/a/60996259 | |
- name: app:run in dev | |
run: "cd my-sidebase-app && timeout 30 npm run dev || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" | |
# start prod-app | |
- name: app:run in prod | |
run: "export AUTH_ORIGIN=http://localhost:3000 && export AUTH_SECRET=test123 && cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" | |
# start dev-app and curl from it | |
- name: app:test in prod | |
run: "cd my-sidebase-app && timeout 30 npm run dev & (sleep 20 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |