2023-09-21 14:19:49 +00:00
|
|
|
name: Test dependency graph
|
2023-07-05 22:43:29 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
cache-key-prefix:
|
|
|
|
type: string
|
2024-08-03 18:19:43 +00:00
|
|
|
default: '0'
|
2023-07-05 22:43:29 +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-07-05 22:43:29 +00:00
|
|
|
|
|
|
|
env:
|
2024-04-12 05:28:09 +00:00
|
|
|
SKIP_DIST: ${{ inputs.skip-dist }}
|
2023-07-05 22:43:29 +00:00
|
|
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
|
2024-04-25 09:44:31 +00:00
|
|
|
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
|
2023-07-05 22:43:29 +00:00
|
|
|
|
2024-11-14 02:01:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-07-05 22:43:29 +00:00
|
|
|
jobs:
|
2024-08-03 18:19:43 +00:00
|
|
|
dependency-graph-groovy-upload:
|
2024-08-07 14:13:13 +00:00
|
|
|
runs-on: "ubuntu-latest"
|
2023-07-05 22:43:29 +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-07-05 22:43:29 +00:00
|
|
|
- name: Setup Gradle for dependency-graph generate
|
2024-01-25 18:49:04 +00:00
|
|
|
uses: ./setup-gradle
|
2023-07-05 22:43:29 +00:00
|
|
|
with:
|
2023-12-24 01:39:37 +00:00
|
|
|
dependency-graph: generate-and-upload
|
2023-07-05 22:43:29 +00:00
|
|
|
- name: Run gradle build
|
|
|
|
run: ./gradlew build
|
|
|
|
working-directory: .github/workflow-samples/groovy-dsl
|
|
|
|
|
2024-08-03 18:19:43 +00:00
|
|
|
dependency-graph-groovy-submit:
|
2024-11-14 02:01:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2024-08-03 18:19:43 +00:00
|
|
|
needs: [dependency-graph-groovy-upload]
|
2024-04-06 22:00:53 +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-04-06 22:00:53 +00:00
|
|
|
- name: Initialize integ-test
|
|
|
|
uses: ./.github/actions/init-integ-test
|
|
|
|
|
|
|
|
- name: Submit dependency graphs
|
|
|
|
uses: ./setup-gradle
|
|
|
|
with:
|
|
|
|
dependency-graph: download-and-submit
|
2024-07-16 19:45:14 +00:00
|
|
|
env:
|
|
|
|
DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-upload
|
2024-04-06 22:00:53 +00:00
|
|
|
|
2024-08-03 18:19:43 +00:00
|
|
|
dependency-graph-kotlin-generate-and-submit:
|
2024-11-14 02:01:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2024-08-07 14:13:13 +00:00
|
|
|
runs-on: "ubuntu-latest"
|
2023-07-05 22:43:29 +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-07-05 22:43:29 +00:00
|
|
|
- name: Setup Gradle for dependency-graph generate
|
2024-01-25 18:49:04 +00:00
|
|
|
uses: ./setup-gradle
|
2023-07-05 22:43:29 +00:00
|
|
|
with:
|
|
|
|
dependency-graph: generate-and-submit
|
|
|
|
- name: Run gradle build
|
|
|
|
run: ./gradlew build
|
|
|
|
working-directory: .github/workflow-samples/kotlin-dsl
|
2023-07-16 00:06:38 +00:00
|
|
|
|
2024-08-03 18:19:43 +00:00
|
|
|
dependency-graph-multiple-builds:
|
2024-11-14 02:01:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2024-08-07 14:13:13 +00:00
|
|
|
runs-on: "ubuntu-latest"
|
2023-07-16 00:06:38 +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-07-16 00:06:38 +00:00
|
|
|
- name: Setup Gradle for dependency-graph generate
|
2024-01-25 18:49:04 +00:00
|
|
|
uses: ./setup-gradle
|
2023-07-16 00:06:38 +00:00
|
|
|
with:
|
2023-12-24 01:39:37 +00:00
|
|
|
dependency-graph: generate-and-submit
|
2023-07-24 14:34:10 +00:00
|
|
|
- id: gradle-assemble
|
2023-07-16 00:06:38 +00:00
|
|
|
run: ./gradlew assemble
|
|
|
|
working-directory: .github/workflow-samples/groovy-dsl
|
2023-07-24 14:34:10 +00:00
|
|
|
- id: gradle-build
|
2023-07-16 00:06:38 +00:00
|
|
|
run: ./gradlew build
|
2023-07-24 14:34:10 +00:00
|
|
|
working-directory: .github/workflow-samples/groovy-dsl
|
2024-01-11 22:02:31 +00:00
|
|
|
- id: gradle-build-again
|
|
|
|
run: ./gradlew build
|
|
|
|
working-directory: .github/workflow-samples/groovy-dsl
|
2023-07-16 00:06:38 +00:00
|
|
|
- name: Check generated dependency graphs
|
2023-09-21 15:04:45 +00:00
|
|
|
shell: bash
|
2023-07-16 00:06:38 +00:00
|
|
|
run: |
|
2023-07-24 14:34:10 +00:00
|
|
|
echo "gradle-assemble report file: ${{ steps.gradle-assemble.outputs.dependency-graph-file }}"
|
|
|
|
echo "gradle-build report file: ${{ steps.gradle-build.outputs.dependency-graph-file }}"
|
2024-01-11 22:02:31 +00:00
|
|
|
echo "gradle-build-again report file: ${{ steps.gradle-build-again.outputs.dependency-graph-file }}"
|
2023-07-16 00:06:38 +00:00
|
|
|
ls -l dependency-graph-reports
|
2023-09-21 15:04:45 +00:00
|
|
|
if [ ! -e "${{ steps.gradle-assemble.outputs.dependency-graph-file }}" ]; then
|
|
|
|
echo "Did not find gradle-assemble dependency graph file"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -e "${{ steps.gradle-build.outputs.dependency-graph-file }}" ]; then
|
|
|
|
echo "Did not find gradle-build dependency graph files"
|
2023-07-16 00:06:38 +00:00
|
|
|
exit 1
|
2023-07-24 14:34:10 +00:00
|
|
|
fi
|
2024-01-11 22:02:31 +00:00
|
|
|
if [ ! -e "${{ steps.gradle-build-again.outputs.dependency-graph-file }}" ]; then
|
|
|
|
echo "Did not find gradle-build-again dependency graph files"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-08-03 18:19:43 +00:00
|
|
|
dependency-graph-config-cache:
|
2024-11-14 02:01:45 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2024-04-10 19:11:19 +00:00
|
|
|
runs-on: ubuntu-latest # Test is not compatible with Windows
|
2024-01-11 22:02:31 +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
|
|
|
|
|
2024-01-11 22:02:31 +00:00
|
|
|
- name: Setup Gradle for dependency-graph generate
|
2024-01-25 18:49:04 +00:00
|
|
|
uses: ./setup-gradle
|
2024-01-11 22:02:31 +00:00
|
|
|
with:
|
|
|
|
dependency-graph: generate-and-submit
|
|
|
|
- id: config-cache-store
|
|
|
|
run: ./gradlew assemble --configuration-cache
|
|
|
|
working-directory: .github/workflow-samples/groovy-dsl
|
|
|
|
- name: Check and delete generated dependency graph
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ ! -e "${{ steps.config-cache-store.outputs.dependency-graph-file }}" ]; then
|
|
|
|
echo "Did not find config-cache-store dependency graph files"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
rm ${{ steps.config-cache-store.outputs.dependency-graph-file }}
|
|
|
|
- id: config-cache-reuse
|
|
|
|
run: ./gradlew assemble --configuration-cache
|
|
|
|
working-directory: .github/workflow-samples/groovy-dsl
|
|
|
|
- name: Check no dependency graph is generated
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
|
|
|
echo "Expected no dependency graph files to be generated"
|
|
|
|
ls -l dependency-graph-reports
|
|
|
|
exit 1
|
|
|
|
fi
|