ci: added basic CI #36
@@ -12,6 +12,8 @@ jobs:
|
||||
name: Build & Test
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
artifact-name: ${{ steps.meta.outputs.artifact-name }}
|
||||
steps:
|
||||
@@ -28,23 +30,25 @@ jobs:
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@v6
|
||||
|
||||
- name: Build
|
||||
run: ./gradlew clean bootJar --stacktrace --no-daemon
|
||||
|
||||
- name: Test
|
||||
run: ./gradlew test --stacktrace --no-daemon
|
||||
- name: Run CI quality gate
|
||||
run: ./gradlew clean check bootJar --stacktrace --no-daemon
|
||||
|
||||
- name: Set artifact name
|
||||
id: meta
|
||||
run: echo "artifact-name=build-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload build artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ steps.meta.outputs.artifact-name }}
|
||||
path: |
|
||||
build/libs/*.jar
|
||||
build/reports/detekt/**
|
||||
build/reports/ktlint/**
|
||||
build/reports/jacoco/**
|
||||
build/reports/**
|
||||
build/test-results/**
|
||||
build/jacoco/**
|
||||
retention-days: 7
|
||||
if-no-files-found: error
|
||||
|
|
||||
|
||||
@@ -30,13 +30,16 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Validate Dockerfile
|
||||
- name: Build image (no push)
|
||||
if: inputs.push == false
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: ./Containerfile
|
||||
call: check
|
||||
push: false
|
||||
provenance: false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Log in to GHCR
|
||||
if: inputs.push == true
|
||||
@@ -65,7 +68,7 @@ jobs:
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
file: ./Containerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
@@ -29,9 +29,13 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
gh release create "${{ inputs.version }}" \
|
||||
--generate-notes \
|
||||
--title "${{ inputs.version }}"
|
||||
if gh release view "${{ inputs.version }}" >/dev/null 2>&1; then
|
||||
echo "Release ${{ inputs.version }} already exists. Skipping creation."
|
||||
else
|
||||
gh release create "${{ inputs.version }}" \
|
||||
--generate-notes \
|
||||
--title "${{ inputs.version }}"
|
||||
fi
|
||||
|
||||
- name: Send Telegram notification
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user
This step runs
always()butif-no-files-foundis set toerror, which can cause the job to fail (or add noisy secondary failures) when the Gradle build fails before producing reports/jars. Consider changingif-no-files-foundtowarnor only uploading artifacts when expected paths exist.