Skip to content

Commit

Permalink
Merge pull request #133 from Enterprise-CMCS/master
Browse files Browse the repository at this point in the history
Release to val
  • Loading branch information
mdial89f authored Sep 22, 2023
2 parents 8ba7957 + 7a2fdf9 commit 24c3e78
Show file tree
Hide file tree
Showing 116 changed files with 5,271 additions and 5,687 deletions.
15 changes: 15 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,18 @@ checks:
method-lines:
config:
threshold: 1000 # defacto disable
exclude_patterns:
- "config/"
- "db/"
- "dist/"
- "features/"
- "**/node_modules/"
- "script/"
- "**/spec/"
- "**/test/"
- "**/tests/"
- "Tests/"
- "**/vendor/"
- "**/*_test.go"
- "**/*.d.ts"
- "src/services/ui/src/pages/faq/**"
24 changes: 15 additions & 9 deletions .github/workflows/workspace-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
jobs:
test:
runs-on: macos-12
timeout-minutes: 30 # MacOS runners are more expensive than linux, so we want to be sure to stop any stuck builds.
timeout-minutes: 120 # MacOS runners are more expensive than linux, so we want to be sure to stop any stuck builds.
environment:
name: test-ws-setup
env:
Expand Down Expand Up @@ -60,12 +60,12 @@ jobs:
direnv allow
direnv exec run deploy --stage $STAGE_NAME
- name: Test test
run: |
source /tmp/.profile
nvm use
direnv allow
direnv exec run test --stage $STAGE_NAME
# - name: Test test
# run: |
# source /tmp/.profile
# nvm use
# direnv allow
# direnv exec run test --stage $STAGE_NAME

- name: Test destroy
run: |
Expand All @@ -74,12 +74,18 @@ jobs:
direnv allow
direnv exec run destroy --stage $STAGE_NAME --verify false --wait false
notify_of_failure:
runs-on: ubuntu-20.04
needs:
- test
if: failure()
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
if: env.SLACK_WEBHOOK != '' && failure()
if: env.SLACK_WEBHOOK != ''
env:
SLACK_COLOR: ${{job.status}}
SLACK_ICON: https://github.com/Enterprise-CMCS.png?size=48
SLACK_TITLE: Failure
SLACK_USERNAME: ${{ github.repository }} - ${{job.status}}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<img alt="Slack" src="https://img.shields.io/badge/Slack-channel-purple.svg">
</a>
<a href="https://codeclimate.com/github/Enterprise-CMCS/macpro-mako/maintainability">
<img src="https://api.codeclimate.com/v1/badges/81d2233c0cfa7557c7ab/maintainability" />
<img src="https://api.codeclimate.com/v1/badges/f4480e77af640e6fa864/maintainability" />
</a>
<a href="https://dependabot.com/">
<img alt="Dependabot" src="https://badgen.net/badge/Dependabot/enabled/green?icon=dependabot">
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if [ "$CI" != "true" ]; then
case $selectedshell in
"zsh")
shell=$selectedshell
shellprofile="$HOME/.zshrc"
shellprofile="$HOME/.zshenv"
macprorcfile="$HOME/.macprorc"
;;

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"test:watch": "turbo test:watch",
"test:gui": "turbo test:gui",
"e2e": "turbo e2e",
"e2e:ui": "turbo e2e:ui",
"coverage": "vitest run --coverage",
"test-gui": "vitest --ui",
"test-tsc": "tsc --skipLibCheck --noEmit"
Expand All @@ -34,7 +35,6 @@
"@enterprise-cmcs/serverless-waf-plugin": "^1.3.0",
"@serverless/compose": "^1.3.0",
"@stratiformdigital/serverless-iam-helper": "^3.2.0",
"@stratiformdigital/serverless-idempotency-helper": "^3.1.0",
"@stratiformdigital/serverless-online": "^3.1.0",
"@stratiformdigital/serverless-s3-security-helper": "^4.0.0",
"@stratiformdigital/serverless-stage-destroyer": "^2.0.0",
Expand All @@ -43,14 +43,16 @@
"@vitest/coverage-c8": "^0.29.8",
"@vitest/ui": "^0.29.8",
"aws-sdk-client-mock": "^2.0.1",
"esbuild": "^0.19.3",
"prettier": "2.7.1",
"semantic-release": "^19.0.5",
"serverless": "^3.17.0",
"serverless-bundle": "^6.0.0",
"serverless-disable-functions": "^1.0.0",
"serverless-esbuild": "^1.47.0",
"serverless-plugin-scripts": "^1.0.2",
"serverless-plugin-typescript": "^2.1.4",
"serverless-plugin-warmup": "^7.1.0",
"serverless-scriptable-plugin": "^1.3.1",
"serverless-stack-termination-protection": "^2.0.2",
"turbo": "^1.9.3",
"vitest": "^0.29.8"
Expand Down
6 changes: 6 additions & 0 deletions serverless-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ services:
path: src/services/alerts
dashboard:
path: src/services/dashboard
params:
CloudfrontDistributionId: ${ui-infra.CloudFrontDistributionId}
data:
path: src/services/data
params:
ECSFailureTopicArn: ${alerts.ECSFailureTopicArn}
ui-infra:
path: src/services/ui-infra
api:
path: src/services/api
params:
ECSFailureTopicArn: ${alerts.ECSFailureTopicArn}
osDomainArn: ${data.OpenSearchDomainArn}
osDomain: ${data.OpenSearchDomainEndpoint}
auth:
Expand All @@ -31,3 +36,4 @@ services:
CognitoUserPoolId: ${auth.UserPoolId}
CognitoUserPoolClientId: ${auth.UserPoolClientId}
CognitoUserPoolClientDomain: ${auth.UserPoolClientDomain}
BootstrapUsersPassword: ${auth.BootstrapUsersPassword}
17 changes: 14 additions & 3 deletions src/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,26 @@ yargs(process.argv.slice(2))
.command(
"e2e",
"run e2e tests.",
{},
async () => {
{
ui: { type: "boolean", demandOption: false, default: false },
},
async (argv: any) => {
await install_deps_for_services();
await runner.run_command_and_output(
`Install playwright`,
["yarn", "playwright", "install", "--with-deps"],
"."
);
await runner.run_command_and_output(`e2e tests`, ["yarn", "e2e"], ".");

if (argv.ui) {
await runner.run_command_and_output(
`e2e:ui tests`,
["yarn", "e2e:ui"],
"."
);
} else {
await runner.run_command_and_output(`e2e tests`, ["yarn", "e2e"], ".");
}
}
)
.command("test-gui", "open unit-testing gui for vitest.", {}, async () => {
Expand Down
91 changes: 0 additions & 91 deletions src/libs/dynamodb-lib.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/libs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./dynamodb-lib";
export * from "./cognito-lib";
export * from "./opensearch-lib";
export * from "./env";
12 changes: 11 additions & 1 deletion src/libs/opensearch-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,17 @@ export async function search(host:string, index:string, query:any){
index: index,
body: query,
});
return response.body.hits;
return response.body;
} catch(e) {
console.log({e})
}
}

export async function getItem(host:string, index:string, id:string){
client = client || (await getClient(host));
try {
const response = await client.get({id, index})
return response.body;
} catch(e) {
console.log({e})
}
Expand Down
43 changes: 36 additions & 7 deletions src/packages/shared-types/onemac.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { z } from "zod";
import { s3ParseUrl } from "shared-utils/s3-url-parser";

const onemacAttachmentSchema = z.object({
s3Key: z.string(),
filename: z.string(),
title: z.string(),
contentType: z.string(),
url: z.string().url(),
});

export const onemacSchema = z.object({
additionalInformation: z.string().optional(),
additionalInformation: z.string().nullable().default(null),
submitterName: z.string(),
submitterEmail: z.string(),
attachments: z
attachments: z.array(onemacAttachmentSchema).nullish(),
raiResponses: z
.array(
z.object({
s3Key: z.string(),
filename: z.string(),
title: z.string(),
contentType: z.string(),
url: z.string().url(),
additionalInformation: z.string().nullable().default(null),
submissionTimestamp: z.number(),
attachments: z.array(onemacAttachmentSchema),
})
)
.nullish(),
Expand All @@ -35,9 +42,31 @@ export const transformOnemac = (id: string) => {
key,
};
}) ?? null,
raiResponses:
data.raiResponses?.map((response) => {
return {
additionalInformation: response.additionalInformation,
submissionTimestamp: response.submissionTimestamp,
attachments:
response.attachments?.map((attachment) => {
const uploadDate = parseInt(attachment.s3Key.split("/")[0]);
const parsedUrl = s3ParseUrl(attachment.url);
if (!parsedUrl) return null;
const { bucket, key } = parsedUrl;

return {
...attachment,
uploadDate,
bucket,
key,
};
}) ?? null,
};
}) ?? null,
additionalInformation: data.additionalInformation,
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
origin: "oneMAC",
}));
};

Expand Down
Loading

0 comments on commit 24c3e78

Please sign in to comment.