Skip to content

Commit a9ae9bd

Browse files
Merge pull request #45 from jprinet/feature/expe_as_composite_actions
Add composite actions to run the experiments
2 parents e428942 + 131a9ee commit a9ae9bd

File tree

5 files changed

+262
-0
lines changed

5 files changed

+262
-0
lines changed

.github/actions/gradle/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Composite GitHub Actions
2+
3+
The composite actions provided here will simplify running the build validation scripts from your GitHub Actions workflow.
4+
5+
## Usage
6+
7+
Create a GitHub Actions workflow, add the steps to configure the build requirements like JDK, etc., and then add the
8+
following steps to invoke the actual experiments:
9+
10+
```yaml
11+
steps:
12+
# Download the latest version of the build validation scripts
13+
- uses: gradle/gradle-enterprise-build-validation-scripts/.github/actions/gradle/[email protected]
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
# Run experiment 1
17+
- uses: gradle/gradle-enterprise-build-validation-scripts/.github/actions/gradle/[email protected]
18+
with:
19+
gitRepo: <PROJECT_GIT_URL>
20+
gitBranch: <PROJECT_BRANCH>
21+
tasks: <PROJECT_BUILD_TASK>
22+
...
23+
# Run experiment 2
24+
- uses: gradle/gradle-enterprise-build-validation-scripts/.github/actions/gradle/[email protected]
25+
with:
26+
gitRepo: <PROJECT_GIT_URL>
27+
gitBranch: <PROJECT_BRANCH>
28+
tasks: <PROJECT_BUILD_TASK>
29+
...
30+
# Run experiment 3
31+
- uses: gradle/gradle-enterprise-build-validation-scripts/.github/actions/gradle/[email protected]
32+
with:
33+
gitRepo: <PROJECT_GIT_URL>
34+
gitBranch: <PROJECT_BRANCH>
35+
tasks: <PROJECT_BUILD_TASK>
36+
...
37+
```
38+
39+
Once the workflow has been triggered and finishes executing, you can navigate to the workflow's output and investigate the summary
40+
produced by the build validation scripts.
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Download latest Gradle build validation scripts
2+
description: "Downloads the latest release of the build validation scripts for Gradle"
3+
4+
inputs:
5+
token:
6+
description: "GitHub token"
7+
required: false
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Download latest build Gradle validation scripts
13+
run: |
14+
authHeader=""
15+
if [ ! -z "${{ inputs.token }}" ]; then
16+
authHeader="--header 'Authorization: Bearer ${{ inputs.token }}'"
17+
fi
18+
19+
# Build the command to get the details of the latest version of the build validation scripts
20+
cmdGetLatestReleaseData="curl -s $authHeader https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest"
21+
22+
# Get the download url of the latest version of the build validation scripts
23+
downloadUrl=$($cmdGetLatestReleaseData | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep -v maven)
24+
25+
# Build the command to download the latest version of the build validation scripts
26+
cmdGetLatestRelease="curl -s -L $authHeader -o gradle-enterprise-gradle-build-validation.zip $downloadUrl"
27+
28+
# Download the latest version of the build validation scripts
29+
eval "$cmdGetLatestRelease"
30+
31+
# Unzip the downloaded build validation scripts
32+
unzip -q -o gradle-enterprise-gradle-build-validation.zip
33+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Run experiment 1
2+
description: "Runs experiment 1 of the build validation scripts for Gradle"
3+
4+
inputs:
5+
gitRepo:
6+
description: "The URL for the Git repository to validate"
7+
required: true
8+
gitBranch:
9+
description: "The branch for the Git repository to validate"
10+
required: false
11+
gitCommitId:
12+
description: "The Git commit id for the Git repository to validate"
13+
required: false
14+
projectDir:
15+
description: "The build invocation directory within the Git repository"
16+
required: false
17+
tasks:
18+
description: "The Gradle tasks to invoke"
19+
required: false
20+
args:
21+
description: "Additional arguments to pass to Gradle"
22+
required: false
23+
gradleEnterpriseUrl:
24+
description: "The URL for the Gradle Enterprise server to connect to"
25+
required: false
26+
enableGradleEnterprise:
27+
description: "Enables Gradle Enterprise on a project not already connected"
28+
required: false
29+
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: Run Gradle Experiment 1
34+
id: run
35+
run: |
36+
cd gradle-enterprise-gradle-build-validation
37+
38+
EXTRA_ARGS=""
39+
if [ ! -z "${{ inputs.gitBranch }}" ]; then
40+
EXTRA_ARGS="$EXTRA_ARGS -b ${{ inputs.gitBranch }}"
41+
fi
42+
if [ ! -z "${{ inputs.gitCommitId }}" ]; then
43+
EXTRA_ARGS="$EXTRA_ARGS -c ${{ inputs.gitCommitId }}"
44+
fi
45+
if [ ! -z "${{ inputs.projectDir }}" ]; then
46+
EXTRA_ARGS="$EXTRA_ARGS -p ${{ inputs.projectDir }}"
47+
fi
48+
if [ ! -z "${{ inputs.tasks }}" ]; then
49+
EXTRA_ARGS="$EXTRA_ARGS -t ${{ inputs.tasks }}"
50+
fi
51+
if [ ! -z "${{ inputs.args }}" ]; then
52+
EXTRA_ARGS="$EXTRA_ARGS -a ${{ inputs.args }}"
53+
fi
54+
if [ ! -z "${{ inputs.gradleEnterpriseUrl }}" ]; then
55+
EXTRA_ARGS="$EXTRA_ARGS -s ${{ inputs.gradleEnterpriseUrl }}"
56+
fi
57+
if [ ! -z "${{ inputs.enableGradleEnterprise }}" ]; then
58+
EXTRA_ARGS="$EXTRA_ARGS -e"
59+
fi
60+
61+
# run experiment
62+
./01-validate-incremental-building.sh -r ${{ inputs.gitRepo }} $EXTRA_ARGS
63+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Run experiment 2
2+
description: "Runs experiment 2 of the build validation scripts for Gradle"
3+
4+
inputs:
5+
gitRepo:
6+
description: "The URL for the Git repository to validate"
7+
required: true
8+
gitBranch:
9+
description: "The branch for the Git repository to validate"
10+
required: false
11+
gitCommitId:
12+
description: "The Git commit id for the Git repository to validate"
13+
required: false
14+
projectDir:
15+
description: "The build invocation directory within the Git repository"
16+
required: false
17+
tasks:
18+
description: "The Gradle tasks to invoke"
19+
required: false
20+
args:
21+
description: "Additional arguments to pass to Gradle"
22+
required: false
23+
gradleEnterpriseUrl:
24+
description: "The URL for the Gradle Enterprise server to connect to"
25+
required: false
26+
enableGradleEnterprise:
27+
description: "Enables Gradle Enterprise on a project not already connected"
28+
required: false
29+
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: Run Gradle Experiment 2
34+
id: run
35+
run: |
36+
cd gradle-enterprise-gradle-build-validation
37+
38+
EXTRA_ARGS=""
39+
if [ ! -z "${{ inputs.gitBranch }}" ]; then
40+
EXTRA_ARGS="$EXTRA_ARGS -b ${{ inputs.gitBranch }}"
41+
fi
42+
if [ ! -z "${{ inputs.gitCommitId }}" ]; then
43+
EXTRA_ARGS="$EXTRA_ARGS -c ${{ inputs.gitCommitId }}"
44+
fi
45+
if [ ! -z "${{ inputs.projectDir }}" ]; then
46+
EXTRA_ARGS="$EXTRA_ARGS -p ${{ inputs.projectDir }}"
47+
fi
48+
if [ ! -z "${{ inputs.tasks }}" ]; then
49+
EXTRA_ARGS="$EXTRA_ARGS -t ${{ inputs.tasks }}"
50+
fi
51+
if [ ! -z "${{ inputs.args }}" ]; then
52+
EXTRA_ARGS="$EXTRA_ARGS -a ${{ inputs.args }}"
53+
fi
54+
if [ ! -z "${{ inputs.gradleEnterpriseUrl }}" ]; then
55+
EXTRA_ARGS="$EXTRA_ARGS -s ${{ inputs.gradleEnterpriseUrl }}"
56+
fi
57+
if [ ! -z "${{ inputs.enableGradleEnterprise }}" ]; then
58+
EXTRA_ARGS="$EXTRA_ARGS -e"
59+
fi
60+
61+
# run experiment
62+
./02-validate-local-build-caching-same-location.sh -r ${{ inputs.gitRepo }} $EXTRA_ARGS
63+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Run experiment 3
2+
description: "Runs experiment 3 of the build validation scripts for Gradle"
3+
4+
inputs:
5+
gitRepo:
6+
description: "The URL for the Git repository to validate"
7+
required: true
8+
gitBranch:
9+
description: "The branch for the Git repository to validate"
10+
required: false
11+
gitCommitId:
12+
description: "The Git commit id for the Git repository to validate"
13+
required: false
14+
projectDir:
15+
description: "The build invocation directory within the Git repository"
16+
required: false
17+
tasks:
18+
description: "The Gradle tasks to invoke"
19+
required: false
20+
args:
21+
description: "Additional arguments to pass to Gradle"
22+
required: false
23+
gradleEnterpriseUrl:
24+
description: "The URL for the Gradle Enterprise server to connect to"
25+
required: false
26+
enableGradleEnterprise:
27+
description: "Enables Gradle Enterprise on a project not already connected"
28+
required: false
29+
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: Run Gradle Experiment 3
34+
id: run
35+
run: |
36+
cd gradle-enterprise-gradle-build-validation
37+
38+
EXTRA_ARGS=""
39+
if [ ! -z "${{ inputs.gitBranch }}" ]; then
40+
EXTRA_ARGS="$EXTRA_ARGS -b ${{ inputs.gitBranch }}"
41+
fi
42+
if [ ! -z "${{ inputs.gitCommitId }}" ]; then
43+
EXTRA_ARGS="$EXTRA_ARGS -c ${{ inputs.gitCommitId }}"
44+
fi
45+
if [ ! -z "${{ inputs.projectDir }}" ]; then
46+
EXTRA_ARGS="$EXTRA_ARGS -p ${{ inputs.projectDir }}"
47+
fi
48+
if [ ! -z "${{ inputs.tasks }}" ]; then
49+
EXTRA_ARGS="$EXTRA_ARGS -t ${{ inputs.tasks }}"
50+
fi
51+
if [ ! -z "${{ inputs.args }}" ]; then
52+
EXTRA_ARGS="$EXTRA_ARGS -a ${{ inputs.args }}"
53+
fi
54+
if [ ! -z "${{ inputs.gradleEnterpriseUrl }}" ]; then
55+
EXTRA_ARGS="$EXTRA_ARGS -s ${{ inputs.gradleEnterpriseUrl }}"
56+
fi
57+
if [ ! -z "${{ inputs.enableGradleEnterprise }}" ]; then
58+
EXTRA_ARGS="$EXTRA_ARGS -e"
59+
fi
60+
61+
# run experiment
62+
./03-validate-local-build-caching-different-locations.sh -r ${{ inputs.gitRepo }} $EXTRA_ARGS
63+
shell: bash

0 commit comments

Comments
 (0)