Skip to content

[CAI-222] - Mistral #5797

[CAI-222] - Mistral

[CAI-222] - Mistral #5797

Workflow file for this run

name: Code Review
on:
pull_request:
push:
branches:
- main
defaults:
run:
shell: bash
jobs:
changes:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.title != ${{ vars.CHANGESET_PR_TITLE }}
permissions:
pull-requests: read
outputs:
nextjswebsite: ${{ steps.filter.outputs.nextjswebsite }}
steps:
- name: Checkout code
if: ${{ github.event_name != 'pull_request' }}
# Checkout is needed if not triggered by a PR
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0
id: filter
with:
filters: |
nextjswebsite:
- 'apps/nextjs-website/**'
compile:
name: Compile project
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.nextjswebsite == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Increase action disk space
uses: ./.github/actions/increase-disk-space
- name: Setup Node.JS
uses: ./.github/actions/setup-node
- name: Check lock file
run: npx -y [email protected]
- name: Install dependencies
run: npm ci --audit=false --fund=false
- name: Compile
run: npm run compile
- name: Store in cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
code_checks:
name: Code checks
runs-on: ubuntu-latest
needs: [changes, compile]
steps:
- name: Restore cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
- name: Check lint rules
run: npm run lint
- name: Run tests
run: npm run test
build_website:
name: Build Website
runs-on: ubuntu-latest
strategy:
matrix:
# We want to make sure the env variables are set correctly
environment: [ 'dev', 'prod' ]
fail-fast: false # Do not cancel any other jobs in the matrix, if a single job fails
environment: ${{ matrix.environment }}
needs: compile
steps:
- name: Restore cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
- name: Increase action disk space
uses: ./.github/actions/increase-disk-space
- name: Build NextJS Website
uses: ./.github/actions/build-nextjs-website
with:
path_to_gitbook_docs: ${{ github.workspace }}/apps/nextjs-website/docs
cookie_domain_script: ${{ secrets.COOKIE_DOMAIN_SCRIPT }}
allow_crawler: ${{ vars.ALLOW_CRAWLER }}
cognito_user_pool_id: ${{ secrets.NEXT_PUBLIC_COGNITO_USER_POOL_ID }}
cognito_identity_pool_id: ${{ secrets.NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID }}
cognito_app_client_id: ${{ secrets.NEXT_PUBLIC_COGNITO_USER_POOL_WEB_CLIENT_ID }}
chatbot_host: ${{ vars.NEXT_PUBLIC_CHATBOT_HOST }}
website_name: ${{ vars.NEXT_PUBLIC_WEBSITE_NAME }}
organization_name: ${{ vars.NEXT_PUBLIC_ORGANIZATION_NAME }}
organization_logo: ${{ vars.NEXT_PUBLIC_ORGANIZATION_LOGO }}
organization_social_links: ${{ vars.NEXT_PUBLIC_ORGANIZATION_SOCIAL_LINKS }}
chatbot_active: ${{ vars.NEXT_PUBLIC_CHATBOT_ACTIVE }}
cognito_aws_region: 'eu-south-1'
strapi_endpoint: ${{ vars.STRAPI_ENDPOINT }}
strapi_api_token: ${{ secrets.STRAPI_API_TOKEN }}
fetch_from_strapi: ${{ vars.FETCH_FROM_STRAPI }}
- name: Check NextJS bundle size
uses: ./.github/actions/check-nextjs-bundle-size
with:
path_to_nextjs_folder: ./apps/nextjs-website
upload_path: apps/nextjs-website/.next/analyze/__bundle_analysis.json