Public Access
Add project bootstrap for build, CI/CD, and local development. Introduces Maven Wrapper (mvnw, mvnw.cmd, .mvn/wrapper), multi-stage Dockerfile, docker-compose files (compose.yaml, docker-compose.dev.yml), .env, banner and README. Adds Gitea Actions workflow to build, test and push container images. Update application.yml (port -> 8090, virtual threads, API versioning, management/actuator/prometheus settings, Steam API config) and add application-dev.yml for local overrides. Extend pom.xml with caching, observability (actuator, micrometer/prometheus), testing/dev dependencies (testcontainers, devtools, additional spring test modules) to support CI and local testing.
75 lines
2.4 KiB
YAML
75 lines
2.4 KiB
YAML
name: Build, Test & Push Core Service
|
|
|
|
# Trigger the workflow
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
# ------------------------------------------------------------------
|
|
# JOB 1: Code integrity and quality gates (CI)
|
|
# ------------------------------------------------------------------
|
|
quality-check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java 25
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'temurin'
|
|
# Automatically cache Maven dependencies to speed up builds
|
|
cache: 'maven'
|
|
|
|
- name: Make Maven Wrapper executable
|
|
# This fixes the "Permission denied" error on Linux runners
|
|
run: chmod +x mvnw
|
|
|
|
- name: Build and Test with Maven Wrapper
|
|
# Uses the wrapper to guarantee the correct Maven version
|
|
run: ./mvnw clean verify
|
|
|
|
# ------------------------------------------------------------------
|
|
# JOB 2: Docker Build & Push (CD)
|
|
# Runs only if 'quality-check' is successful and we are on branch main
|
|
# ------------------------------------------------------------------
|
|
docker:
|
|
needs: quality-check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Prepare tag
|
|
id: prep
|
|
shell: bash
|
|
run: |
|
|
# Sanitize branch name for valid Docker tags
|
|
BRANCH="${GITHUB_REF_NAME}"
|
|
BRANCH="${BRANCH//\//-}"
|
|
BRANCH="$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]')"
|
|
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
|
|
echo "sha=${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.andreas-dahm.eu
|
|
# Use your Gitea Secrets here
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.TOKEN_GITEA }}
|
|
|
|
- name: Build & Push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
git.andreas-dahm.eu/lobo_corp/tbp-core-service:${{ steps.prep.outputs.branch }}
|
|
git.andreas-dahm.eu/lobo_corp/tbp-core-service:${{ steps.prep.outputs.branch }}-${{ steps.prep.outputs.sha }}
|
|
git.andreas-dahm.eu/lobo_corp/tbp-core-service:latest |