-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Merge remote-tracking branch 'origin/form-v2/develop' into for…
…m-v2/merge-5.73.0
- Loading branch information
Showing
1,248 changed files
with
140,349 additions
and
4,889 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# .github/workflows/chromatic.yml | ||
|
||
# Workflow name | ||
name: 'Chromatic' | ||
|
||
defaults: | ||
run: | ||
working-directory: frontend | ||
|
||
# Event for the workflow | ||
on: | ||
push: | ||
branches: | ||
- 'form-v2/develop' | ||
pull_request: | ||
branches: | ||
# PR events to branches matching refs/heads/form-v2 | ||
- 'form-v2' | ||
- 'form-v2/**' | ||
|
||
# List of jobs | ||
jobs: | ||
chromatic-deployment: | ||
# Operating System | ||
runs-on: ubuntu-latest | ||
# Job steps | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node 14 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
- name: Install dependencies | ||
run: npm i | ||
# 👇 Adds Chromatic as a step in the workflow | ||
- name: Publish to Chromatic | ||
uses: chromaui/action@v1 | ||
# Chromatic GitHub Action options | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# 👇 Chromatic projectToken, refer to the manage page to obtain it. | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
workingDir: frontend | ||
autoAcceptChanges: form-v2/develop | ||
exitOnceUploaded: true | ||
onlyChanged: true |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: CI (React) | ||
|
||
on: | ||
push: | ||
branches: | ||
# Push events to branches matching refs/heads/form-v2 | ||
- 'form-v2' | ||
- 'form-v2/**' | ||
pull_request: | ||
branches: | ||
# PR events to branches matching refs/heads/form-v2 | ||
- 'form-v2' | ||
- 'form-v2/**' | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
- name: Cache Node.js modules | ||
uses: actions/cache@v2 | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.OS }}-node- | ||
${{ runner.OS }}- | ||
- run: npm ci | ||
|
||
test-frontend: | ||
needs: install | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
- name: Load Node.js modules | ||
uses: actions/cache@v2 | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm ci | ||
- run: npm run test:frontend | ||
|
||
test-backend: | ||
needs: install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
- name: Load Node.js modules | ||
uses: actions/cache@v2 | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm ci | ||
- run: npm run test:backend | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ tmp/ | |
|
||
# Tests | ||
# ======= | ||
coverage/ | ||
coverage/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run pre-commit && sh secrets-check.sh | ||
npm run pre-commit && sh secrets-check.sh && cd frontend && npm run pre-commit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'{src,tests}/**/*.{js,ts}': | ||
- eslint --fix | ||
'{src,tests}/**/*.html': | ||
- htmlhint | ||
- prettier --write |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ LABEL maintainer=FormSG<[email protected]> | |
|
||
WORKDIR /opt/formsg | ||
|
||
RUN mkdir /mongodb_data | ||
RUN chown 1001:1001 /mongodb_data | ||
|
||
ENV CHROMIUM_BIN=/usr/bin/chromium-browser | ||
ENV NODE_ENV=development | ||
ENV NODE_OPTIONS=--max-old-space-size=2048 | ||
|
@@ -50,4 +53,4 @@ EXPOSE 5000 | |
# e.g. chromium when launched to create a new PDF | ||
ENTRYPOINT [ "tini", "--" ] | ||
# Create local AWS resources before building the app | ||
CMD sh init-localstack.sh && npm run docker-dev | ||
CMD sh init-localstack.sh && npm run dev:backend |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
FROM node:fermium-alpine3.16 AS node-modules-builder | ||
FROM node:fermium-alpine3.16 as build | ||
# node-modules-builder stage installs/compiles the node_modules folder | ||
# Python version must be specified starting in alpine3.12 | ||
RUN apk update && apk upgrade && \ | ||
apk --no-cache add --virtual native-deps \ | ||
g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python3 git curl && \ | ||
npm install --quiet node-gyp -g | ||
WORKDIR /opt/formsg | ||
COPY package* /opt/formsg/ | ||
WORKDIR /build | ||
|
||
COPY package.json package-lock.json ./ | ||
COPY shared/package.json shared/package-lock.json ./shared/ | ||
COPY frontend/package.json frontend/package-lock.json ./frontend/ | ||
|
||
# Allow running of postinstall scripts | ||
RUN npm config set unsafe-perm true | ||
RUN npm ci | ||
COPY . /opt/formsg | ||
|
||
COPY . ./ | ||
|
||
ENV NODE_OPTIONS=--max-old-space-size=3072 | ||
|
||
RUN npm run build | ||
RUN npm prune --production | ||
|
||
# This stage builds the final container | ||
FROM node:fermium-alpine3.16 | ||
LABEL maintainer=FormSG<[email protected]> | ||
WORKDIR /opt/formsg | ||
|
||
# Install node_modules from node-modules-builder | ||
COPY --from=node-modules-builder /opt/formsg /opt/formsg | ||
# Install build from backend-build | ||
COPY --from=build /build/node_modules /opt/formsg/node_modules | ||
COPY --from=build /build/package.json /opt/formsg/package.json | ||
COPY --from=build /build/dist /opt/formsg/dist | ||
|
||
# Built backend goes back to root working directory | ||
RUN mv /opt/formsg/dist/backend/src /opt/formsg/ | ||
RUN mv /opt/formsg/dist/backend/shared /opt/formsg/ | ||
|
||
# Install chromium from official docs | ||
# https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine | ||
|
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
Oops, something went wrong.