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
122 changes: 116 additions & 6 deletions .github/workflows/gradle-build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: "JDK version to use"
required: false
type: string
default: "21"
default: "25"
java-distribution:
description: "JDK distribution (temurin, zulu, ...)"
required: false
Expand All @@ -17,7 +17,7 @@ on:
description: "Gradle task(s) to run"
required: false
type: string
default: "clean build test"
default: "build test"
runs-on:
description: "JSON array of runners to use as a matrix"
required: false
Expand All @@ -33,16 +33,67 @@ on:
required: false
type: boolean
default: true
paths-filters:
description: |
dorny/paths-filter YAML defining when to build. Must define a `code`
filter; the build runs when `code` matches.
required: false
type: string
default: |
code:
- '**/*.gradle'
- '**/*.gradle.kts'
- '**/gradle.properties'
- 'gradle/**'
- 'gradlew'
- 'gradlew.bat'
- 'settings.gradle'
- 'settings.gradle.kts'
- 'buildSrc/**'
- 'src/**'
- '**/*.java'
- '**/*.kt'
- '**/*.groovy'
- '**/*.scala'
- '.github/workflows/**'
force-build:
description: "Skip the path filter and always build."
required: false
type: boolean
default: false
secrets:
ONELITEFEATHER_MAVEN_USERNAME:
required: false
ONELITEFEATHER_MAVEN_PASSWORD:
required: false

concurrency:
group: gradle-build-pr-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
changes:
name: Detect changes
if: ${{ inputs.repository-owner == '' || github.repository_owner == inputs.repository-owner }}
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Filter changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: ${{ inputs.paths-filters }}

- name: Summary
run: |
echo "Code-relevant changes detected: ${{ steps.filter.outputs.code }}"
echo "force-build input: ${{ inputs.force-build }}"

build:
name: Build (${{ matrix.os }})
if: ${{ inputs.repository-owner == '' || github.repository_owner == inputs.repository-owner }}
needs: changes
if: ${{ inputs.force-build || needs.changes.outputs.code == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -51,10 +102,19 @@ jobs:
env:
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"
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v6

- name: Toolchain info
shell: bash
run: |
echo "Runner : ${{ runner.os }} ${{ runner.arch }}"
echo "JDK target : ${{ inputs.java-version }} (${{ inputs.java-distribution }})"
echo "Gradle task : ${{ inputs.gradle-task }}"
echo "Debug logging: ${{ runner.debug }}"

- name: Validate Gradle wrapper
if: ${{ inputs.validate-wrapper }}
uses: gradle/actions/wrapper-validation@v6
Expand All @@ -67,6 +127,56 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
with:
cache-read-only: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
add-job-summary: 'on-failure'
add-job-summary-as-pr-comment: 'on-failure'

- name: Run ${{ inputs.gradle-task }}
shell: bash
run: |
if [ "${RUNNER_DEBUG:-0}" = "1" ]; then
./gradlew ${{ inputs.gradle-task }} --info --stacktrace
else
./gradlew ${{ inputs.gradle-task }}
fi

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.os }}-jdk${{ inputs.java-version }}
path: |
**/build/reports/tests/**
**/build/test-results/**
if-no-files-found: ignore
retention-days: 14

- name: Run ${{ inputs.gradle-task }} on ${{ matrix.os }}
run: ./gradlew ${{ inputs.gradle-task }}
test-report:
name: Aggregate test results
needs: build
if: ${{ always() && needs.build.result != 'skipped' }}
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
steps:
- name: Download all test reports
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: test-reports-*
merge-multiple: true

- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: |
artifacts/**/TEST-*.xml
artifacts/**/test-results/**/*.xml
check_name: "Test results"
comment_mode: changes in failures
report_individual_runs: true
fail_on: test failures
47 changes: 43 additions & 4 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: "JDK version to use"
required: false
type: string
default: "21"
default: "25"
java-distribution:
description: "JDK distribution (temurin, zulu, ...)"
required: false
Expand Down Expand Up @@ -39,17 +39,31 @@ on:
ONELITEFEATHER_MAVEN_PASSWORD:
required: true

concurrency:
group: gradle-publish-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
publish:
name: Build & publish
runs-on: ${{ inputs.runs-on }}
env:
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"
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v6

- name: Toolchain info
shell: bash
run: |
echo "Runner : ${{ runner.os }} ${{ runner.arch }}"
echo "JDK target : ${{ inputs.java-version }} (${{ inputs.java-distribution }})"
echo "Build task : ${{ inputs.build-task }}"
echo "Publish task : ${{ inputs.publish-task }}"
echo "Debug logging: ${{ runner.debug }}"

- name: Validate Gradle wrapper
if: ${{ inputs.validate-wrapper }}
uses: gradle/actions/wrapper-validation@v6
Expand All @@ -62,9 +76,34 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
with:
add-job-summary: 'always'

- name: Build
run: ./gradlew ${{ inputs.build-task }}
shell: bash
run: |
if [ "${RUNNER_DEBUG:-0}" = "1" ]; then
./gradlew ${{ inputs.build-task }} --info --stacktrace
else
./gradlew ${{ inputs.build-task }}
fi

- name: Publish
run: ./gradlew ${{ inputs.publish-task }}
shell: bash
run: |
if [ "${RUNNER_DEBUG:-0}" = "1" ]; then
./gradlew ${{ inputs.publish-task }} --info --stacktrace
else
./gradlew ${{ inputs.publish-task }}
fi

- name: Upload build reports
if: always()
uses: actions/upload-artifact@v4
with:
name: publish-reports-jdk${{ inputs.java-version }}
path: |
**/build/reports/**
**/build/test-results/**
if-no-files-found: ignore
retention-days: 14
17 changes: 17 additions & 0 deletions .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint docs

on:
pull_request:
paths:
- '**/*.md'
- '**/*.markdown'
- '.markdownlint.json'
- '.lycheeignore'
- '.github/workflows/markdown-lint.yml'
- '.github/workflows/lint-docs.yml'

jobs:
lint:
uses: ./.github/workflows/markdown-lint.yml
with:
force-lint: true
106 changes: 106 additions & 0 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Reusable - Markdown Lint

on:
workflow_call:
inputs:
glob:
description: "markdownlint-cli2 glob pattern(s); space-separated for multiple"
required: false
type: string
default: "**/*.md"
config-file:
description: "markdownlint configuration file (relative to repo root)"
required: false
type: string
default: ".markdownlint.json"
check-links:
description: "Run lychee link checker after markdownlint"
required: false
type: boolean
default: true
lychee-args:
description: "Extra CLI args for lychee"
required: false
type: string
default: "--exclude-mail --max-redirects 5 --accept 200..=204,429 --no-progress"
runs-on:
description: "Runner image"
required: false
type: string
default: "ubuntu-latest"
paths-filters:
description: |
dorny/paths-filter YAML; must define a `docs` filter that decides whether to lint.
required: false
type: string
default: |
docs:
- '**/*.md'
- '**/*.markdown'
- '.markdownlint.json'
- '.markdownlint.yaml'
- '.markdownlint.yml'
- '.lycheeignore'
force-lint:
description: "Skip the path filter and always lint"
required: false
type: boolean
default: false
repository-owner:
description: "Restrict execution to this owner (skip on forks). Empty disables the check."
required: false
type: string
default: "OneLiteFeatherNET"

concurrency:
group: markdown-lint-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
changes:
name: Detect markdown changes
if: ${{ inputs.repository-owner == '' || github.repository_owner == inputs.repository-owner }}
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
steps:
- name: Filter changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: ${{ inputs.paths-filters }}

- name: Summary
run: |
echo "Docs-relevant changes detected: ${{ steps.filter.outputs.docs }}"
echo "force-lint input: ${{ inputs.force-lint }}"

markdownlint:
name: markdownlint
needs: changes
if: ${{ inputs.force-lint || needs.changes.outputs.docs == 'true' }}
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Run markdownlint-cli2
uses: DavidAnson/markdownlint-cli2-action@v18
with:
globs: ${{ inputs.glob }}
config: ${{ inputs.config-file }}

link-check:
name: Lychee link check
needs: changes
if: ${{ inputs.check-links && (inputs.force-lint || needs.changes.outputs.docs == 'true') }}
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Lychee link checker
uses: lycheeverse/lychee-action@v2
with:
args: ${{ inputs.lychee-args }} ${{ inputs.glob }}
fail: true
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Internal/private hosts that lychee cannot reach from GitHub-hosted runners.
^https://outline\.onelitefeather\.dev/.*
8 changes: 8 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",
"default": true,
"MD013": false,
"MD024": { "siblings_only": true },
"MD033": { "allowed_elements": ["br", "details", "summary", "kbd"] },
"MD041": false
}
Loading
Loading