Skip to content

Bump docker/build-push-action from 3 to 5 #166

Bump docker/build-push-action from 3 to 5

Bump docker/build-push-action from 3 to 5 #166

name: Mimock Backend Pipeline
on:
push:
paths:
- 'mimock-backend/**'
- '.github/workflows/*-backend.yml'
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
name: Mimock Linter
runs-on: ubuntu-latest
env:
MIMOCK_CURRENT_VERSION: ${{ secrets.MIMOCK_CURRENT_VERSION }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Check format using checkstyle
working-directory: mimock-backend
run: ./mvnw -ntp -Drevision=$MIMOCK_CURRENT_VERSION checkstyle:check
- name: Generate checkstyle report
working-directory: mimock-backend
run: ./mvnw -ntp -Drevision=$MIMOCK_CURRENT_VERSION clean site
- name: Publish style report
uses: actions/upload-artifact@v2
with:
name: checkstyle-report
path: |
mimock-backend/target/site/css
mimock-backend/target/site/images
mimock-backend/target/site/checkstyle.html
test:
needs:
- lint
name: Test Mimock
runs-on: ubuntu-latest
env:
MIMOCK_CURRENT_VERSION: ${{ secrets.MIMOCK_CURRENT_VERSION }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run mimock tests in CI mode
working-directory: mimock-backend
run: ./mvnw -ntp clean initialize verify -P startDatabase -P coverage -Drevision=$MIMOCK_CURRENT_VERSION -Dspring.config.location=classpath:/application.yml
- name: Publish coverage report codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
commit_parent: ${{ github.sha }}
- name: Publish coverage report
uses: actions/upload-artifact@v2
with:
name: mimock-coverage-report
path: |
mimock-backend/target/site/jacoco/*
package-app:
needs:
- test
name: Package Mimock
runs-on: ubuntu-latest
env:
MIMOCK_CURRENT_VERSION: ${{ secrets.MIMOCK_CURRENT_VERSION }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build Mimock JAR
working-directory: mimock-backend
run: ./mvnw -ntp clean package -P packageJar -Drevision=$MIMOCK_CURRENT_VERSION -Dmaven.test.skip=true
- name: Publish JAR
uses: actions/upload-artifact@v2
with:
name: mimock-jar
path: |
mimock-backend/target/mimock-*.jar
- name: Build mimock docker image
run: |
docker build -t mimock-backend:${{ github.sha }} . -f ./Dockerfile.min && echo "Docker image build validated"
docker system prune && docker image prune --all