Remove EncryptedFile no-created_at note from README #298
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '11' | |
| cache: gradle | |
| - name: Run tests with coverage | |
| run: ./gradlew --no-daemon clean test jacocoTestReport | |
| - name: Publish coverage summary | |
| if: always() | |
| run: | | |
| REPORT="build/reports/jacoco/test/jacocoTestReport.xml" | |
| if [ ! -f "$REPORT" ]; then | |
| { | |
| echo "## Test Coverage" | |
| echo | |
| echo "Coverage report was not generated (tests likely failed before JaCoCo report task completed)." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| LINE_VALUES=$(sed 's/></>\n</g' "$REPORT" | awk -F'"' '/<counter type="LINE"/ {m=$4; c=$6} END {print m" "c}') | |
| BRANCH_VALUES=$(sed 's/></>\n</g' "$REPORT" | awk -F'"' '/<counter type="BRANCH"/ {m=$4; c=$6} END {print m" "c}') | |
| LINE_MISSED=$(echo "$LINE_VALUES" | awk '{print $1+0}') | |
| LINE_COVERED=$(echo "$LINE_VALUES" | awk '{print $2+0}') | |
| LINE_TOTAL=$((LINE_MISSED + LINE_COVERED)) | |
| if [ "$LINE_TOTAL" -eq 0 ]; then | |
| LINE_PERCENT="0.00" | |
| else | |
| LINE_PERCENT=$(awk -v c="$LINE_COVERED" -v t="$LINE_TOTAL" 'BEGIN { printf "%.2f", (c*100)/t }') | |
| fi | |
| if [ -n "$BRANCH_VALUES" ]; then | |
| BRANCH_MISSED=$(echo "$BRANCH_VALUES" | awk '{print $1+0}') | |
| BRANCH_COVERED=$(echo "$BRANCH_VALUES" | awk '{print $2+0}') | |
| BRANCH_TOTAL=$((BRANCH_MISSED + BRANCH_COVERED)) | |
| if [ "$BRANCH_TOTAL" -eq 0 ]; then | |
| BRANCH_PERCENT="0.00" | |
| else | |
| BRANCH_PERCENT=$(awk -v c="$BRANCH_COVERED" -v t="$BRANCH_TOTAL" 'BEGIN { printf "%.2f", (c*100)/t }') | |
| fi | |
| else | |
| BRANCH_PERCENT="n/a" | |
| BRANCH_COVERED=0 | |
| BRANCH_TOTAL=0 | |
| fi | |
| { | |
| echo "## Test Coverage" | |
| echo | |
| echo "| Metric | Covered | Total | Coverage |" | |
| echo "|---|---:|---:|---:|" | |
| echo "| Line | $LINE_COVERED | $LINE_TOTAL | $LINE_PERCENT% |" | |
| echo "| Branch | $BRANCH_COVERED | $BRANCH_TOTAL | $BRANCH_PERCENT% |" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Generate badge.json | |
| if: always() | |
| run: | | |
| REPORT="build/reports/jacoco/test/jacocoTestReport.xml" | |
| HTML_DIR="build/reports/jacoco/test/html" | |
| mkdir -p "$HTML_DIR" | |
| if [ ! -f "$REPORT" ]; then | |
| echo '{"schemaVersion":1,"label":"coverage","message":"unknown","color":"lightgrey"}' > "$HTML_DIR/badge.json" | |
| exit 0 | |
| fi | |
| LINE_VALUES=$(sed 's/></>\n</g' "$REPORT" | awk -F'"' '/<counter type="LINE"/ {m=$4; c=$6} END {print m" "c}') | |
| LINE_MISSED=$(echo "$LINE_VALUES" | awk '{print $1+0}') | |
| LINE_COVERED=$(echo "$LINE_VALUES" | awk '{print $2+0}') | |
| LINE_TOTAL=$((LINE_MISSED + LINE_COVERED)) | |
| if [ "$LINE_TOTAL" -eq 0 ]; then | |
| PERCENT="0" | |
| else | |
| PERCENT=$(awk -v c="$LINE_COVERED" -v t="$LINE_TOTAL" 'BEGIN { printf "%.1f", (c*100)/t }') | |
| fi | |
| if [ "$(echo "$PERCENT >= 90" | bc)" -eq 1 ]; then COLOR="brightgreen" | |
| elif [ "$(echo "$PERCENT >= 75" | bc)" -eq 1 ]; then COLOR="green" | |
| elif [ "$(echo "$PERCENT >= 60" | bc)" -eq 1 ]; then COLOR="yellow" | |
| else COLOR="red"; fi | |
| echo "{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"${PERCENT}%\",\"color\":\"${COLOR}\"}" > "$HTML_DIR/badge.json" | |
| - name: Upload coverage HTML report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jacoco-html-report | |
| path: build/reports/jacoco/test/html | |
| - name: Upload test reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports | |
| path: | | |
| build/reports/tests/test | |
| build/test-results/test | |
| deploy-coverage: | |
| needs: test | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Download coverage report | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: jacoco-html-report | |
| path: coverage | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: coverage | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |