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 - name: Upload coverage reports if: always() uses: actions/upload-artifact@v4 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