Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOC-3753 - Merge remote-tracking branch 'upstream/main' into test-branch #198

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"extends": [
"plugin:json/recommended",
"plugin:prettier/recommended"
],
"extends": ["plugin:json/recommended", "plugin:prettier/recommended"],
"plugins": ["@babel", "prettier"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"env": {
"browser": true,
"es6": true,
Expand Down Expand Up @@ -38,7 +35,12 @@
{
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["@babel", "prettier", "@typescript-eslint", "eslint-plugin-tsdoc"],
"plugins": [
"@babel",
"prettier",
"@typescript-eslint",
"eslint-plugin-tsdoc"
],
"parserOptions": {
"ecmaFeatures": { "jsx": true }
}
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/beta--lint-unit-build-and-publish-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Beta QA
on:
push:
branches:
- beta

jobs:
calculate-version:
runs-on: ubuntu-latest
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
branches: main

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

assign-semver:
runs-on: ubuntu-latest
needs: [calculate-version]
env:
SEMVER: ${{ needs.calculate-version.outputs.semVer }}
MAJOR: ${{ needs.calculate-version.outputs.Major }}
outputs:
SEMVER: ${{ steps.calc-semver.outputs.semver }}
steps:
- run: echo $SEMVER
- name: Add 3 to calculated semver
run: |
echo SEMVER="$((3 + MAJOR))${SEMVER:1}" >> $GITHUB_ENV
- name: Set semver to output
id: calc-semver
run: echo "::set-output name=semver::$(echo $SEMVER)"

lint-and-test:
name: Workspace
strategy:
matrix:
workspace: [model, designer, runner, submitter]
uses: ./.github/workflows/lint-and-test.yml
with:
workspace: ${{ matrix.workspace }}

build-and-publish-images:
name: Build and publish
needs: [calculate-version, assign-semver, lint-and-test]
strategy:
matrix:
app: [designer, runner, submitter]
uses: ./.github/workflows/build.yml
secrets: inherit
with:
semver: ${{ needs.assign-semver.outputs.SEMVER }}
publish: true
app: ${{matrix.app}}

tag-branch:
runs-on: ubuntu-latest
needs: [calculate-version, assign-semver, build-and-publish-images]
env:
SEMVER: ${{ needs.assign-semver.outputs.SEMVER }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
token: ${{ secrets.GHCR_PAT }}
- name: Tag branch with run number
run: |
git tag ${{ env.SEMVER }}
git push --tags origin HEAD
12 changes: 10 additions & 2 deletions .github/workflows/branch--lint-unit-and-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- beta
paths-ignore:
- "docs/**"
- "**/README.md"
Expand All @@ -18,7 +19,7 @@ jobs:
name: Workspace
strategy:
matrix:
workspace: [model, designer, runner]
workspace: [model, designer, runner, submitter]
uses: ./.github/workflows/lint-and-test.yml
with:
workspace: ${{ matrix.workspace }}
Expand All @@ -30,6 +31,13 @@ jobs:
app: designer
secrets: inherit

build-submitter:
name: Submitter
uses: ./.github/workflows/build.yml
with:
app: submitter
secrets: inherit

build-runner:
name: Runner
uses: ./.github/workflows/build.yml
Expand All @@ -38,7 +46,7 @@ jobs:
secrets: inherit

smoke-test:
needs: [build-runner,build-designer]
needs: [build-runner, build-designer]
uses: ./.github/workflows/smoke-test.yml
with:
runner-cache-ref: ${{needs.build-runner.outputs.tag}}
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
app:
description: the app to build "designer" or "runner"
description: the app to build "designer", "runner" or "submitter"
required: true
type: string
publish:
Expand All @@ -23,7 +23,6 @@ on:
description: hash used for docker caching
value: ${{ jobs.build-app.outputs.hash }}


jobs:
build-app:
if: ${{!contains(github.event.head_commit.message, 'chore(deps-dev)')}}
Expand All @@ -33,12 +32,11 @@ jobs:
tag: ${{ steps.hashFile.outputs.tag }}
hash: ${{ steps.hashFile.outputs.hash }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3.6.0
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v3.6.0
with:
node-version: "16.x"
cache: yarn

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -51,6 +49,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{inputs.app}}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{inputs.app}}
fail-on-cache-miss: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -65,7 +64,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


# The hash is a function of the Dockerfile and the yarn.lock Packages take up the bulk of the time during a docker build. The hash is used to cache the docker builds.
# As long as the yarn.lock and dockerfiles are the same, you will be able to share this cache with another commit/branch.
- id: hashFile
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
name: "Dependency Review"
on: [pull_request]

permissions:
Expand All @@ -14,7 +14,11 @@ jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- name: "Checkout Repository"
uses: actions/checkout@v3
- name: 'Dependency Review'
- name: "Dependency Review"
uses: actions/dependency-review-action@v2
with:
allow-ghsas:
- GHSA-c429-5p7v-vgjp
- GHSA-7fh5-64p2-3v2j
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
name: Workspace
strategy:
matrix:
workspace: [ model, designer, runner ]
workspace: [model, designer, runner, submitter]
uses: ./.github/workflows/lint-and-test.yml
with:
workspace: ${{ matrix.workspace }}
Expand All @@ -57,7 +57,7 @@ jobs:
needs: [calculate-version, assign-semver, lint-and-test]
strategy:
matrix:
app: [designer, runner]
app: [designer, runner, submitter]
uses: ./.github/workflows/build.yml
secrets: inherit
with:
Expand All @@ -71,7 +71,7 @@ jobs:
secrets: inherit
strategy:
matrix:
app: [ designer, runner ]
app: [designer, runner]
with:
app: ${{ matrix.app }}
tag: ${{ needs.assign-semver.outputs.SEMVER }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"


- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
Expand All @@ -53,7 +52,6 @@ jobs:
config-inline: |
[registry."ghcr.io"]


- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down Expand Up @@ -88,5 +86,9 @@ jobs:
docker compose -f docker-compose.smoke.yml up -d
docker ps

- name: log
run: |
docker compose logs runner

- name: run smoke tests
run: yarn e2e cypress run
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ tsconfig.tsbuildinfo
docs/**/typedoc

/e2e/cypress/screenshots/
/runner/config/default.js
.env_mysql
/queue-model/dist
/queue-model/module
/queue-model/src/prisma/generated/runner/config/default.js
runner/config/default.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Also see the individual repo README files for additional info:

**Always run scripts from the root directory.**

1. Make sure you are using node 16 `node --version`.
1. Make sure you are using node 18 `node --version`.
2. Make sure you have yarn 1.22+ installed. You do not need to install yarn 2.4+, yarn will detect the yarn 2 binary within [.yarn](./.yarn) and that will be used.
3. If using the designer:
- Note that the designer requires the runner to be running with the default `NODE_ENV=development` settings (see [runner/config/development.json](https://github.com/XGovFormBuilder/digital-form-builder/tree/main/runner/config/development.json)) to enable posting and previewing of forms during design.
Expand Down Expand Up @@ -116,6 +116,6 @@ The latest releases will be running here: [Runner](https://digital-form-builder-

A suite of smoke tests are run against all PRs. There is a Cron Job that executes smoke tests against the Heroku deployments and is scheduled to run at midnight every day.

A legacy suite of smoke tests can be found in this [repository](https://github.com/XGovFormBuilder/digital-form-builder-legacy-smoke-tests). They have been removed so that the project can run on node 16.
A legacy suite of smoke tests can be found in this [repository](https://github.com/XGovFormBuilder/digital-form-builder-legacy-smoke-tests). They have been removed so that the project can run on node 18.

Smoke tests will be migrated to use [cypress.io](https://cypress.io) in the coming months.
8 changes: 4 additions & 4 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"exclude": ["node_modules/**"],
"plugins": [
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-private-property-in-object",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-private-property-in-object",
"@babel/plugin-transform-private-methods",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-jsx",
"@babel/plugin-proposal-logical-assignment-operators"
"@babel/plugin-transform-logical-assignment-operators"
]
}
4 changes: 3 additions & 1 deletion designer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Stage 1
# Base image contains the updated OS and
# It also configures the non-root user that will be given permission to copied files/folders in every subsequent stages
FROM node:16-alpine AS base
FROM node:18-alpine AS base
RUN mkdir -p /usr/src/app && \
addgroup -g 1001 appuser && \
adduser -S -u 1001 -G appuser appuser && \
Expand Down Expand Up @@ -51,6 +51,8 @@ ARG LAST_COMMIT="NOT_DEFINED"
ARG LAST_TAG="NOT_DEFINED"
ENV LAST_COMMIT=$LAST_COMMIT
ENV LAST_TAG=$LAST_TAG
ENV NODE_OPTIONS="--openssl-legacy-provider"
COPY --chown=appuser:appuser designer/package.json ./designer/
RUN --mount=type=cache,target=.yarn/cache,id=designer,uid=1001,mode=0755 yarn workspaces focus @xgovformbuilder/designer
COPY --chown=appuser:appuser ./designer ./designer/

Expand Down
11 changes: 5 additions & 6 deletions designer/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ module.exports = {
],
],
plugins: [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-private-methods",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-logical-assignment-operators",

"@babel/plugin-transform-nullish-coalescing-operator",
"@babel/plugin-transform-logical-assignment-operators",
"@babel/plugin-transform-optional-chaining",
[
"module-resolver",
{
Expand Down
5 changes: 4 additions & 1 deletion designer/client/ComponentTypeEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function ComponentTypeEdit(props) {
return (
<div>
{needsFieldInputs && (
<FieldEdit isContentField={type?.subType === "content"} />
<FieldEdit
isContentField={type?.subType === "content"}
isListField={type?.subType === "listField"}
/>
)}
{TagName && <TagName page={page} />}
</div>
Expand Down
14 changes: 14 additions & 0 deletions designer/client/__mocks__/tabbable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const lib = jest.requireActual("tabbable");
const tabbable = {
...lib,
tabbable: (node, options) =>
lib.tabbable(node, { ...options, displayCheck: "none" }),
focusable: (node, options) =>
lib.focusable(node, { ...options, displayCheck: "none" }),
isFocusable: (node, options) =>
lib.isFocusable(node, { ...options, displayCheck: "none" }),
isTabbable: (node, options) =>
lib.isTabbable(node, { ...options, displayCheck: "none" }),
};

module.exports = tabbable;
Loading