Skip to content

Commit

Permalink
Replacing Google Analytics with Tealium (#4029)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetif authored May 9, 2022
1 parent 7bd45c9 commit f9baaf8
Show file tree
Hide file tree
Showing 45 changed files with 811 additions and 478 deletions.
40 changes: 38 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,26 @@ workflows:
filters:
branches:
ignore:
- main
- gh-pages
tags:
ignore: ignore-e2e
requires:
- frontend lint
- backend lint
- frontend dependency vulnerability scan
- backend dependency vulnerability scan
# - chromatic deployment:
# filters:
# branches:
# ignore:
# - gh-pages
# tags:
# ignore: ignore-e2e
# requires:
# - frontend lint
# - backend lint
# - frontend dependency vulnerability scan
# - backend dependency vulnerability scan

# backend jobs
- backend api endpoint test:
Expand Down Expand Up @@ -224,6 +236,7 @@ workflows:
- frontend test
- yaml test
- e2e test
# - chromatic deployment

- frontend deploy:
name: frontend deploy production
Expand All @@ -240,13 +253,15 @@ workflows:
- frontend test
- yaml test
- e2e test
# - chromatic deployment

# joint jobs
- preview deploy:
filters:
branches:
ignore:
- main
- gh-pages
tags:
ignore: /^noinfra.*/
requires:
Expand Down Expand Up @@ -551,6 +566,27 @@ jobs:
if [[ $CIRCLE_NODE_INDEX == "4" ]]; then export CYPRESS_RECORD_KEY="$CYPRESS_RECORD_KEY"; fi
if [[ $CIRCLE_NODE_INDEX == "4" ]]; then yarn run cy:run:ci -- --record --key $CYPRESS_RECORD_KEY --ci-build-id "$CIRCLE_BUILD_NUM-$CIRCLE_BRANCH" --group "e2e tests admin" --spec "cypress/integration/03-admin/*.spec.js"; fi
# chromatic deployment:
# yaml test:
# docker:
# - image: cimg/node:16.15.0
# auth:
# username: $DOCKER_EAPD_UN
# password: $DOCKER_EAPD_PW
# steps:
# - checkout
# - attach_workspace:
# at: ~/project/web
# - run:
# name: Install Web Dependencies
# working_directory: ~/project/web
# command: yarn install --frozen-lockfile
# - run:
# name: Deploy to Chromatic
# working_directory: ~/project/web
# no_output_timeout: 60m
# command: yarn deploy-chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} -b build:storybook --ci --exit-once-uploaded --exit-zero-on-changes

# ===== Backend jobs =====
# These all depend on "install dependencies" running first.

Expand Down Expand Up @@ -674,7 +710,7 @@ jobs:
- run:
name: build the web app
working_directory: ~/project/web
command: API_URL="${<< parameters.env >>_WEB_API_URL}" OKTA_DOMAIN="${<< parameters.env >>_OKTA_DOMAIN}" OKTA_SERVER_ID="${<< parameters.env >>_OKTA_SERVER_ID}" OKTA_CLIENT_ID="${<< parameters.env >>_OKTA_CLIENT_ID}" JWT_SECRET="${<< parameters.env >>_JWT_SECRET}" MONGO_INITDB_DATABASE="${<< parameters.env >>_MONGO_INITDB_DATABASE}" MONGO_URL="${<< parameters.env >>_MONGO_URL}" yarn build
command: ENV="${<< parameters.env >>}" API_URL="${<< parameters.env >>_WEB_API_URL}" TEALIUM_TAG="${<< parameters.env >>_TEALIUM_TAG}" OKTA_DOMAIN="${<< parameters.env >>_OKTA_DOMAIN}" OKTA_SERVER_ID="${<< parameters.env >>_OKTA_SERVER_ID}" OKTA_CLIENT_ID="${<< parameters.env >>_OKTA_CLIENT_ID}" JWT_SECRET="${<< parameters.env >>_JWT_SECRET}" MONGO_INITDB_DATABASE="${<< parameters.env >>_MONGO_INITDB_DATABASE}" MONGO_URL="${<< parameters.env >>_MONGO_URL}" yarn build
- persist_to_workspace:
root: ~/project
paths:
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/chromatic.yml

This file was deleted.

21 changes: 16 additions & 5 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Deploy Storybook
on:
pull_request:
branches:
- main
types:
- closed
paths:
[
'web/.storybook/**',
Expand All @@ -12,6 +12,7 @@ on:
'web/src/components/**',
'web/src/containers/**'
]

jobs:
storybook-deploy:
runs-on: ubuntu-18.04
Expand All @@ -22,15 +23,25 @@ jobs:
uses: actions/[email protected]
with:
persist-credentials: false
fetch-depth: 0
- name: Node Version
uses: actions/setup-node@v2
with:
node-version: '16.15.0'
- name: Install and Build
- name: Install Dependencies and Build Storybook
working-directory: ./web
run: |
cd web
yarn install
yarn install --frozen-lockfile
yarn build:storybook
- name: Publish to Chromatic
uses: chromaui/action@v1
# Chromatic GitHub Action options
with:
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GH_TOKEN }}
storybookBuildDir: docs-build
allowConsoleErrors: true
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
Expand Down
4 changes: 4 additions & 0 deletions api/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"node": true,
"es6": true
},
"globals": {
"window": true,
"utag": true
},
"overrides": [
{
"files": ["**/*.test.js", "**/*.endpoint.js", "endpoint-tests/utils.js"],
Expand Down
2 changes: 1 addition & 1 deletion bin/preview-deploy/aws.user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ git clone --single-branch -b __GIT_BRANCH__ https://github.com/CMSgov/eAPD.git
cd eAPD/web
yarn add [email protected] [email protected]
yarn install --frozen-lockfile
API_URL=/api OKTA_DOMAIN="__OKTA_DOMAIN__" OKTA_SERVER_ID="__OKTA_SERVER_ID__" OKTA_CLIENT_ID="__OKTA_CLIENT_ID__" yarn build
API_URL=/api TEALIUM_TAG="__TEALIUM_TAG__" OKTA_DOMAIN="__OKTA_DOMAIN__" OKTA_SERVER_ID="__OKTA_SERVER_ID__" OKTA_CLIENT_ID="__OKTA_CLIENT_ID__" yarn build
mv dist/* /app/web
cd ~
# Move the API code into place, then go set it up
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
image: cms-eapd/web
environment:
- API_URL=http://localhost:8081
- TEALIUM_TAG=${TEALIUM_TAG}
- OKTA_DOMAIN=${OKTA_DOMAIN}
- OKTA_SERVER_ID=${OKTA_SERVER_ID}
- OKTA_CLIENT_ID=${OKTA_CLIENT_ID}
Expand Down
7 changes: 0 additions & 7 deletions integrationTests/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
"env": {
"jest": true
},
"settings": {
"import/resolver": {
"jest": {
"jestConfigFile": "./jest.config.js"
}
}
},
"rules": {
"import/named": "off",
"import/order": "off"
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/cypress-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ docker-compose exec api yarn run seed

cp ../api/seeds/test/tokens.json ./tokens.json

TZ=utc npx cypress $1 $2 $3
TZ=utc npx cypress $1 $2 $3 --browser chrome
11 changes: 10 additions & 1 deletion integrationTests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "git+https://github.com/CMSgov/eAPD.git"
},
"author": "",
"license": "ISC",
"license": "CC0-1.0",
"engines": {
"node": "16.15.0"
},
Expand Down Expand Up @@ -47,5 +47,14 @@
"knex": "1.0.2",
"mocha": "9.2.2",
"pg": "8.7.3"
},
"jest": {
"setupFiles": [
"./polyfills.test.js"
],
"globals": {
"window": true,
"utag": true
}
}
}
3 changes: 3 additions & 0 deletions integrationTests/polyfills.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global.utag = {
view: () => {}
};
4 changes: 4 additions & 0 deletions web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
"node": true,
"commonjs": true
},
"globals": {
"window": true,
"utag": true
},
"overrides": [
{
"files": ["**/*.test.js", "**/*.story.js"],
Expand Down
4 changes: 3 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"build:storybook": "build-storybook -o ../docs-build",
"deploy-storybook": "storybook-to-ghpages --out=../docs-build",
"storybook": "start-storybook -p 6006",
"deploy-chromatic": "chromatic",
"npm-check": "npx npm-check-updates",
"stryker": "TZ=utc stryker run",
"prepare": "yarn run snyk-protect",
Expand Down Expand Up @@ -122,7 +123,7 @@
"react": "17.0.2",
"react-countdown": "2.3.2",
"react-dom": "17.0.2",
"react-gtm-module": "2.0.11",
"react-gtm-module": "^2.0.11",
"react-hook-form": "^7.27.1",
"react-redux": "7.2.6",
"react-router": "5.2.0",
Expand Down Expand Up @@ -168,6 +169,7 @@
"@wojtekmaj/enzyme-adapter-react-17": "0.6.6",
"axe-core": "4.4.1",
"axios-mock-adapter": "1.20.0",
"chromatic": "6.5.4",
"crypto-browserify": "3.12.0",
"enzyme": "3.11.0",
"enzyme-to-json": "3.6.2",
Expand Down
4 changes: 4 additions & 0 deletions web/polyfills.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ global.requestAnimationFrame = callback => {
global.cancelAnimationFrame = callback => {
setTimeout(callback, 0);
};

global.utag = {
view: () => {}
};
2 changes: 1 addition & 1 deletion web/src/components/DateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const DateField = ({
return '';
}
return errorMessage;
}, [errorMessage, state.invalidObject]);
}, [errorMessage, state]);

return (
<DSDateField
Expand Down
3 changes: 0 additions & 3 deletions web/src/components/DollarField.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export default {
component: DollarField,
parameters: {
jest: ['DollarField.test.js']
},
argTypes: {
value: { control: 'text' }
}
};

Expand Down
8 changes: 6 additions & 2 deletions web/src/components/Dollars.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ export default {
jest: ['Dollars.test.js']
},
argTypes: {
amt: { control: 'text' }
children: {
control: { type: 'text' }
}
}
};

export const Basic = (amt, ...args) => <Dollars {...args}>{amt}</Dollars>;
const Template = args => <Dollars {...args} />;

export const Basic = Template.bind({});
8 changes: 4 additions & 4 deletions web/src/components/PrivateRoute.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';
import React, { Fragment } from 'react';
import { Route, Redirect } from 'react-router-dom';
import { connect } from 'react-redux';

const PrivateRoute = ({ authenticated, component: Component, ...rest }) => (
const PrivateRoute = ({ authenticated, children, ...rest }) => (
<Route
{...rest}
render={props =>
authenticated ? (
<Component {...props} />
<Fragment>{children}</Fragment>
) : (
<Redirect
to={{
Expand All @@ -23,7 +23,7 @@ const PrivateRoute = ({ authenticated, component: Component, ...rest }) => (

PrivateRoute.propTypes = {
authenticated: PropTypes.bool.isRequired,
component: PropTypes.elementType.isRequired,
children: PropTypes.elementType.isRequired,
location: PropTypes.object.isRequired
};

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { withRouter } from 'react-router';
import Header from '../layout/header/Header';
import Footer from '../layout/footer/Footer';
import routes from '../pages/routes';
import routes from '../pages/mainRoutesList';
import SessionEndingAlert from './SessionEndingAlert';

const cardRoutes = routes.filter(r => r.isCard).map(r => r.path);
Expand Down
14 changes: 3 additions & 11 deletions web/src/components/__snapshots__/PrivateRoute.test.js.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/src/containers/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import Routes from '../pages/Route';
import Routes from '../pages/MainRoutes';
import Wrapper from '../components/Wrapper';
import Broadcast from '../components/Broadcast';
import AriaAnnounce from '../components/AriaAnnounce';
Expand Down
Loading

0 comments on commit f9baaf8

Please sign in to comment.