Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #103 from usds/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
0kl-usds authored Dec 15, 2022
2 parents e8d11aa + 074b00d commit b0fb561
Show file tree
Hide file tree
Showing 17 changed files with 373 additions and 44 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/push-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Deploy Demo

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
branch_name:
description: branch to deploy
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ inputs.branch_name }}

- uses: actions/cache@v2
id: api-npm-cache
with:
path: ./api/node_modules/
key: ${{ runner.os }}-api-npm-${{ hashFiles('./api/package-lock.json') }}

- uses: actions/cache@v2
id: frontend-npm-cache
with:
path: ./frontend/node_modules/
key: ${{ runner.os }}-frontend-npm-${{ hashFiles('./frontend/package-lock.json') }}

- uses: actions/cache@v2
id: frontend-scss-cache
with:
path: ./frontend/src/styles/
key: ${{ runner.os }}-frontend-scss-${{ hashFiles('./frontend/src/scss/**.scss') }}

# Notice that the cache for the frontend is actually in the api directory...
- uses: actions/cache@v2
id: frontend-src-cache
with:
path: ./api/src/client
key: ${{ runner.os }}-frontend-src-${{ hashFiles('./frontend/src/**/*', './frontend/package.json') }}

# Build frontend
- uses: actions/setup-node@v2
with:
node-version: "12"

- name: Install frontend dependencies
if: steps.frontend-npm-cache.outputs.cache-hit != 'true'
run: npm ci
working-directory: frontend

- name: Build frontend styles
if: steps.frontend-scss-cache.outputs.cache-hit != 'true'
run: npm run build:styles
working-directory: frontend

- name: Build frontend
if: steps.frontend-src-cache.outputs.cache-hit != 'true'
run: npm run build:stage
working-directory: frontend

# Build backend
- uses: actions/setup-node@v2
with:
node-version: "14"

- name: Install dependencies
if: steps.api-npm-cache.outputs.cache-hit != 'true'
run: npm ci
working-directory: api

# Because of how the deploy works, do not cache backend
# frontend changes _will not_ make it if that's the case
- name: Build backend
run: npm run build
working-directory: api

- name: Deploy to cloud.gov
uses: cloud-gov/cg-cli-tools@main
with:
cf_api: https://api.fr.cloud.gov
cf_username: ${{secrets.STAGE_CF_USERNAME}}
cf_password: ${{secrets.STAGE_CF_PASSWORD}}
cf_org: gsa-open-opportunities
cf_space: USDS
cf_manifest: deployDemo.yml
17 changes: 11 additions & 6 deletions .github/workflows/push-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ jobs:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"

ref: ${{ inputs.branch_name }}
# - uses: actions/cache@v2
# with:
# path: ~/.npm
Expand Down Expand Up @@ -65,7 +62,11 @@ jobs:
path: ./api/src/client
key: ${{ runner.os }}-frontend-src-prod-${{ hashFiles('./frontend/src/**/*', './frontend/package.json') }}

# Build frontend
# Build frontend (requires node 12)
- uses: actions/setup-node@v2
with:
node-version: "12"

- name: Install frontend dependencies
if: steps.frontend-npm-cache.outputs.cache-hit != 'true'
run: npm ci
Expand All @@ -81,7 +82,11 @@ jobs:
run: npm run build:prod
working-directory: frontend

# Build backend
# Build backend (requires node 14)
- uses: actions/setup-node@v2
with:
node-version: "14"

- name: Install dependencies
if: steps.api-npm-cache.outputs.cache-hit != 'true'
run: npm ci
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/push-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ jobs:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"

ref: ${{ inputs.branch_name }}
# - uses: actions/cache@v2
# with:
# path: ~/.npm
Expand Down Expand Up @@ -65,7 +62,11 @@ jobs:
path: ./api/src/client
key: ${{ runner.os }}-frontend-src-${{ hashFiles('./frontend/src/**/*', './frontend/package.json') }}

# Build frontend
# Build frontend (requires node 12)
- uses: actions/setup-node@v2
with:
node-version: "12"

- name: Install frontend dependencies
if: steps.frontend-npm-cache.outputs.cache-hit != 'true'
run: npm ci
Expand All @@ -81,7 +82,11 @@ jobs:
run: npm run build:stage
working-directory: frontend

# Build backend
# Build backend (requires node 14)
- uses: actions/setup-node@v2
with:
node-version: "14"

- name: Install dependencies
if: steps.api-npm-cache.outputs.cache-hit != 'true'
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.0-alpine
FROM node:14.21.1-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile.compose
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.0-alpine
FROM node:14.21.1-alpine
WORKDIR /opt/node_app/app

COPY package.json package-lock.json ./
Expand Down
2 changes: 1 addition & 1 deletion api/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.19.0-alpine as builder
FROM node:14.21.1-alpine as builder

COPY package.json package-lock.json ./
COPY tsconfig.json ./
Expand Down
2 changes: 1 addition & 1 deletion api/package-lock.json

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

4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smeqa-art",
"version": "5.0.0",
"version": "5.0.1",
"description": "",
"main": "build/server.js",
"scripts": {
Expand Down Expand Up @@ -86,6 +86,6 @@
"winston-daily-rotate-file": "^4.5.0"
},
"engines": {
"node": ">14.19.0 <15.0.0"
"node": "14.21.1"
}
}
4 changes: 1 addition & 3 deletions api/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import path from 'path';
import fs from 'fs';
// const REDSREGEX = /"uri": "(redis:\/\/.*)"/;
const PSQLREGEX = /"uri": "(postgres:\/\/.*)"/;

export interface OpenIDConfiguration {
issuerDiscover: string;
Expand Down Expand Up @@ -59,7 +57,7 @@ const env = process.env.APP_ENV?.toString() || 'development';

const dbURI: string =
process.env.POSTGRES_URI ||
(process.env.VCAP_SERVICES && process.env.VCAP_SERVICES.match(PSQLREGEX)![1]) ||
(process.env.VCAP_SERVICES && JSON.parse(process.env.VCAP_SERVICES)["aws-rds"][0].credentials.uri) ||
'postgres://docker_pg_user:docker_pg_pw@docker_db:5432/docker_db';

const openIdConfig: OpenIDConfiguration = {
Expand Down
2 changes: 2 additions & 0 deletions api/src/services/assessmenthurdle.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default class AssessmentHurdleService {
if (!assessmentHurdle) throw new HttpException(404, `${hurdleId} not found`);

const applicantsById = assessmentHurdle.Applicants.reduce((memo, a) => {
if (!a) { return memo };
memo[a.id] = a.name!;
return memo;
}, {} as { [name: string]: string });
Expand Down Expand Up @@ -161,6 +162,7 @@ export default class AssessmentHurdleService {
attributes: ['name', 'sort_order', 'id'],
})
).reduce((memo, c) => {
if (!c) { return memo;}
memo[c.id] = { name: c.name, sort_order: c.sort_order! };
return memo;
}, {} as { [competencyId: string]: { name: string; sort_order: number } });
Expand Down
17 changes: 17 additions & 0 deletions deployDemo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 1
applications:
- name: smeqa-demo
instances: 1
memory: 128MB
env:
NODE_ENV: production
APP_ENV: staging
OPTIMIZE_MEMORY: "true"
TZ: America/New_York
command: node server.js
type: nodejs
path: ./api/build
buildpack: nodejs_buildpack
stack: cflinuxfs3
services:
- smeqa-demo-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from "react";
import classnames from "classnames";

import Accordion from "../../../commonComponents/Accordion";
import RadioGroup from "../../../commonComponents/RadioGroup";
import Alert from "../../../commonComponents/Alert";

const UngradedCompetency = ({
name,
definition,
requiredProficiencyDefinition,
children,
updateCompetencyDecisionHandler,
isDisabled,
// doesNotMeetClassToggle,
selectors,
competency_selector_id,
justifications,
}) => {
const definitionAccordion =
definition && definition.length ? (
<Accordion title="Competency Definition" isDrawer={true}>
<div dangerouslySetInnerHTML={{ __html: definition }}></div>
</Accordion>
) : null;
let classNames = classnames({
"grid-row": true,
"grid-gap-2": true,
"smeqa-rr-comp": true,
// "does-not-meet": doesNotMeetClassToggle,
});

const horizontal = selectors.length < 3 ? true : false;
return (
<div className={classNames}>
<div className="tablet:grid-col-8">
<h3 className="smeqa-rr-comp__name">{name}</h3>

<div
dangerouslySetInnerHTML={{ __html: requiredProficiencyDefinition }}
></div>
{justifications &&
justifications.map((j, i) => (
<Alert
key={i}
type="info"
title={`Review ${i + 1}`}
body={j.justification}
></Alert>
))}
{definitionAccordion}

{children}
</div>

<div className="tablet:grid-col-4" hidden={true}>
<h4 className="smeqa-rr-comp__title--prof" >
Resume reflects this exprience?
</h4>
<RadioGroup
buttons={selectors}
horizontal={horizontal}
name={name}
selectedRadio={competency_selector_id}
legend={"Please make a proficiency determination"}
disabled={isDisabled}
onChange={updateCompetencyDecisionHandler}
/>
</div>
</div>
);
};

export default UngradedCompetency;
Loading

0 comments on commit b0fb561

Please sign in to comment.