-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (110 loc) · 4.06 KB
/
code_review.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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