-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #807 from 18F/staging
Production deploy to fix sampling in 30 day hostname report
- Loading branch information
Showing
85 changed files
with
8,008 additions
and
4,600 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
cache: 'npm' | ||
- name: Install node dependencies | ||
run: npm ci | ||
- name: Lint javascript | ||
run: npm run lint | ||
test: | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
# Start Postgres as a service, wait until healthy. Uses latest Postgres version. | ||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_DB: analytics_reporter_test | ||
POSTGRES_USER: analytics | ||
POSTGRES_PASSWORD: 123abc | ||
ports: | ||
- 5432:5432 | ||
options: | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
cache: 'npm' | ||
- name: Install node dependencies | ||
run: npm ci | ||
- name: Run tests | ||
run: npm test | ||
deploy_dev: | ||
needs: | ||
- lint | ||
- test | ||
if: github.ref == 'refs/heads/develop' | ||
uses: 18F/analytics-reporter/.github/workflows/deploy.yml@develop | ||
with: | ||
ANALYTICS_KEY_FILE_NAME: ${{ vars.ANALYTICS_KEY_FILE_NAME }} | ||
ANALYTICS_REPORT_EMAIL: ${{ vars.ANALYTICS_REPORT_EMAIL }} | ||
APP_NAME: ${{ vars.APP_NAME_DEV }} | ||
CF_ORGANIZATION_NAME: ${{ vars.CF_ORGANIZATION_NAME }} | ||
CF_SPACE_NAME: ${{ vars.CF_SPACE_NAME_DEV }} | ||
DB_SERVICE_NAME: ${{ vars.DB_SERVICE_NAME_DEV }} | ||
NEW_RELIC_APP_NAME: ${{ vars.NEW_RELIC_APP_NAME_DEV }} | ||
S3_SERVICE_NAME: ${{ vars.S3_SERVICE_NAME_DEV }} | ||
secrets: | ||
ANALYTICS_CREDENTIALS: ${{ secrets.ANALYTICS_CREDENTIALS }} | ||
CF_USERNAME: ${{ secrets.CF_USERNAME_DEV }} | ||
CF_PASSWORD: ${{ secrets.CF_PASSWORD_DEV }} | ||
GA4_CREDS: ${{ secrets.GA4_CREDS }} | ||
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_DEV }} | ||
deploy_stg: | ||
needs: | ||
- lint | ||
- test | ||
if: github.ref == 'refs/heads/staging' | ||
uses: 18F/analytics-reporter/.github/workflows/deploy.yml@develop | ||
with: | ||
ANALYTICS_KEY_FILE_NAME: ${{ vars.ANALYTICS_KEY_FILE_NAME }} | ||
ANALYTICS_REPORT_EMAIL: ${{ vars.ANALYTICS_REPORT_EMAIL }} | ||
APP_NAME: ${{ vars.APP_NAME_STG }} | ||
CF_ORGANIZATION_NAME: ${{ vars.CF_ORGANIZATION_NAME }} | ||
CF_SPACE_NAME: ${{ vars.CF_SPACE_NAME_STG }} | ||
DB_SERVICE_NAME: ${{ vars.DB_SERVICE_NAME_STG }} | ||
NEW_RELIC_APP_NAME: ${{ vars.NEW_RELIC_APP_NAME_STG }} | ||
S3_SERVICE_NAME: ${{ vars.S3_SERVICE_NAME_STG }} | ||
secrets: | ||
ANALYTICS_CREDENTIALS: ${{ secrets.ANALYTICS_CREDENTIALS }} | ||
CF_USERNAME: ${{ secrets.CF_USERNAME_STG }} | ||
CF_PASSWORD: ${{ secrets.CF_PASSWORD_STG }} | ||
GA4_CREDS: ${{ secrets.GA4_CREDS }} | ||
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_STG }} | ||
deploy_prd: | ||
needs: | ||
- lint | ||
- test | ||
if: github.ref == 'refs/heads/master' | ||
uses: 18F/analytics-reporter/.github/workflows/deploy.yml@develop | ||
with: | ||
ANALYTICS_KEY_FILE_NAME: ${{ vars.ANALYTICS_KEY_FILE_NAME }} | ||
ANALYTICS_REPORT_EMAIL: ${{ vars.ANALYTICS_REPORT_EMAIL }} | ||
APP_NAME: ${{ vars.APP_NAME_PRD }} | ||
CF_ORGANIZATION_NAME: ${{ vars.CF_ORGANIZATION_NAME }} | ||
CF_SPACE_NAME: ${{ vars.CF_SPACE_NAME_PRD }} | ||
DB_SERVICE_NAME: ${{ vars.DB_SERVICE_NAME_PRD }} | ||
NEW_RELIC_APP_NAME: ${{ vars.NEW_RELIC_APP_NAME_PRD }} | ||
S3_SERVICE_NAME: ${{ vars.S3_SERVICE_NAME_PRD }} | ||
secrets: | ||
ANALYTICS_CREDENTIALS: ${{ secrets.ANALYTICS_CREDENTIALS }} | ||
CF_USERNAME: ${{ secrets.CF_USERNAME_PRD }} | ||
CF_PASSWORD: ${{ secrets.CF_PASSWORD_PRD }} | ||
GA4_CREDS: ${{ secrets.GA4_CREDS }} | ||
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_PRD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
ANALYTICS_KEY_FILE_NAME: | ||
required: true | ||
type: string | ||
ANALYTICS_REPORT_EMAIL: | ||
required: true | ||
type: string | ||
APP_NAME: | ||
required: true | ||
type: string | ||
CF_ORGANIZATION_NAME: | ||
required: true | ||
type: string | ||
CF_SPACE_NAME: | ||
required: true | ||
type: string | ||
DB_SERVICE_NAME: | ||
required: true | ||
type: string | ||
NEW_RELIC_APP_NAME: | ||
type: string | ||
S3_SERVICE_NAME: | ||
required: true | ||
type: string | ||
secrets: | ||
ANALYTICS_CREDENTIALS: | ||
required: true | ||
CF_USERNAME: | ||
required: true | ||
CF_PASSWORD: | ||
required: true | ||
GA4_CREDS: | ||
required: true | ||
NEW_RELIC_LICENSE_KEY: | ||
|
||
env: | ||
ANALYTICS_CREDENTIALS: ${{ secrets.ANALYTICS_CREDENTIALS }} | ||
ANALYTICS_KEY_FILE_NAME: ${{ inputs.ANALYTICS_KEY_FILE_NAME }} | ||
ANALYTICS_REPORT_EMAIL: ${{ inputs.ANALYTICS_REPORT_EMAIL }} | ||
APP_NAME: ${{ inputs.APP_NAME }} | ||
CF_USERNAME: ${{ secrets.CF_USERNAME }} | ||
CF_PASSWORD: ${{ secrets.CF_PASSWORD }} | ||
CF_ORGANIZATION_NAME: ${{ inputs.CF_ORGANIZATION_NAME }} | ||
CF_SPACE_NAME: ${{ inputs.CF_SPACE_NAME }} | ||
DB_SERVICE_NAME: ${{ inputs.DB_SERVICE_NAME }} | ||
GA4_CREDS: ${{ secrets.GA4_CREDS }} | ||
NEW_RELIC_APP_NAME: ${{ inputs.NEW_RELIC_APP_NAME }} | ||
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }} | ||
S3_SERVICE_NAME: ${{ inputs.S3_SERVICE_NAME }} | ||
|
||
jobs: | ||
deploy_reporter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v4 | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
cache: 'npm' | ||
- name: Install node dependencies | ||
run: npm ci | ||
- name: Install cloud foundry CLI for interacting with cloud.gov | ||
run: | | ||
sudo curl -v -L -o cf8-cli-installer_8.7.4_x86-64.deb 'https://packages.cloudfoundry.org/stable?release=debian64&version=8.7.4' | ||
sudo dpkg -i cf8-cli-installer_8.7.4_x86-64.deb | ||
- name: Write Google GA4 Credentials file from the value in GA4_CREDS env var. | ||
run: | | ||
echo $GA4_CREDS > ./my-analytics-ga4-65057af58daa.json | ||
- name: Run envsubst on manifest.yml to set environment specific values | ||
run: | | ||
mv manifest.yml manifest.yml.src | ||
envsubst < manifest.yml.src > manifest.yml | ||
cat manifest.yml | ||
- name: Replace config.js and knexfile.js with .cloudgov versions of those files | ||
run: | | ||
rm ./src/config.js | ||
mv ./src/config.cloudgov.js ./src/config.js | ||
rm knexfile.js | ||
mv knexfile.cloudgov.js knexfile.js | ||
- name: Login to cloud.gov and deploy | ||
run: | | ||
set -e | ||
# Log into cloud.gov | ||
cf api api.fr.cloud.gov | ||
cf login -u $CF_USERNAME -p $CF_PASSWORD -o $CF_ORGANIZATION_NAME -s $CF_SPACE_NAME | ||
cf push -f "./manifest.yml" --strategy rolling | ||
cf logout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
npm-debug.log | ||
*.swp | ||
.git | ||
/.nyc_output | ||
|
||
# Track selected JSON files | ||
!package.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { configs: eslintConfigs } = require("@eslint/js"); | ||
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended"); | ||
const globals = require("globals"); | ||
|
||
module.exports = [ | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
...globals.mocha, | ||
}, | ||
}, | ||
}, | ||
{ | ||
// UA code is deprecated, so don't bother with static analysis rules. | ||
ignores: ["ua/**/*.js"], | ||
...eslintConfigs.recommended, | ||
}, | ||
eslintPluginPrettierRecommended, | ||
]; |
Oops, something went wrong.