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

Commit

Permalink
Merge branch 'stage' of github.com:usds/assessment-review-tool into s…
Browse files Browse the repository at this point in the history
…tage
  • Loading branch information
Kelvin Luu authored and Kelvin Luu committed Dec 15, 2022
2 parents 9d39d76 + d61ce6d commit 078505a
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 25 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
20 changes: 12 additions & 8 deletions .github/workflows/push-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ 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"

# - uses: actions/cache@v2
# with:
# path: ~/.npm
Expand Down Expand Up @@ -65,7 +59,12 @@ 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/checkout@v2
- 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 +80,12 @@ jobs:
run: npm run build:prod
working-directory: frontend

# Build backend
# Build backend (requires node 14)
- uses: actions/checkout@v2
- 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
20 changes: 12 additions & 8 deletions .github/workflows/push-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ 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"

# - uses: actions/cache@v2
# with:
# path: ~/.npm
Expand Down Expand Up @@ -65,7 +59,12 @@ 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/checkout@v2
- 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 +80,12 @@ jobs:
run: npm run build:stage
working-directory: frontend

# Build backend
# Build backend (requires node 14)
- uses: actions/checkout@v2
- 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
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

0 comments on commit 078505a

Please sign in to comment.