Clean Repo (#143) #101
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
# See postman/README.md | |
name: Postman tests | |
on: | |
push: | |
branches: [main, dev/postman-tests, dev/api, dev/auth-api] | |
jobs: | |
run-and-test: | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres?schema=public" | |
# Start up a postgres database | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: | |
uses: actions/checkout@v2 | |
# run the migration and seeding scripts for prisma | |
- name: Set up Prisma | |
run: | | |
cd next | |
npm i | |
npx prisma migrate dev | |
npx prisma generate | |
npx prisma db seed | |
# run the API in the background. This will host it on localhost:3000 | |
- name: Start API | |
env: | |
NEXTAUTH_URL: "http://localhost:3000" | |
# this doesn't actually have to be a secret on CI | |
NEXTAUTH_SECRET: "123" | |
run: | | |
cd next | |
npm run dev & | |
# Run the tests through postman | |
- name: Run API Tests | |
id: run-newman | |
uses: anthonyvscode/newman-action@v1 | |
with: | |
collection: postman/WebsiteTheSSEquelTests.postman_collection.json | |
environment: postman/WebsiteTheSSEquelTests.postman_collection.json | |
reporters: cli | |
- name: Output summary to console | |
run: echo ${{ steps.run-newman.outputs.summary }} |