fix: Included threat to threat relationships in rachel persona #170
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
# To get started with Next.js see: https://nextjs.org/docs/getting-started | |
# | |
name: Frontend | |
defaults: | |
run: | |
working-directory: ./frontend | |
on: | |
# Runs on pushes | |
push: | |
branches: | |
- main | |
paths: | |
- 'frontend/**' | |
- '.github/workflows/frontend.yml' | |
- 'k8s/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'frontend/**' | |
- '.github/workflows/frontend.yml' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ['21.x'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache-dependency-path: "frontend" | |
cache: npm | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
frontend/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-${{ matrix.node-version }}-frontend-${{ hashFiles('frontend/package-lock.json', 'frontend/yarn.lock') }}-${{ hashFiles('frontend/**.[jt]s', 'frontend/**.[jt]sx') }} | |
# If source files changed but pack855ages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.node-version }}-frontend-${{ hashFiles('frontend/package-lock.json', 'frontend/yarn.lock') }}- | |
- name: Install dependencies | |
env: | |
OGMA_KEY: ${{ secrets.OGMA_KEY }} | |
run: npm ci | |
- name: Perform linting | |
run: | | |
cp .env.example .env | |
npm run lint | |
- name: Run unit tests | |
run: | | |
npm run test | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
permissions: | |
contents: read | |
id-token: write | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/[email protected] | |
with: | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Configure Docker for Artifact Registry | |
run: | | |
gcloud auth configure-docker northamerica-northeast1-docker.pkg.dev | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./frontend | |
push: true | |
tags: northamerica-northeast1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/foresight/frontend:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
OGMA_KEY=${{ secrets.OGMA_KEY }} | |
NEO4J_USERNAME=${{ secrets.NEO4J_USERNAME }} | |
NEO4J_PASSWORD=${{ secrets.NEO4J_PASSWORD }} | |
NEO4J_URL=${{ secrets.NEO4J_URL }} | |
DFO_NEO4J_URL=${{ secrets.DFO_NEO4J_URL }} | |
QA_SERVICE_URL=${{ secrets.QA_SERVICE_URL }} | |
NEXT_PUBLIC_GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }} | |
GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} | |
GITHUB_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} | |
GITHUB_ALLOWED_USERS=${{ secrets.GH_ALLOWED_USERS }} | |
RESTRICTED_USERS=${{ secrets.RESTRICTED_USERS }} | |
NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} | |
NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }} | |
DATABASE_URL=${{ secrets.DATABASE_URL }} | |
- name: Get GKE credentials | |
uses: google-github-actions/[email protected] | |
with: | |
cluster_name: ${{ secrets.GKE_CLUSTER_NAME }} | |
location: ${{ secrets.GKE_CLUSTER_ZONE }} | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
- name: Restart Deployment | |
run: | | |
kubectl rollout restart deployment/${{ secrets.DEPLOYMENT_NAME }} -n ${{ secrets.NAMESPACE }} | |
kubectl rollout status deployment/${{ secrets.DEPLOYMENT_NAME }} -n ${{ secrets.NAMESPACE }} |