diff --git a/.github/workflows/deploy-on-merge.yml b/.github/workflows/deploy-on-merge.yml index 8bbbcb2..f7052ff 100644 --- a/.github/workflows/deploy-on-merge.yml +++ b/.github/workflows/deploy-on-merge.yml @@ -7,36 +7,39 @@ on: branches: - master jobs: - client_deploy: + firestore_deploy: runs-on: ubuntu-latest env: - working-directory: ./client + working-directory: ./firestore steps: - uses: actions/checkout@v3 - - run: npm ci && npm run build + - run: npm run deploy working-directory: ${{env.working-directory}} - - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POOLSCORE_1973 }}' - channelId: live - projectId: poolscore-1973 - firestore_deploy: + functions_deploy: + needs: firestore_deploy runs-on: ubuntu-latest env: - working-directory: ./firestore + working-directory: ./functions steps: - uses: actions/checkout@v3 - - run: npm deploy + - run: npm ci && npm run build working-directory: ${{env.working-directory}} + - run: npm run deploy - function_deploy: + client_deploy: + needs: [firestore_deploy, functions_deploy] runs-on: ubuntu-latest env: - working-directory: ./functions + working-directory: ./client steps: - uses: actions/checkout@v3 - run: npm ci && npm run build working-directory: ${{env.working-directory}} - - run: npm deploy + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POOLSCORE_1973 }}' + channelId: live + projectId: poolscore-1973 + diff --git a/functions/package.json b/functions/package.json index ec3609c..47e8d6c 100644 --- a/functions/package.json +++ b/functions/package.json @@ -12,7 +12,7 @@ "predeploy": "npm run build", "deploy": "npx firebase-tools deploy --force --only functions", "pretest": "npm run build", - "test": "npx firebase-tools emulators:exec --only 'functions,firestore,auth' 'npx jest'", + "test": "npx firebase-tools --debug emulators:exec --only 'functions,firestore,auth' 'npx jest'", "test:watch": "concurrently --kill-others \"npm:build:watch\" \"npx firebase-tools emulators:exec 'npx jest --watch'\"" }, "engines": { diff --git a/functions/src/createToken.test.ts b/functions/src/createToken.test.ts index 2100772..badf0ac 100644 --- a/functions/src/createToken.test.ts +++ b/functions/src/createToken.test.ts @@ -22,11 +22,14 @@ const firebaseConfig = { projectId: process.env.GCLOUD_PROJECT, apiKey: "test-key", }; + +console.log(firebaseConfig); +console.log(process.env); const app = initializeApp(firebaseConfig); const auth = getAuth(app); -connectAuthEmulator(auth, "http://localhost:9099", {disableWarnings: true}); +connectAuthEmulator(auth, "http://127.0.0.1:9099", {disableWarnings: true}); const functions = getFunctions(app); -connectFunctionsEmulator(functions, "localhost", 5001); +connectFunctionsEmulator(functions, "127.0.0.1", 5001); const createToken = httpsCallable(functions, "table-createtoken"); const createJWT = httpsCallable(functions, "table-createjwt");