-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: [#28] First integration workflow
- Build and dockerise application - add actuator with liveness/readiness
- Loading branch information
Showing
5 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: V2 Build Docker | ||
|
||
on: push | ||
|
||
env: | ||
PE_BRANCH: feature/ci | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-version: ${{ steps.version-step.outputs.pe-version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
|
||
- name: Get current version | ||
id: version-step | ||
run: echo "::set-output name=pe-version::$(mvn -f pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)" | ||
|
||
- name: Print PE Version | ||
run: echo ${{ steps.version-step.outputs.pe-version }} | ||
|
||
- name: Build PE | ||
run: mvn package --no-transfer-progress | ||
|
||
- name: Upload PE jar | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: pe-jar | ||
path: target/*.jar | ||
|
||
docker: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download PE jar | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: pe-jar | ||
path: target/ | ||
|
||
- name: Publish to Docker Hub | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: inseefr/public-enemy-back-office | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
default_branch: feature/ci | ||
tags: ${{ needs.build.outputs.release-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Public enemy | ||
|
||
on: [push] | ||
jobs: | ||
sonarcloud: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: Cache Maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Build and analyze | ||
run: mvn clean verify sonar:sonar --no-transfer-progress | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM eclipse-temurin:17-jre-alpine | ||
WORKDIR /opt/pe/ | ||
COPY ./target/*.jar /opt/pe/pe.jar | ||
ENTRYPOINT ["java", "-jar", "/opt/pe/pe.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters