Skip to content

Implements token validation in guard using http request to auth-service #5

Implements token validation in guard using http request to auth-service

Implements token validation in guard using http request to auth-service #5

Workflow file for this run

# WARNING
# This workflow does not check for 'pull_request' event_name
# Do not use it for on:push
name: E2E Test
on:
pull_request:
branches:
- staging
- main
env:
NODE_VERSION: 22.9.0
jobs:
build-base-image-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image and export
uses: docker/build-push-action@v5
with:
context: .
build-args: NODE_ENV=development
push: false
tags: pocnestjs-base-dev:latest
outputs: type=docker,dest=/tmp/pocnestjs-base-dev.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp/pocnestjs-base-dev.tar
build-base-image-prod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image and export
uses: docker/build-push-action@v5
with:
context: .
build-args: NODE_ENV=production
push: false
tags: pocnestjs-base-prod:latest
outputs: type=docker,dest=/tmp/pocnestjs-base-prod.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp/pocnestjs-base-prod.tar
setup:
needs:
- build-base-image-dev
- build-base-image-prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Cache NPM
uses: actions/cache/save@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install --no-audit
auth-service-e2e:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Restore npm cache
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
fail-on-cache-miss: true
- name: Install dependencies
run: npm install --no-audit
- name: Load .env variables
id: dotenv
uses: falti/dotenv-action@v1.1.4
- name: Testing
run: npx nx e2e auth-service-e2e
env:
AUTH_SERVICE_PORT: ${{ steps.dotenv.outputs.AUTH_SERVICE_PORT }}
DATABASE_AUTH_HOST: ${{ steps.dotenv.outputs.DATABASE_AUTH_HOST }}
DATABASE_AUTH_PORT: ${{ steps.dotenv.outputs.DATABASE_AUTH_PORT }}
DATABASE_AUTH_USERNAME: ${{ steps.dotenv.outputs.DATABASE_AUTH_USERNAME }}
DATABASE_AUTH_PASSWORD: ${{ steps.dotenv.outputs.DATABASE_AUTH_PASSWORD }}
DATABASE_AUTH_DBNAME: ${{ steps.dotenv.outputs.DATABASE_AUTH_DBNAME }}
JWT_SECRET_KEY: ${{ steps.dotenv.outputs.JWT_SECRET_KEY }}
JWT_EXPIRES_IN: ${{ steps.dotenv.outputs.JWT_EXPIRES_IN }}
financial-service-e2e:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Restore npm cache
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
fail-on-cache-miss: true
- name: Install dependencies
run: npm install --no-audit
- name: Load .env variables
id: dotenv
uses: falti/dotenv-action@v1.1.4
- name: Testing
run: npx nx e2e financial-service-e2e
env:
FINANCIAL_SERVICE_PORT: ${{ steps.dotenv.outputs.FINANCIAL_SERVICE_PORT }}
DATABASE_FINANCIAL_HOST: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_HOST }}
DATABASE_FINANCIAL_PORT: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_PORT }}
DATABASE_FINANCIAL_USERNAME: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_USERNAME }}
DATABASE_FINANCIAL_PASSWORD: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_PASSWORD }}
DATABASE_FINANCIAL_DBNAME: ${{ steps.dotenv.outputs.DATABASE_FINANCIAL_DBNAME }}
JWT_SECRET_KEY: ${{ steps.dotenv.outputs.JWT_SECRET_KEY }}
JWT_MAX_AGE: ${{ steps.dotenv.outputs.JWT_MAX_AGE }}