Skip to content

Commit

Permalink
tidy precommit/CI configs
Browse files Browse the repository at this point in the history
  • Loading branch information
braddf committed Oct 1, 2024
1 parent 28643a9 commit 10088fb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/yarn_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: run tests
run: |
cd apps/nowcasting-app
yarn start & sleep 5 && yarn test:ci --coverage --coverageDirectory=../..
yarn start & sleep 5 && yarn test --coverage --coverageDirectory=../..
env:
AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }}
AUTH0_BASE_URL: ${{ secrets.AUTH0_BASE_URL }}
Expand All @@ -38,6 +38,7 @@ jobs:
AUTH0_ISSUER_BASE_URL: ${{ secrets.AUTH0_ISSUER_BASE_URL }}
AUTH0_SCOPE: ${{ secrets.AUTH0_SCOPE }}
AUTH0_SECRET: ${{ secrets.AUTH0_SECRET }}
NEXT_PUBLIC_API_PREFIX: ${{ secrets.NEXT_PUBLIC_API_PREFIX }}
NEXT_PUBLIC_AUTH0_AUDIENCE: ${{ secrets.NEXT_PUBLIC_AUTH0_AUDIENCE }}
NEXT_PUBLIC_AUTH0_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_AUTH0_CLIENT_ID }}
NEXT_PUBLIC_AUTH0_DOMAIN: ${{ secrets.NEXT_PUBLIC_AUTH0_DOMAIN }}
Expand Down
13 changes: 11 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

cd apps/nowcasting-app
cd apps/nowcasting-app || exit
yarn lint
yarn test

# check if the server is already running and save the boolean result
serverRunning=$(lsof -t -i :3002)
# if the server is running, just run the tests and don't start the server
if [ -z "$serverRunning" ]; then
yarn test
else
# if the server isn't running, start it, run the tests, and then kill the server after the tests are done
yarn dev & yarn test && lsof -t -i :3002 | xargs kill
fi
3 changes: 1 addition & 2 deletions apps/nowcasting-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"build-storybook": "build-storybook",
"lint": "next lint",
"pre-commit": "pre-commit run",
"test": "yarn dev & cypress run --browser chrome && jest && lsof -t -i :3002 | xargs kill",
"test:ci": "cypress run --browser chrome && jest"
"test": "cypress run --browser chrome && jest"
},
"dependencies": {
"@auth0/nextjs-auth0": "^1.8.0",
Expand Down

0 comments on commit 10088fb

Please sign in to comment.