-
Notifications
You must be signed in to change notification settings - Fork 3
100 lines (99 loc) · 2.93 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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 dependencies
run: npm ci
- name: lint javascript
run: npm run lint
test:
needs: lint
runs-on: ubuntu-latest
#Spin up postgres as a service, wait till healthy before moving on. 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 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-api/.github/workflows/deploy.yml@develop
with:
APP_NAME: ${{ vars.APP_NAME_DEV }}
DB_NAME: ${{ vars.DB_NAME_DEV }}
NEW_RELIC_APP_NAME:
ORGANIZATION_NAME: gsa-opp-analytics
SPACE_NAME: analytics-dev
secrets:
CF_USERNAME: ${{ secrets.CF_USERNAME_DEV }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD_DEV }}
API_DATA_GOV_SECRET: ${{ secrets.API_DATA_GOV_SECRET_DEV }}
NEW_RELIC_LICENSE_KEY:
deploy_stg:
needs:
- lint
- test
if: github.ref == 'refs/heads/staging'
uses: 18F/analytics-reporter-api/.github/workflows/deploy.yml@develop
with:
APP_NAME: ${{ vars.APP_NAME_STG }}
DB_NAME: ${{ vars.DB_NAME_STG }}
NEW_RELIC_APP_NAME:
ORGANIZATION_NAME: gsa-opp-analytics
SPACE_NAME: analytics-staging
secrets:
CF_USERNAME: ${{ secrets.CF_USERNAME_STG }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD_STG }}
API_DATA_GOV_SECRET: ${{ secrets.API_DATA_GOV_SECRET_STG }}
NEW_RELIC_LICENSE_KEY:
deploy_prd:
needs:
- lint
- test
if: github.ref == 'refs/heads/master'
uses: 18F/analytics-reporter-api/.github/workflows/deploy.yml@develop
with:
APP_NAME: ${{ vars.APP_NAME_PRD }}
DB_NAME: ${{ vars.DB_NAME_PRD }}
NEW_RELIC_APP_NAME: ${{ vars.NEW_RELIC_APP_NAME_PRD }}
ORGANIZATION_NAME: gsa-opp-analytics
SPACE_NAME: analytics-production
secrets:
CF_USERNAME: ${{ secrets.CF_USERNAME_PRD }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD_PRD }}
API_DATA_GOV_SECRET: ${{ secrets.API_DATA_GOV_SECRET_PRD }}
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_PRD }}