2024-01-11 03:30:40 +00:00
|
|
|
name: Test develocity injection
|
2023-08-20 20:56:16 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
cache-key-prefix:
|
|
|
|
type: string
|
2024-08-03 18:19:43 +00:00
|
|
|
default: '0'
|
2023-08-20 20:56:16 +00:00
|
|
|
runner-os:
|
|
|
|
type: string
|
2024-08-03 18:19:43 +00:00
|
|
|
default: '["ubuntu-latest"]'
|
2024-04-12 05:28:09 +00:00
|
|
|
skip-dist:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2023-08-28 17:59:09 +00:00
|
|
|
secrets:
|
2024-01-11 03:30:40 +00:00
|
|
|
DEVELOCITY_ACCESS_KEY:
|
2023-08-28 17:59:09 +00:00
|
|
|
required: true
|
2023-08-20 20:56:16 +00:00
|
|
|
|
|
|
|
env:
|
2024-04-12 05:28:09 +00:00
|
|
|
SKIP_DIST: ${{ inputs.skip-dist }}
|
2024-04-10 11:45:10 +00:00
|
|
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: inject-develocity-${{ inputs.cache-key-prefix }}
|
2023-08-20 20:56:16 +00:00
|
|
|
|
2024-11-14 02:01:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-08-20 20:56:16 +00:00
|
|
|
jobs:
|
2024-01-11 03:30:40 +00:00
|
|
|
inject-develocity:
|
2024-01-23 23:44:34 +00:00
|
|
|
env:
|
|
|
|
DEVELOCITY_INJECTION_ENABLED: true
|
|
|
|
DEVELOCITY_URL: https://ge.solutions-team.gradle.com
|
2024-04-03 20:47:50 +00:00
|
|
|
DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
|
2024-04-08 00:30:45 +00:00
|
|
|
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0'
|
2024-05-15 22:49:55 +00:00
|
|
|
${{matrix.accessKeyEnv}}: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
2023-08-20 20:56:16 +00:00
|
|
|
strategy:
|
2024-04-09 22:02:24 +00:00
|
|
|
fail-fast: false
|
2023-08-20 20:56:16 +00:00
|
|
|
matrix:
|
|
|
|
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
|
|
|
|
os: ${{fromJSON(inputs.runner-os)}}
|
2024-11-14 02:28:27 +00:00
|
|
|
plugin-version: [3.16.2, 3.18.2]
|
2024-05-15 22:49:55 +00:00
|
|
|
include:
|
|
|
|
- plugin-version: 3.16.2
|
|
|
|
accessKeyEnv: GRADLE_ENTERPRISE_ACCESS_KEY
|
2024-11-14 02:28:27 +00:00
|
|
|
- plugin-version: 3.18.2
|
2024-05-15 22:49:55 +00:00
|
|
|
accessKeyEnv: DEVELOCITY_ACCESS_KEY
|
|
|
|
|
2024-04-10 11:45:10 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2023-08-20 20:56:16 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-11-14 19:19:48 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-04-06 18:52:36 +00:00
|
|
|
- name: Initialize integ-test
|
|
|
|
uses: ./.github/actions/init-integ-test
|
|
|
|
|
2023-08-20 20:56:16 +00:00
|
|
|
- name: Setup Gradle
|
|
|
|
id: setup-gradle
|
2024-01-25 18:49:04 +00:00
|
|
|
uses: ./setup-gradle
|
2023-08-20 20:56:16 +00:00
|
|
|
with:
|
|
|
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
|
|
|
gradle-version: ${{ matrix.gradle }}
|
|
|
|
- name: Run Gradle build
|
|
|
|
id: gradle
|
|
|
|
working-directory: .github/workflow-samples/no-ge
|
|
|
|
run: gradle help
|
|
|
|
- name: Check Build Scan url
|
|
|
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
2024-11-14 19:35:29 +00:00
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
2023-08-20 20:56:16 +00:00
|
|
|
with:
|
|
|
|
script: |
|
2024-05-15 22:49:55 +00:00
|
|
|
core.setFailed('No Build Scan detected')
|
2024-05-17 21:07:50 +00:00
|
|
|
- name: Check short lived token (DEVELOCITY_ACCESS_KEY)
|
2024-05-15 22:49:55 +00:00
|
|
|
run: "[ ${#DEVELOCITY_ACCESS_KEY} -gt 500 ] || (echo 'DEVELOCITY_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
2024-05-17 21:07:50 +00:00
|
|
|
- name: Check short lived token (GRADLE_ENTERPRISE_ACCESS_KEY)
|
|
|
|
run: "[ ${#GRADLE_ENTERPRISE_ACCESS_KEY} -gt 500 ] || (echo 'GRADLE_ENTERPRISE_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
2024-05-15 22:49:55 +00:00
|
|
|
|
|
|
|
inject-develocity-with-access-key:
|
|
|
|
env:
|
|
|
|
DEVELOCITY_INJECTION_ENABLED: true
|
|
|
|
DEVELOCITY_URL: 'https://ge.solutions-team.gradle.com'
|
2024-05-17 21:07:50 +00:00
|
|
|
DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
|
2024-05-15 22:49:55 +00:00
|
|
|
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0'
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
|
|
|
|
os: ${{fromJSON(inputs.runner-os)}}
|
2024-11-14 02:28:27 +00:00
|
|
|
plugin-version: [3.16.2, 3.18.2]
|
2024-05-15 22:49:55 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-11-14 19:19:48 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-05-15 22:49:55 +00:00
|
|
|
- name: Initialize integ-test
|
|
|
|
uses: ./.github/actions/init-integ-test
|
|
|
|
- name: Setup Gradle
|
|
|
|
id: setup-gradle
|
|
|
|
uses: ./setup-gradle
|
|
|
|
with:
|
|
|
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
|
|
|
gradle-version: ${{ matrix.gradle }}
|
|
|
|
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
|
|
|
develocity-token-expiry: 1
|
|
|
|
- name: Run Gradle build
|
|
|
|
id: gradle
|
|
|
|
working-directory: .github/workflow-samples/no-ge
|
|
|
|
run: gradle help
|
2024-05-17 21:07:50 +00:00
|
|
|
- name: Check short lived token (DEVELOCITY_ACCESS_KEY)
|
2024-05-15 22:49:55 +00:00
|
|
|
run: "[ ${#DEVELOCITY_ACCESS_KEY} -gt 500 ] || (echo 'DEVELOCITY_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
2024-05-17 21:07:50 +00:00
|
|
|
- name: Check short lived token (GRADLE_ENTERPRISE_ACCESS_KEY)
|
|
|
|
run: "[ ${#GRADLE_ENTERPRISE_ACCESS_KEY} -gt 500 ] || (echo 'GRADLE_ENTERPRISE_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
2024-05-15 22:49:55 +00:00
|
|
|
- name: Check Build Scan url
|
|
|
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
2024-11-14 19:35:29 +00:00
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
2024-05-15 22:49:55 +00:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
core.setFailed('No Build Scan detected')
|
|
|
|
|
|
|
|
inject-develocity-short-lived-token-failed:
|
|
|
|
env:
|
|
|
|
DEVELOCITY_INJECTION_ENABLED: true
|
|
|
|
DEVELOCITY_URL: 'https://localhost:3333/'
|
2024-05-17 21:07:50 +00:00
|
|
|
DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
|
2024-05-15 22:49:55 +00:00
|
|
|
DEVELOCITY_CCUD_PLUGIN_VERSION: '2.0'
|
|
|
|
# Access key also set as an env var, we want to check it does not leak
|
2024-05-17 21:07:50 +00:00
|
|
|
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
2024-05-15 22:49:55 +00:00
|
|
|
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
2024-05-17 21:07:50 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
gradle: [ current, 7.6.2, 6.9.4, 5.6.4 ]
|
|
|
|
os: ${{fromJSON(inputs.runner-os)}}
|
2024-11-14 02:28:27 +00:00
|
|
|
plugin-version: [ 3.16.2, 3.18.2 ]
|
2024-05-15 22:49:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-11-14 19:19:48 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-05-15 22:49:55 +00:00
|
|
|
- name: Initialize integ-test
|
|
|
|
uses: ./.github/actions/init-integ-test
|
|
|
|
|
|
|
|
- name: Setup Gradle
|
|
|
|
id: setup-gradle
|
|
|
|
uses: ./setup-gradle
|
|
|
|
with:
|
|
|
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
|
|
|
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
|
|
|
- name: Run Gradle build
|
|
|
|
id: gradle
|
|
|
|
working-directory: .github/workflow-samples/no-ge
|
|
|
|
run: gradle help
|
2024-06-14 20:58:40 +00:00
|
|
|
- name: Check access key is not blank (DEVELOCITY_ACCESS_KEY)
|
|
|
|
run: "[ \"${DEVELOCITY_ACCESS_KEY}\" != \"\" ] || (echo 'using DEVELOCITY_ACCESS_KEY!'; exit 1)"
|
2024-05-17 21:07:50 +00:00
|
|
|
- name: Check access key is not blank (GRADLE_ENTERPRISE_ACCESS_KEY)
|
|
|
|
run: "[ \"${GRADLE_ENTERPRISE_ACCESS_KEY}\" != \"\" ] || (echo 'GRADLE_ENTERPRISE_ACCESS_KEY is still supported in v3!'; exit 1)"
|
2024-06-13 18:42:47 +00:00
|
|
|
|
|
|
|
inject-develocity-with-access-key-from-input-actions:
|
|
|
|
env:
|
|
|
|
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
gradle: [ current, 7.6.2, 6.9.4, 5.6.4 ]
|
|
|
|
os: ${{fromJSON(inputs.runner-os)}}
|
2024-11-14 02:28:27 +00:00
|
|
|
plugin-version: [ 3.16.2, 3.18.2 ]
|
2024-06-13 18:42:47 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
2024-11-14 19:19:48 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-06-13 18:42:47 +00:00
|
|
|
- name: Initialize integ-test
|
|
|
|
uses: ./.github/actions/init-integ-test
|
|
|
|
- name: Setup Gradle
|
|
|
|
id: setup-gradle
|
|
|
|
uses: ./setup-gradle
|
|
|
|
with:
|
|
|
|
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
|
|
|
gradle-version: ${{ matrix.gradle }}
|
|
|
|
develocity-injection-enabled: true
|
|
|
|
develocity-url: 'https://ge.solutions-team.gradle.com'
|
|
|
|
develocity-plugin-version: ${{ matrix.plugin-version }}
|
|
|
|
- name: Run Gradle build
|
|
|
|
id: gradle
|
|
|
|
working-directory: .github/workflow-samples/no-ge
|
|
|
|
run: gradle help
|
|
|
|
- name: Check Build Scan url
|
|
|
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
2024-11-14 19:35:29 +00:00
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
2024-06-13 18:42:47 +00:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
core.setFailed('No Build Scan detected')
|