Skip to content

Commit

Permalink
[devops] Add PostgreSQL service to PR build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
koistya committed Feb 19, 2022
1 parent 0e5a810 commit cb4b958
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres

services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_USER: ${{ env.PGUSER }}
POSTGRES_PASSWORD: ${{ env.PGPASSWORD }}
POSTGRES_DB: ${{ env.PGDATABASE }}
ports:
- 5432:5432

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
Expand All @@ -37,8 +54,9 @@ jobs:
- run: yarn lint --no-cache

# Test
- run: yarn test
- run: yarn api:tsc
- run: yarn db:migrate
- run: yarn test

# Compile
- run: yarn api:build
Expand Down
2 changes: 1 addition & 1 deletion env/.prod.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PGDATABASE=app_prod
# PGSSLCERT=../db/ssl/client-cert.prod.pem
# PGSSLKEY=../db/ssl/client-key.prod.pem
# PGSSLROOTCERT=../db/ssl/server-ca.prod.pem
# PGSERVERNAME=example-prod:pg13
# PGSERVERNAME=example-prod:pg14

# Cloud storage bucket for user uploaded content and static assets
# https://console.cloud.google.com/storage/browser
Expand Down
2 changes: 1 addition & 1 deletion env/.test.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PGDATABASE=app_test
# PGSSLCERT=../db/ssl/client-cert.test.pem
# PGSSLKEY=../db/ssl/client-key.test.pem
# PGSSLROOTCERT=../db/ssl/server-ca.test.pem
# PGSERVERNAME=example-test:pg13
# PGSERVERNAME=example-test:pg14

# Cloud storage bucket for user uploaded content and static assets
# https://console.cloud.google.com/storage/browser
Expand Down
2 changes: 1 addition & 1 deletion setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const questions = [
return (
replace(`env/.${env}.env`, gcp, `$1=${value}`) &&
replace(`env/.${env}.env`, db, `$1=${dbName}`) &&
replace(`env/.${env}.env`, dbServer, `$1=${value}:pg13`) &&
replace(`env/.${env}.env`, dbServer, `$1=${value}:pg14`) &&
(env === "test"
? replace(`env/.local.env`, gcp, `$1=${value}`) &&
replace(`env/.local.env`, db, `$1=${localDb}`)
Expand Down

0 comments on commit cb4b958

Please sign in to comment.