http4s-demo/.github/workflows/ci.yaml

152 lines
4.2 KiB
YAML
Raw Normal View History

2021-04-17 13:33:30 +00:00
name: Continuous Integration
2021-04-17 15:39:16 +00:00
on:
2021-04-17 13:33:30 +00:00
pull_request:
2021-04-17 15:39:16 +00:00
branches: ["*", series/*]
2021-04-17 13:33:30 +00:00
push:
2021-04-17 15:39:16 +00:00
branches: ["*", series/*]
2021-04-17 13:33:30 +00:00
tags: [v*]
jobs:
# Label of the container job
build:
name: Build and Test
runs-on: ubuntu-latest
2021-04-17 15:39:16 +00:00
# container: node:12-buster
2021-04-17 13:33:30 +00:00
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
2021-04-17 15:39:16 +00:00
- name: Migrate
run: csbt flyway/flywayMigrate
2021-04-17 13:33:30 +00:00
- name: Compile
run: |
2021-04-17 15:39:16 +00:00
csbt "compile; test:compile"
2021-04-17 13:33:30 +00:00
- name: Run Tests
run: |
echo $GITHUB_REF
echo ${GITHUB_REF#refs/*/}
2021-04-17 15:55:42 +00:00
csbt test
2021-04-17 13:33:30 +00:00
publish:
name: Publish Release Docker Image
needs: [build]
2021-04-17 15:39:16 +00:00
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
2021-04-17 13:33:30 +00:00
runs-on: ubuntu-latest
2021-04-17 15:39:16 +00:00
# container: node:12-buster
2021-04-17 13:33:30 +00:00
env:
CODEGEN_DB_HOST: localhost
CODEGEN_DB_PORT: 5432
CODEGEN_DB_USER: codegenuser
CODEGEN_DB_PASSWORD: postgres
CODEGEN_DB_NAME: codegendb
2021-04-17 15:39:16 +00:00
DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
2021-04-17 13:33:30 +00:00
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
2021-04-17 15:39:16 +00:00
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: rohansircar
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
- name: Migrate
run: csbt flyway/flywayMigrate
2021-04-17 13:33:30 +00:00
- name: Publish
run: |
2021-04-17 15:55:42 +00:00
csbt docker:publish
2021-04-17 13:33:30 +00:00
publish-devel:
name: Publish Devel Docker Image
needs: [build]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/devel'
runs-on: ubuntu-latest
2021-04-17 15:39:16 +00:00
# container: node:12-buster
2021-04-17 13:33:30 +00:00
env:
CODEGEN_DB_HOST: localhost
CODEGEN_DB_PORT: 5432
CODEGEN_DB_USER: codegenuser
CODEGEN_DB_PASSWORD: postgres
CODEGEN_DB_NAME: codegendb
2021-04-17 15:39:16 +00:00
DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
DOCKER_PUBLISH_TAG: latest
2021-04-17 13:33:30 +00:00
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
2021-04-17 15:39:16 +00:00
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: rohansircar
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
- name: Migrate
run: csbt flyway/flywayMigrate
2021-04-17 13:33:30 +00:00
- name: Publish
run: |
2021-04-17 15:55:42 +00:00
csbt docker:publish