diff --git a/.github/workflows/gradle-build-pr.yml b/.github/workflows/gradle-build-pr.yml index abbc557..e91a1fb 100644 --- a/.github/workflows/gradle-build-pr.yml +++ b/.github/workflows/gradle-build-pr.yml @@ -14,10 +14,21 @@ on: type: string default: "temurin" gradle-task: - description: "Gradle task(s) to run" + description: | + Gradle task(s) to run. Leave empty to use a default that depends on + `run-tests`: `build test` when tests exist, `build` otherwise. required: false type: string - default: "build test" + default: "" + run-tests: + description: | + Whether the project has a JVM test suite. When `false` the workflow + skips the JUnit upload and aggregation steps, and the default + `gradle-task` falls back to `build` (suitable for BOM-only or + test-less projects). + required: false + type: boolean + default: true runs-on: description: "JSON array of runners to use as a matrix" required: false @@ -103,6 +114,7 @@ jobs: ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }} ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }} GRADLE_OPTS: "-Dorg.gradle.parallel=true -Dorg.gradle.caching=true -Dorg.gradle.welcome=never" + RESOLVED_GRADLE_TASK: ${{ inputs.gradle-task != '' && inputs.gradle-task || (inputs.run-tests && 'build test' || 'build') }} steps: - name: Checkout uses: actions/checkout@v6 @@ -112,7 +124,8 @@ jobs: run: | echo "Runner : ${{ runner.os }} ${{ runner.arch }}" echo "JDK target : ${{ inputs.java-version }} (${{ inputs.java-distribution }})" - echo "Gradle task : ${{ inputs.gradle-task }}" + echo "Gradle task : ${RESOLVED_GRADLE_TASK}" + echo "Run tests : ${{ inputs.run-tests }}" echo "Debug logging: ${{ runner.debug }}" - name: Validate Gradle wrapper @@ -132,17 +145,17 @@ jobs: add-job-summary: 'on-failure' add-job-summary-as-pr-comment: 'on-failure' - - name: Run ${{ inputs.gradle-task }} + - name: Run Gradle (${{ env.RESOLVED_GRADLE_TASK }}) shell: bash run: | if [ "${RUNNER_DEBUG:-0}" = "1" ]; then - ./gradlew ${{ inputs.gradle-task }} --info --stacktrace + ./gradlew ${RESOLVED_GRADLE_TASK} --info --stacktrace else - ./gradlew ${{ inputs.gradle-task }} + ./gradlew ${RESOLVED_GRADLE_TASK} fi - name: Upload test reports - if: always() + if: ${{ always() && inputs.run-tests }} uses: actions/upload-artifact@v4 with: name: test-reports-${{ matrix.os }}-jdk${{ inputs.java-version }} @@ -155,7 +168,7 @@ jobs: test-report: name: Aggregate test results needs: build - if: ${{ always() && needs.build.result != 'skipped' }} + if: ${{ always() && needs.build.result != 'skipped' && inputs.run-tests }} runs-on: ubuntu-latest permissions: checks: write diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index 2e8cb50..0707ecf 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -22,7 +22,7 @@ on: description: "Extra CLI args for lychee" required: false type: string - default: "--exclude-mail --max-redirects 5 --accept 200..=204,429 --no-progress" + default: "--max-redirects 5 --accept 200..=204,429 --no-progress" runs-on: description: "Runner image" required: false diff --git a/.lycheeignore b/.lycheeignore index 7d4a35b..d5c24ab 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -1,2 +1,5 @@ # Internal/private hosts that lychee cannot reach from GitHub-hosted runners. ^https://outline\.onelitefeather\.dev/.* + +# Cloudflare/bot-protection returns 403 to lychee but the page is healthy in browsers. +^https://docs\.renovatebot\.com/.* diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..5698d17 --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -0,0 +1,3 @@ +{ + "ignores": ["CHANGELOG.md"] +} diff --git a/README.md b/README.md index 6a70259..47bb278 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ repositories by referencing a tagged release of this repo. - Java **25** on Temurin. - Three-OS matrix on PRs: `ubuntu-latest`, `windows-latest`, `macos-latest`. -- `gradle-build-pr` runs `build test` (no `clean`, to keep incremental caches). +- `gradle-build-pr` runs `build test` by default (no `clean`, to keep incremental caches). Set `run-tests: false` for BOM-only / test-less projects: the default task drops to `build` and the JUnit aggregation step is skipped. - Path filter: build only runs when files under `src/`, `*.gradle*`, `buildSrc/`, JVM sources, or `.github/workflows/**` changed. - Debug re-runs (`Re-run with debug logging`) automatically activate `--info --stacktrace`. - Test reports are uploaded as artifacts on every run and aggregated into a unified check + PR comment. @@ -66,6 +66,17 @@ jobs: secrets: inherit ``` +BOM-only or test-less project: + +```yaml +jobs: + build: + uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-build-pr.yml@v2 + with: + run-tests: false + secrets: inherit +``` + Custom path filter (must define a `code:` key): ```yaml