Skip to content

[LG-64] - update docs for domains #86

[LG-64] - update docs for domains

[LG-64] - update docs for domains #86

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
env:
MAVEN_DIR: ./
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
- name: Install xmllint
run: |
sudo apt-get update
sudo apt-get install -y libxml2-utils
- name: Check if pom.xml exists
run: |
if [ ! -f "${{ env.MAVEN_DIR }}/pom.xml" ]; then
echo "Error: pom.xml not found in the specified directory: ${{ env.MAVEN_DIR }}"
exit 1
fi
- name: Extract Maven coordinates from pom.xml
id: extract_maven_coordinates
run: |
if ! command -v xmllint &> /dev/null; then
echo "xmllint could not be found, exiting..."
exit 1
fi
GROUP_ID=$(xmllint --xpath 'string(//*[local-name()="project"]/*[local-name()="groupId"])' pom.xml)
ARTIFACT_ID=$(xmllint --xpath 'string(//*[local-name()="project"]/*[local-name()="artifactId"])' pom.xml)
VERSION=$(xmllint --xpath 'string(//*[local-name()="project"]/*[local-name()="version"])' pom.xml)
IMAGE_NAME="${GROUP_ID}/${ARTIFACT_ID}:${VERSION}"
if [[ -z "$GROUP_ID" || -z "$ARTIFACT_ID" || -z "$VERSION" ]]; then
echo "Error: One or more Maven coordinates (GROUP_ID, ARTIFACT_ID, VERSION) could not be extracted."
exit 1
fi
echo "GROUP_ID=$GROUP_ID" > maven_details.env
echo "ARTIFACT_ID=$ARTIFACT_ID" >> maven_details.env
echo "VERSION=$VERSION" >> maven_details.env
echo "IMAGE_NAME=$IMAGE_NAME" >> maven_details.env
echo "Extracted GROUP_ID: $GROUP_ID"
echo "Extracted ARTIFACT_ID: $ARTIFACT_ID"
echo "Extracted VERSION: $VERSION"
echo "Extracted IMAGE_NAME: $IMAGE_NAME"
- name: Upload Maven details artifact
uses: actions/upload-artifact@v4
with:
name: maven-details
path: maven_details.env
- name: Configure Maven settings.xml
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.PKG_GITHUB_TOKEN }}
run: |
cat > ~/.m2/settings.xml <<EOF
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>github</id>
<username>${GITHUB_USERNAME}</username>
<password>${GITHUB_TOKEN}</password>
</server>
</servers>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/lg-labs-pentagon/*</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
</settings>
EOF
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
checkstyle:
name: Checkstyle
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
- name: Restore Maven Cache
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Run Checkstyle
run: make run-checkstyle
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
- name: Restore Maven Cache
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Install Graphviz
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Run verify using Makefile
run: make run-verify
- name: List files in target directory
run: ls -al ./blank-support/target/site
- name: Upload Test reports
uses: actions/upload-artifact@v4
with:
name: test-reports
path: ./blank-support/target/site/jacoco-aggregate-all
quality:
name: Quality
runs-on: ubuntu-latest
needs: [ checkstyle, coverage ]
steps:
- uses: actions/checkout@v4
- name: Download Test reports
uses: actions/download-artifact@v4
with:
name: test-reports
path: ./site
- name: Confirmation
run: ls -R
- name: Download Codacy Coverage Reporter
run: |
COV_REPORTER_VERSION=$(curl -s https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | grep tag_name | cut -d '"' -f 4)
wget -O codacy-coverage-reporter "https://github.com/codacy/codacy-coverage-reporter/releases/download/${COV_REPORTER_VERSION}/codacy-coverage-reporter-linux"
chmod +x codacy-coverage-reporter
- name: Confirmation
run: echo "Sent report to Sonar or Codacy... "
build:
name: Build
runs-on: ubuntu-latest
needs: [ checkstyle, coverage ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
- name: Install Graphviz
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Restore Maven Cache
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download Maven details artifact
uses: actions/download-artifact@v4
with:
name: maven-details
path: .
- name: Load Maven details
run: |
set -a
source maven_details.env
set +a
echo "Loaded GROUP_ID: $GROUP_ID, ARTIFACT_ID: $ARTIFACT_ID, VERSION: $VERSION, IMAGE_NAME: $IMAGE_NAME"
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV # <-- Export IMAGE_NAME to the GitHub environment
echo "GROUP_ID=$GROUP_ID" >> $GITHUB_ENV # <-- Export GROUP_ID to the GitHub environment
- name: Build and run tests using Makefile
run: make install-skip-test
- name: Show docker image
run: |
echo "${{ env.GROUP_ID }}"
docker image list | grep ${{ env.GROUP_ID }}
- name: Save Docker image
run: |
docker save -o blank-service-image.tar ${{ env.IMAGE_NAME }}
- name: Upload Docker image as artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: blank-service-image.tar
- name: Upload dependency-graph.png as artifact
uses: actions/upload-artifact@v4
with:
name: dependency-graph
path: ./target/dependency-graph.png
- name: Upload firebase.json as artifact
uses: actions/upload-artifact@v4
with:
name: firebase-json
path: ./firebase.json
test:
name: Acceptance Test
runs-on: ubuntu-latest
needs: build
env:
APPLICATION_TRACES_FILE_ENABLED: "false"
APPLICATION_LOG_ENABLED: "false"
APPLICATION_LOG_SOURCE_PATH: "/logs"
APPLICATION_LOG_DESTINATION_PATH: "./target/logs"
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
- name: Install Graphviz
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: docker-image
path: .
- name: Load Docker image
run: docker load -i blank-service-image.tar
- name: Show docker image
run: docker image list | grep com.
- name: Restore Maven Cache
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Run acceptance tests using Makefile
run: make run-atdd-module
- name: List files in target directory
run: ls -R ./blank-acceptance-test/target/
- name: List files in parent target directory
run: ls -R ./
- name: Upload Cucumber Report
uses: actions/upload-artifact@v4
with:
name: cucumber-report
path: ./blank-acceptance-test/target/atdd-reports/cucumber-reports.html
openapi:
name: OpenAPI
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Download docker compose
run: sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- name: Permissions to docker compose
run: sudo chmod +x /usr/local/bin/docker-compose
- name: Generate docs to OpenAPI as html
run: make openapi-gen-html-up
- name: List files in target directory
run: ls -al ./blank-support/openapi
- name: Upload OpenAPI artifact
uses: actions/upload-artifact@v4
with:
name: openapi-doc
path: ./blank-support/openapi
asyncapi:
name: AsyncAPI
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Download docker compose
run: sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- name: Permissions to docker compose
run: sudo chmod +x /usr/local/bin/docker-compose
- name: Generate docs to asyncapi as html
run: make asyncapi-gen-html-up
- name: Display structure of downloaded files
run: ls -al ./blank-support/asyncapi
- name: Upload AsyncAPI artifact
uses: actions/upload-artifact@v4
with:
name: asyncapi-doc
path: ./blank-support/asyncapi
docs:
name: Docs
runs-on: ubuntu-latest
needs: [ test, visualization ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5.1.0
with:
python-version: 3.x
- uses: actions/cache@v4.0.2
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: pip install pillow cairosvg
- name: Download dependency-graph
uses: actions/download-artifact@v4
with:
name: dependency-graph
path: ./blank-support/app/docs/img
- name: Download Gource
uses: actions/download-artifact@v4
with:
name: gource
path: ./blank-support/app/docs/video
- run: cd ./blank-support/app && mkdocs build
- name: Display structure of downloaded files
run: ls -R ./blank-support/app
- name: Upload MkDocs artifact
uses: actions/upload-artifact@v4
with:
name: mkdocs
path: ./blank-support/app/site
visualization:
name: Visualization
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Gource-Action
uses: NBprojekt/gource-action@v1.2.1
with:
gource_title: ${{ github.repository }}
gource_resolution: '2160p'
gource_fps: 30
gource_font_size: 10
gource_background_color: 555555
- uses: actions/upload-artifact@v4
with:
name: gource
path: ./gource/gource.mp4