Merge pull request #138 from joe-irving/113-on-admin-view-of-petition… #120
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: Node.js CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
# This job will run linting, typechecking and tests on your codebase | |
testCodebase: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16.14.2 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.2 | |
# Install packages | |
- run: npm ci | |
# Generate prisma client & push to db | |
- run: echo "DATABASE_URL=file:./db.sqlite" > .env | |
- run: npx prisma db push | |
- run: npx prisma generate | |
# Run linting and typechecking | |
- run: npm run lint | |
- run: npm run typecheck | |
# Run tests | |
- run: npm run test | |
# This job will run the app and then use `curl` to visit the index-page. This is a smoke detector check that ensures that your app still builds & runs correctly | |
testAppBuildsAndStarts: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16.14.2 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.14.2 | |
# Install packages | |
- run: npm ci | |
# Generate prisma client & push to db | |
- run: echo "DATABASE_URL=file:./db.sqlite" > .env | |
- run: npx prisma db push | |
- run: npx prisma generate | |
# start app in dev mode and load `/`-index page | |
- run: "(timeout 60 npm run dev & (sleep 10 && curl --fail localhost:3000)) && echo Run development check successful" | |
# build & start app in production mode and load `/`-index page | |
- run: "npm run build && (timeout 60 npm run preview & (sleep 10 && curl --fail localhost:3000)) && echo Run production check successful" |