Skip to content

Restructure workflows #2135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
128 changes: 128 additions & 0 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Reusable - Common

on:
workflow_call:
inputs:
cache-read-only:
type: boolean
required: false
no-build-cache:
type: boolean
required: false

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up JDK for running Gradle
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
java-version: 17

- name: Set up gradle
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
with:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Gradle build and test
run: ./gradlew build -x test ${{ inputs.no-build-cache && '--no-build-cache' || '' }}

test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- macos-13
- ubuntu-latest
- windows-latest
test-java-version:
- 8
- 11
- 17
- 21
- 24 # renovate: datasource=java-version
# macos-latest drops support for java 8 temurin. Run java 8 on macos-13. Run java 11, 17, 21 on macos-latest.
exclude:
- os: macos-latest
test-java-version: 8
- os: macos-13
test-java-version: 11
- os: macos-13
test-java-version: 17
- os: macos-13
test-java-version: 21
- os: macos-13
test-java-version: 24 # renovate: datasource=java-version
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- id: setup-java-test
name: Set up Java ${{ matrix.test-java-version }} for tests
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
java-version: ${{ matrix.test-java-version }}

- id: setup-java
name: Set up Java for build
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
java-version: 17

- name: Set up gradle
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
with:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Gradle test
run: >
./gradlew test
"-PtestJavaVersion=${{ matrix.test-java-version }}"
"-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }}"
"-Porg.gradle.java.installations.auto-download=false"
${{ inputs.no-build-cache && '--no-build-cache' || '' }}

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up JDK for running Gradle
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
java-version: 17

- name: Set up gradle
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
with:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Integration test
run: ./gradlew integrationTest ${{ inputs.no-build-cache && '--no-build-cache' || '' }}

- name: Save integration test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest

markdown-lint-check:
uses: ./.github/workflows/reusable-markdown-lint.yml

misspell-check:
uses: ./.github/workflows/reusable-misspell-check.yml

shell-script-check:
uses: ./.github/workflows/reusable-shell-script-check.yml
35 changes: 35 additions & 0 deletions .github/workflows/build-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Daily

on:
workflow_dispatch:
schedule:
# Run daily at 7:30 AM UTC
- cron: '30 7 * * *'

permissions:
contents: read

jobs:
common:
uses: ./.github/workflows/build-common.yml
with:
no-build-cache: true

link-check:
uses: ./.github/workflows/reusable-link-check.yml

workflow-notification:
permissions:
contents: read
issues: write
if: always()
needs:
- common
- link-check
uses: ./.github/workflows/reusable-workflow-notification.yml
with:
success: >-
${{
needs.common.result == 'success' &&
needs.link-check.result == 'success'
}}
32 changes: 32 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build Pull Request

on:
pull_request:
merge_group:

permissions:
contents: read

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

jobs:
common:
uses: ./.github/workflows/build-common.yml
with:
cache-read-only: true

link-check:
uses: ./.github/workflows/reusable-link-check.yml

required-status-check:
if: always()
needs:
- common
- link-check # wait for link check to complete, but don't require it to pass for merging
runs-on: ubuntu-latest
steps:
# The reusable workflow success depends on all its jobs passing
- if: needs.common.result != 'success'
run: exit 1 # fail
Loading
Loading