Skip to content

fix: Balance history calculation (#93) #222

fix: Balance history calculation (#93)

fix: Balance history calculation (#93) #222

name: Lint, Test and Docker Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
prepare-dependencies:
name: Prepare local deps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: prepare-env
uses: ./.github/actions/prepare-local-env
- name: Install dependencies
if: steps.prepare-env.outputs.cache-hit != 'true'
run: npm ci
lint:
name: Lint source code
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/prepare-local-env
- name: Lint source code
run: npm run lint
tests:
name: Unit and e2e testing
needs: prepare-dependencies
runs-on: ubuntu-latest
environment: test
services:
postgres:
image: postgres:11.12-stretch
env:
POSTGRES_DB: budget-tracker_test
POSTGRES_USER: ${{ secrets.CI_POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.CI_POSTGRES_PASSWORD }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/prepare-local-env
- name: Make envfile
uses: SpicyPizza/create-envfile@v1
with:
envkey_APPLICATION_HOST: ${{ secrets.APPLICATION_HOST }}
envkey_APPLICATION_PORT: ${{ secrets.APPLICATION_PORT }}
envkey_APPLICATION_JWT_SECRET: ${{ secrets.APPLICATION_JWT_SECRET }}
envkey_APPLICATION_DB_HOST: ${{ secrets.APPLICATION_DB_HOST }}
envkey_APPLICATION_DB_USERNAME: ${{ secrets.APPLICATION_DB_USERNAME }}
envkey_APPLICATION_DB_PASSWORD: ${{ secrets.APPLICATION_DB_PASSWORD }}
envkey_APPLICATION_DB_DATABASE: ${{ secrets.APPLICATION_DB_DATABASE }}
envkey_APPLICATION_DB_PORT: ${{ secrets.APPLICATION_DB_PORT }}
envkey_APPLICATION_DB_DIALECT: ${{ secrets.APPLICATION_DB_DIALECT }}
envkey_APPLICATION_REDIS_HOST: ${{ secrets.APPLICATION_REDIS_HOST }}
directory: ./
file_name: .env.test
- name: Unit and e2e testing
run: npm run test
docker-build:
name: Build source code using Docker
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v2
- name: Make envfile
uses: SpicyPizza/create-envfile@v1
with:
envkey_APPLICATION_HOST: ${{ secrets.APPLICATION_HOST }}
envkey_APPLICATION_PORT: ${{ secrets.APPLICATION_PORT }}
envkey_APPLICATION_JWT_SECRET: ${{ secrets.APPLICATION_JWT_SECRET }}
envkey_APPLICATION_DB_HOST: ${{ secrets.APPLICATION_DB_HOST }}
envkey_APPLICATION_DB_USERNAME: ${{ secrets.APPLICATION_DB_USERNAME }}
envkey_APPLICATION_DB_PASSWORD: ${{ secrets.APPLICATION_DB_PASSWORD }}
envkey_APPLICATION_DB_DATABASE: ${{ secrets.APPLICATION_DB_DATABASE }}
envkey_APPLICATION_DB_PORT: ${{ secrets.APPLICATION_DB_PORT }}
envkey_APPLICATION_DB_DIALECT: ${{ secrets.APPLICATION_DB_DIALECT }}
envkey_APPLICATION_REDIS_HOST: ${{ secrets.APPLICATION_REDIS_HOST }}
directory: ./
file_name: .env.production
- uses: ./.github/actions/docker-build
with:
docker-hub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-hub-access-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}