Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions for lint and test #236

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 0 additions & 197 deletions .circleci/config.yml

This file was deleted.

126 changes: 126 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
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: Create Checksum of package.json
run: echo PACKAGE_CHECKSUM="$(shasum package.json | awk '{ print $1 }')" >> "$GITHUB_ENV"
- name: Restore Cache
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: v1-dependencies-${{ env.PACKAGE_CHECKSUM }}
- name: Install Dependencies
run: npm install
- name: Save Cache
uses: actions/cache/save@v4
id: cache
with:
path: ./node_modules
key: v1-dependencies-${{ env.PACKAGE_CHECKSUM }}
- 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: Create Checksum of package.json
run: echo PACKAGE_CHECKSUM="$(shasum package.json | awk '{ print $1 }')" >> "$GITHUB_ENV"
- name: Restore Cache
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: v1-dependencies-${{ env.PACKAGE_CHECKSUM }}
- name: Install Dependencies
run: npm install
- name: Save Cache
uses: actions/cache/save@v4
id: cache
with:
path: ./node_modules
key: v1-dependencies-${{ env.PACKAGE_CHECKSUM }}
- 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 }}
Loading
Loading