Skip to content

chore: rename UsersSubscriptionAlreadyExistsException.class #14

chore: rename UsersSubscriptionAlreadyExistsException.class

chore: rename UsersSubscriptionAlreadyExistsException.class #14

Workflow file for this run

name: CI Pipeline with Maven
on:
push:
branches:
- dev
pull_request:
branches:
- dev
- master
permissions:
contents: write
pull-requests: write
jobs:
test-coverage:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
ports:
- 5433:5432
options: >-
--health-cmd "pg_isready -U postgres -d subscription_service_app"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Grant execute permission for mvnw
run: chmod +x mvnw
- name: Build with Maven
run: ./mvnw clean -B package --file pom.xml -Dspring.profiles.active=dev
- name: Switch to coverage-badge branch
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git fetch origin coverage-badge || echo "Branch not found, creating a new one"
if git rev-parse --verify origin/coverage-badge; then
echo "Branch 'coverage-badge' exists, switching to it."
git checkout coverage-badge
else
echo "Branch 'coverage-badge' does not exist, creating and switching to it."
git checkout --orphan coverage-badge
fi
- name: Generate coverage badge
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: target/jacoco-report/jacoco.csv
badges-directory: .github/badges
- name: Commit and push badge (only if changed)
run: |
git add .github/badges/jacoco.svg
git status
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Update test coverage badge"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/tennyros/subscription-service.git coverage-badge --force
fi
- name: Upload Jacoco coverage report
if: github.actor != 'nektos/act' # check for local GitHub act
uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: target/jacoco-report/
- name: Send Telegram notification
if: always()
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
STATUS="${{ job.status }}"
MESSAGE="🚀 CI Pipeline Status: ${STATUS}
Project: \#$(basename ${{ github.repository }} | sed 's/-/\\-/g')
Branch: \`${{ github.ref }}\`
Commit: \`${{ github.sha }}\`
[Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d "chat_id=${TELEGRAM_CHAT_ID}" \
-d "text=${MESSAGE}" \
-d "parse_mode=MarkdownV2"