Skip to content

Commit

Permalink
ci(fix): dev-test env
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharbansal22 committed Apr 2, 2024
1 parent 10f1443 commit eef246a
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/dev_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Tests and Create .env.development
name: Run Tests

on:
push:
Expand All @@ -11,6 +11,15 @@ on:
jobs:
test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: test
MONGO_INITDB_ROOT_PASSWORD: test
MONGO_INITDB_ROOT_ROLE: dbOwner

steps:
- name: Checkout code
Expand All @@ -19,19 +28,19 @@ jobs:
- name: Install dependencies
run: npm install

- name: Create .env.development file
- name: Create .env.test file
env:
PORT: ${{ secrets.PORT }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
NODE_ENV: development
JWT_SECRET: ${{ secrets.JWT_SECRET }}
ORIGIN: "*"
run: |
echo "PORT=${PORT}" >> .env.development
echo "MONGODB_URI=${MONGODB_URI}" >> .env.development
echo "NODE_ENV=${NODE_ENV}" >> .env.development
echo "JWT_SECRET=${JWT_SECRET}" >> .env.development
echo "ORIGIN=${ORIGIN}" >> .env.development
echo "PORT=${PORT}" >> .env.test
echo "MONGODB_URI=mongodb://test:test@localhost:27017" >> .env.test
echo "NODE_ENV=${NODE_ENV}" >> .env.test
echo "JWT_SECRET=${JWT_SECRET}" >> .env.test
echo "ORIGIN=${ORIGIN}" >> .env.test
- name: Run Jest tests
needs: mongodb
run: npm test

0 comments on commit eef246a

Please sign in to comment.