Files
java-word-pdf/.gitea/workflows/pr.yml
T
Pjandro 3886b152e0
PR checks / web (pull_request) Successful in 39s
PR checks / java (pull_request) Has been cancelled
CI: upload-artifact v4 -> v3 — артефакт-сервер Gitea не поддерживает протокол v4
2026-10-24 18:41:51 +00:00

92 lines
2.8 KiB
YAML

name: PR checks
on:
pull_request:
workflow_dispatch:
jobs:
java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('pom.xml', 'wordpdf-core/pom.xml', 'wordpdf-app/pom.xml') }}
restore-keys: maven-
- name: Setup Maven 3.9.16
run: |
curl -fsSL https://dlcdn.apache.org/maven/maven-3/3.9.16/binaries/apache-maven-3.9.16-bin.tar.gz | tar xz -C /opt
echo "/opt/apache-maven-3.9.16/bin" >> "$GITHUB_PATH"
- name: Build and test (PMD gate included)
run: mvn -B clean verify
- name: Coverage summary
if: always()
run: |
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
import os
import xml.etree.ElementTree as ET
def pct(root, kind):
for c in root.findall("counter"):
if c.get("type") == kind:
missed, covered = int(c.get("missed")), int(c.get("covered"))
return f"{100.0 * covered / (missed + covered):.1f}%"
return "—"
print("## Покрытие (JaCoCo)\n")
print("| Модуль | Строки | Ветви | Порог строк |")
print("|---|---|---|---|")
for m in ("wordpdf-core", "wordpdf-app"):
p = f"{m}/target/site/jacoco/jacoco.xml"
if not os.path.exists(p):
print(f"| {m} | нет данных | — | 90% |")
continue
r = ET.parse(p).getroot()
print(f"| {m} | {pct(r, 'LINE')} | {pct(r, 'BRANCH')} | 90% |")
PY
# v3, не v4: артефакт-сервер Gitea говорит по протоколу actions/artifact v1,
# v4+ падает «not currently supported on GHES»
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v3
with:
name: jacoco-html
path: |
wordpdf-core/target/site/jacoco/
wordpdf-app/target/site/jacoco/
web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('wordpdf-web/package-lock.json') }}
restore-keys: npm-
- name: Install dependencies
working-directory: wordpdf-web
run: npm ci
- name: Build SPA
working-directory: wordpdf-web
run: npm run build
- name: Lint SPA
working-directory: wordpdf-web
run: npm run lint