You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.2 KiB

name: Continuous Integration
on:
pull_request:
branches: ["*", series/*]
push:
branches: ["*", series/*]
tags: [v*]
jobs:
# Label of the container job
build:
name: Build and Test
runs-on: ubuntu-latest
# container: node:12-buster
env:
CODEGEN_DB_HOST: localhost
CODEGEN_DB_PORT: 5432
CODEGEN_DB_USER: codegenuser
CODEGEN_DB_PASSWORD: postgres
CODEGEN_DB_NAME: codegendb
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: codegenuser
POSTGRES_DB: codegendb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- 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
- name: Migrate
run: csbt flyway/flywayMigrate
- name: Compile
run: |
csbt "compile; test:compile"
- name: Run Tests
run: |
echo $GITHUB_REF
echo ${GITHUB_REF#refs/*/}
csbt test
publish:
name: Publish Release Docker Image
needs: [build]
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
# container: node:12-buster
env:
CODEGEN_DB_HOST: localhost
CODEGEN_DB_PORT: 5432
CODEGEN_DB_USER: codegenuser
CODEGEN_DB_PASSWORD: postgres
CODEGEN_DB_NAME: codegendb
DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: codegenuser
POSTGRES_DB: codegendb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- 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
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: rohansircar
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
- name: Migrate
run: csbt flyway/flywayMigrate
- name: Publish
run: |
csbt docker:publish
publish-devel:
name: Publish Devel Docker Image
needs: [build]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/devel'
runs-on: ubuntu-latest
# container: node:12-buster
env:
CODEGEN_DB_HOST: localhost
CODEGEN_DB_PORT: 5432
CODEGEN_DB_USER: codegenuser
CODEGEN_DB_PASSWORD: postgres
CODEGEN_DB_NAME: codegendb
DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
DOCKER_PUBLISH_TAG: latest
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: codegenuser
POSTGRES_DB: codegendb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- 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
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: rohansircar
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
- name: Migrate
run: csbt flyway/flywayMigrate
- name: Publish
run: |
csbt docker:publish