Skip to content

chore(deps): update gradle to v8.14.4 - autoclosed #532

chore(deps): update gradle to v8.14.4 - autoclosed

chore(deps): update gradle to v8.14.4 - autoclosed #532

Workflow file for this run

name: Pull Request Workflow
on: [ pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'corretto'
cache: 'gradle'
- name: Install dependencies
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev
- name: Build and test
run: ./gradlew allTests
- name: Generate coverage report
run: ./gradlew koverXmlReport
- name: Upload coverage report
uses: actions/upload-artifact@v6
with:
name: coverage-report
path: build/reports/kover/report.xml
- name: Build release binaries
run: ./gradlew prepareReleaseBinaries
- name: Upload x64 binary
uses: actions/upload-artifact@v6
with:
name: changelog-cli-x64
path: build/release/changelog-cli-x64
- name: Upload ARM64 binary
uses: actions/upload-artifact@v6
with:
name: changelog-cli-arm64
path: build/release/changelog-cli-arm64
verify-x64:
name: Verify x64 binary
runs-on: ubuntu-latest
needs: build
steps:
- name: Download x64 binary
uses: actions/download-artifact@v7
with:
name: changelog-cli-x64
- name: Make binary executable
run: chmod +x changelog-cli-x64
- name: Test binary
run: ./changelog-cli-x64 --help
verify-arm64:
name: Verify ARM64 binary
runs-on: ubuntu-24.04-arm
needs: build
steps:
- name: Download ARM64 binary
uses: actions/download-artifact@v7
with:
name: changelog-cli-arm64
- name: Make binary executable
run: chmod +x changelog-cli-arm64
- name: Test binary
run: ./changelog-cli-arm64 --help
lint-workflows:
name: Lint GitHub Workflows
runs-on: linux-arm64
steps:
- uses: actions/checkout@v6
- name: Run actionlint
uses: reviewdog/action-actionlint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
filter_mode: nofilter
fail_level: error
static-code-analysis:
name: Static Code Analysis
runs-on: linux-arm64
timeout-minutes: 30
steps:
- name: Run detekt
uses: monta-app/detekt-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage-report:
name: Coverage Report
runs-on: linux-arm64
needs: build
permissions:
pull-requests: write
steps:
- name: Download coverage report
uses: actions/download-artifact@v7
with:
name: coverage-report
- name: Parse coverage and comment on PR
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const xml = fs.readFileSync('report.xml', 'utf8');
// Extract coverage metrics from XML - get the last occurrence (overall totals)
const getAllMatches = (regex) => [...xml.matchAll(regex)];
const instructionMatches = getAllMatches(/<counter type="INSTRUCTION" missed="(\d+)" covered="(\d+)"\/>/g);
const branchMatches = getAllMatches(/<counter type="BRANCH" missed="(\d+)" covered="(\d+)"\/>/g);
const lineMatches = getAllMatches(/<counter type="LINE" missed="(\d+)" covered="(\d+)"\/>/g);
const methodMatches = getAllMatches(/<counter type="METHOD" missed="(\d+)" covered="(\d+)"\/>/g);
const classMatches = getAllMatches(/<counter type="CLASS" missed="(\d+)" covered="(\d+)"\/>/g);
// Get the last match (overall total)
const instructionMatch = instructionMatches[instructionMatches.length - 1];
const branchMatch = branchMatches[branchMatches.length - 1];
const lineMatch = lineMatches[lineMatches.length - 1];
const methodMatch = methodMatches[methodMatches.length - 1];
const classMatch = classMatches[classMatches.length - 1];
const calcPercent = (covered, missed) => {
const total = parseInt(covered) + parseInt(missed);
return total > 0 ? ((parseInt(covered) / total) * 100).toFixed(2) : '0.00';
};
if (!lineMatch || !instructionMatch || !branchMatch || !methodMatch || !classMatch) {
throw new Error('Failed to parse coverage report. Some metrics were not found.');
}
const linePercent = calcPercent(lineMatch[2], lineMatch[1]);
const instructionPercent = calcPercent(instructionMatch[2], instructionMatch[1]);
const branchPercent = calcPercent(branchMatch[2], branchMatch[1]);
const methodPercent = calcPercent(methodMatch[2], methodMatch[1]);
const classPercent = calcPercent(classMatch[2], classMatch[1]);
const comment = `## Test Coverage Report 📊
| Metric | Coverage | Covered | Missed | Total |
|--------|----------|---------|--------|-------|
| **Lines** | **${linePercent}%** | ${lineMatch[2]} | ${lineMatch[1]} | ${parseInt(lineMatch[2]) + parseInt(lineMatch[1])} |
| **Instructions** | **${instructionPercent}%** | ${instructionMatch[2]} | ${instructionMatch[1]} | ${parseInt(instructionMatch[2]) + parseInt(instructionMatch[1])} |
| **Branches** | **${branchPercent}%** | ${branchMatch[2]} | ${branchMatch[1]} | ${parseInt(branchMatch[2]) + parseInt(branchMatch[1])} |
| **Methods** | **${methodPercent}%** | ${methodMatch[2]} | ${methodMatch[1]} | ${parseInt(methodMatch[2]) + parseInt(methodMatch[1])} |
| **Classes** | **${classPercent}%** | ${classMatch[2]} | ${classMatch[1]} | ${parseInt(classMatch[2]) + parseInt(classMatch[1])} |
Generated by Kover`;
// Find existing coverage comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' && comment.body.includes('Test Coverage Report')
);
// Update or create comment
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});
}