|
|
@ -1,18 +1,61 @@ |
|
|
|
name: Build |
|
|
|
name: PostgreSQL service example |
|
|
|
on: push |
|
|
|
|
|
|
|
jobs: |
|
|
|
# Label of the container job |
|
|
|
build: |
|
|
|
# Containers must run in Linux based operating systems |
|
|
|
runs-on: ubuntu-latest |
|
|
|
# Docker Hub image that `container-job` executes in |
|
|
|
container: node:12-buster |
|
|
|
env: |
|
|
|
# The hostname used to communicate with the PostgreSQL service container |
|
|
|
CODEGEN_DB_HOST: postgres |
|
|
|
# The default PostgreSQL port |
|
|
|
CODEGEN_DB_PORT: 5435 |
|
|
|
CODEGEN_DB_USER: codegenuser |
|
|
|
CODEGEN_DB_PASSWOD: postgres |
|
|
|
CODEGEN_DB_NAME: codegendb |
|
|
|
|
|
|
|
# Service containers to run with `container-job` |
|
|
|
services: |
|
|
|
# Label used to access the service container |
|
|
|
postgres: |
|
|
|
# Docker Hub image |
|
|
|
image: postgres |
|
|
|
# Provide the password for postgres |
|
|
|
env: |
|
|
|
POSTGRES_PASSWORD: postgres |
|
|
|
POSTGRES_USER: codegenuser |
|
|
|
POSTGRES_DB: codegendb |
|
|
|
port: |
|
|
|
- 5435:5432 |
|
|
|
# Set health checks to wait until postgres has started |
|
|
|
options: >- |
|
|
|
--health-cmd pg_isready |
|
|
|
--health-interval 10s |
|
|
|
--health-timeout 5s |
|
|
|
--health-retries 5 |
|
|
|
|
|
|
|
steps: |
|
|
|
- name: Checkout |
|
|
|
# Downloads a copy of the code in your repository before running CI tests |
|
|
|
- name: Check out repository code |
|
|
|
uses: actions/checkout@v2 |
|
|
|
|
|
|
|
# - name: Coursier cache |
|
|
|
# uses: coursier/cache-action@v6 |
|
|
|
- name: Setup |
|
|
|
uses: olafurpg/setup-scala@v10 |
|
|
|
with: |
|
|
|
java-version: adopt@1.11 |
|
|
|
# - run: sbt compile |
|
|
|
# - run: sbt test |
|
|
|
- run: ./build.sh |
|
|
|
# - name: Connect to PostgreSQL |
|
|
|
# # Runs a script that creates a PostgreSQL client, populates |
|
|
|
# # the client with data, and retrieves data |
|
|
|
# run: node client.js |
|
|
|
- name: Migrate |
|
|
|
run: csbt flyway/flywayMigrate |
|
|
|
- name: Run Tests |
|
|
|
run: csbt test |
|
|
|
- name: Package |
|
|
|
run: csbt docker:stage |
|
|
|
# Environment variable used by the `client.js` script to create a new PostgreSQL client. |