Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dt 613 conformance framework add ci cd pipeline #6

Merged
merged 23 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
webui
62 changes: 62 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Conformance-Gateway CI

on:
workflow_dispatch:
push:
branches:
- dev
pull_request:
branches: [ "dev" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: Conformance-Gateway
submodules: recursive

- name: Set up Java JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'

- name: Build Conformance-Gateway
run: |
cd Conformance-Gateway
find . -name "pom.xml" -exec mvn install -U -B -DskipTests -f '{}' \;

- name: Run the app
run: |
ls
cd Conformance-Gateway && docker-compose -f docker-compose.yml up -d -V --build

- name: Fetch Backend Status
run: |
sleep 10
status=$(curl -s http://localhost:8080/actuator/health | jq -r '.status')
retries=12

while [[ "$status" != "UP" ]] && [[ $retries -gt 0 ]]; do
echo "Status is '$status' - waiting 5 secs ($retries retries left)"
sleep 5
retries=$((retries - 1))
status=$(curl -s http://localhost:8080/actuator/health | jq -r '.status')
done

echo "Final status is '$status'"
if [[ "$status" != "UP" ]]; then
curl -v http://localhost:8080/actuator/health || :
exit 1
fi

echo "::set-output name=STATUS::$status"
id: healthcheck

- name: Confirm microservice status
if: ${{ steps.healthcheck.outputs.STATUS == 'UP' }}
run: |
echo "The Conformance-Gateway service is UP."
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM maven:3.8.5-openjdk-17-slim as builder

WORKDIR /build

COPY . .

RUN for pom in core booking ebl-issuance ebl-surrender sandbox spring-boot; do \
mvn install -U -B -DskipTests -f "$pom/pom.xml" || exit 1; \
done

FROM openjdk:17-alpine3.14

EXPOSE 8080

VOLUME /tmp

COPY --from=builder /build/spring-boot/target/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.5'

services:
conformance-gateway:
container_name: conformance-gateway
build:
.
ports:
- 8080:8080
4 changes: 4 additions & 0 deletions spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.dcsa.conformance</groupId>
<artifactId>sandbox</artifactId>
Expand Down