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

179 lines
5.0 KiB
YAML
Raw Permalink Normal View History

2021-04-23 10:58:57 +00:00
---
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-19 10:35:48 +00:00
paths-ignore:
- ".dockerignore"
- ".github/workflow/ci.yml"
- "Changelog.md"
- "Dockerfile"
- "doc/**"
- "docker/**"
- "LICENSE"
- "README.md"
# - "tests/e2e/**"
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*]
2021-04-19 10:35:48 +00:00
paths-ignore:
- ".dockerignore"
- ".github/workflow/ci.yml"
- "Changelog.md"
- "Dockerfile"
- "doc/**"
- "docker/**"
- "LICENSE"
- "README.md"
# - "tests/e2e/**"
2021-04-17 13:33:30 +00:00
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
env:
2021-05-05 06:30:21 +00:00
HTTP4S_DEMO_CODEGEN_DB_HOST: localhost
HTTP4S_DEMO_CODEGEN_DB_PORT: 5432
HTTP4S_DEMO_CODEGEN_DB_USER: codegenuser
HTTP4S_DEMO_CODEGEN_DB_PASSWORD: postgres
HTTP4S_DEMO_CODEGEN_DB_NAME: codegendb
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: Migrate
run: csbt flyway/flywayMigrate
2021-04-18 12:28:22 +00:00
- name: Lint
2021-05-06 18:10:01 +00:00
run: csbt lint-check
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-19 10:35:48 +00:00
- name: Run Unit Tests
2021-04-17 13:33:30 +00:00
run: |
2021-04-17 15:55:42 +00:00
csbt test
2021-04-19 10:35:48 +00:00
- name: Run Integration Tests
run: |
csbt it:test
2021-04-17 13:33:30 +00:00
publish:
name: Publish Release Docker Image
needs: [build]
2021-04-23 10:59:45 +00:00
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
2021-04-17 13:33:30 +00:00
runs-on: ubuntu-latest
env:
2021-05-05 06:30:21 +00:00
HTTP4S_DEMO_CODEGEN_DB_HOST: localhost
HTTP4S_DEMO_CODEGEN_DB_PORT: 5432
HTTP4S_DEMO_CODEGEN_DB_USER: codegenuser
HTTP4S_DEMO_CODEGEN_DB_PASSWORD: postgres
HTTP4S_DEMO_CODEGEN_DB_NAME: codegendb
HTTP4S_DEMO_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
- name: Publish Tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
csbt docker:publish
- name: Publish Latest
if: github.ref == 'refs/heads/main'
env:
DOCKER_PUBLISH_TAG: latest
2021-04-17 13:33:30 +00:00
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
env:
2021-05-05 06:30:21 +00:00
HTTP4S_DEMO_CODEGEN_DB_HOST: localhost
HTTP4S_DEMO_CODEGEN_DB_PORT: 5432
HTTP4S_DEMO_CODEGEN_DB_USER: codegenuser
HTTP4S_DEMO_CODEGEN_DB_PASSWORD: postgres
HTTP4S_DEMO_CODEGEN_DB_NAME: codegendb
HTTP4S_DEMO_DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
HTTP4S_DEMO_DOCKER_PUBLISH_TAG: devel
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