Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,63 +91,3 @@ jobs:
rm -rf *.key
rm -rf *.txt
git clean -fX

coverage-badge:
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout Repository
uses: actions/checkout@v7

- name: Set up JDK
uses: actions/setup-java@v6.0.1
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'

- name: Run tests with coverage
run: ./mvnw -B verify

- name: Create badge file
run: |
mkdir -p badge
python3 - <<'PY'
import csv, json
rows = list(csv.DictReader(open('target/site/jacoco/jacoco.csv')))
covered = sum(int(r['INSTRUCTION_COVERED']) for r in rows)
missed = sum(int(r['INSTRUCTION_MISSED']) for r in rows)
pct = round(100 * covered / (covered + missed))
color = ('brightgreen' if pct >= 90 else 'green' if pct >= 80 else
'yellowgreen' if pct >= 70 else 'yellow' if pct >= 60 else
'orange' if pct >= 50 else 'red')
json.dump({'schemaVersion': 1, 'label': 'coverage',
'message': f'{pct}%', 'color': color},
open('badge/coverage.json', 'w'))
PY
cat badge/coverage.json

- name: Publish badge to badges branch
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin badges || true
if git rev-parse --verify origin/badges >/dev/null 2>&1; then
git worktree add badges-wt origin/badges
else
git worktree add --detach badges-wt
git -C badges-wt checkout --orphan badges
git -C badges-wt rm -rf . >/dev/null
fi
cp badge/coverage.json badges-wt/coverage.json
cd badges-wt
git add coverage.json
if git diff --cached --quiet; then
echo "Badge unchanged"
else
git commit -m "Update coverage badge"
git push origin HEAD:badges
fi
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# JavaCrypt

[![Test](https://github.com/eskopp/JavaCrypt/actions/workflows/test.yml/badge.svg)](https://github.com/eskopp/JavaCrypt/actions/workflows/test.yml)
[![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/eskopp/JavaCrypt/badges/coverage.json)](https://github.com/eskopp/JavaCrypt/actions/workflows/test.yml)

A small command-line tool for RSA file encryption, decryption, key generation, and plain file copying.

Expand Down
Loading