Skip to content

add docker build test on branches #16

add docker build test on branches

add docker build test on branches #16

Workflow file for this run

name: CI Branch
on:
push:
branches:
- '!1.0.x'
- 'ci-refactor'
# paths: ['src/**']
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build_test:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@11]
environment: dev
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
packages: write
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
- name: Install node 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Installing openapi-generator-cli
run: npm install -g @openapitools/openapi-generator-cli
- name: Build and test project
run: sbt ++${{ matrix.scala }} test
- name: Generate Docker target
run: sbt ++${{ matrix.scala }} docker:stage
- name: Normalize repo name
run: |
# github.reposiory is in the format "owner/repository-name", we need only the repo name
NORM_REPO="$(echo "${{ github.repository }}" | cut -d"/" -f2)"
echo "NORM_REPO=$NORM_REPO" >> "$GITHUB_ENV"
- name: Test Docker build
uses: docker/build-push-action@v2
with:
context: ./target/docker/stage
file: ./target/docker/stage/Dockerfile
push: false # just testing the build
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.NORM_REPO }}:${{ github.ref_name }}-latest
${{ steps.login-ecr.outputs.registry }}/${{ env.NORM_REPO }}:commit-${{ github.sha }}