Skip to content

Commit

Permalink
Updated experiment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ribafish committed Aug 9, 2024
1 parent e5a7bc5 commit b7e552b
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/non-task-caching-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ on:

jobs:
runTests:
name: Non task caching tests
name: Experiments
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
task: [ 'help', ':app:assembleProdDebug' ]
exp:
- cache: 'transforms'
args: '-Dscan.tag.baseline-transforms'
Expand All @@ -21,10 +22,6 @@ jobs:
args: '-Dscan.tag.baseline-kotlin-dsl'
- cache: 'kotlin-dsl'
args: '-Dscan.tag.kotlinScriptCachingDisabled -Dorg.gradle.internal.kotlin-script-caching-disabled'
- cache: 'groovy-dsl'
args: '-Dscan.tag.baseline-groovy-dsl'
- cache: 'groovy-dsl'
args: '-Dscan.tag.groovyScriptCachingDisabled -Dorg.gradle.internal.groovy-script-caching-disabled'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand All @@ -36,22 +33,26 @@ jobs:
with:
develocity-access-key: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}
- name: Clear Gradle user home caches we don't want
env:
GRADLE_CACHE_REMOTE_PUSH: "true"
GRADLE_CACHE_REMOTE_PATH: "cache/android-cache-fix-plugin-exp-non-task"
GRADLE_CACHE_REMOTE_URL: "https://ge.solutions-team.gradle.com/cache/android-cache-fix-plugin-exp-non-task"
run: |
cache='${{ matrix.exp.cache }}'
args='${{ matrix.exp.args }}'
echo "Test caches/*/$cache removal with $args"
echo "Running build once to fully populate Gradle User Home"
./gradlew help -Dscan.tag.remote-cache-experiment-init --no-daemon --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true
./gradlew ${{ matrix.task }} -Dscan.tag.remote-cache-experiment-init --no-daemon --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com/
./gradlew --stop
echo "Removing $cache from $homeDir/caches"
rm -rf ~/.gradle/caches/*/$cache
rm -rf ~/.gradle/caches/$cache-* # Also remove the transforms for Gradle 8.7

# Always remove the local build cache, since we are testing connection with remote build cache
rm -rf ~/.gradle/caches/build-cache-1
echo "Running build again with --${buildCache}"
./gradlew help --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dscan.uploadInBackground=false $args
echo "Running build again with --${args}"
./gradlew ${{ matrix.task }} --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dscan.uploadInBackground=false -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com $args
64 changes: 64 additions & 0 deletions remote-cache-experiment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

homeDir=build/HOME

# Set 'task' to the first argument or 'help' if no arguments are provided
task=${1:-help}

# Initialize empty Gradle User Home with settings to run build, including Develocity access keys
echo "Initializing Gradle User Home directory at $homeDir"
rm -rf $homeDir
mkdir -p $homeDir
mkdir -p $homeDir/caches/8.9/
cp ~/.gradle/gradle.properties $homeDir
cp -r ~/.gradle/caches/8.9/generated-gradle-jars $homeDir/caches/8.9/

# Having the key set in the environment is expected - note that remote build cache write is requiered
#export DEVELOCITY_ACCESS_KEY=ge.solutions-team.gradle.com=<access-key>
export GRADLE_CACHE_REMOTE_PUSH=true
export GRADLE_CACHE_REMOTE_PATH="cache/$USER-exp-non-task"
export GRADLE_CACHE_REMOTE_URL="https://ge.solutions-team.gradle.com/cache/$USER-exp-non-task"

echo "------------------------------------------------------------"
echo "Priming build with task '$task' and HOME=$homeDir"
echo "------------------------------------------------------------"
set -x
./gradlew $task -g $homeDir -Dscan.tag.remote-cache-experiment-init --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dscan.uploadInBackground=false -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com/
set +x

runs='transforms kotlin-dsl'
for run in $runs
do
# Set args based on cache
if [ "$run" == 'transforms' ]
then
cache='transforms'
disabledCacheArgs='-Dorg.gradle.internal.transform-caching-disabled'
elif [ "$run" == 'kotlin-dsl' ]
then
cache='kotlin-dsl'
disabledCacheArgs='-Dorg.gradle.internal.kotlin-script-caching-disabled'
fi
for args in "-Dscan.tag.baseline-$run" "-Dscan.tag.disabled-cache-$run $disabledCacheArgs"
do
echo "------------------------------------------------------------"
echo "Test caches/*/$cache removal with $args"
echo "------------------------------------------------------------"
set -x
./gradlew --stop
killall -9 java

# git clean -dfx -e HOME -e cleanup-help.sh
echo "Removing $cache from $homeDir/caches"
rm -rf $homeDir/caches/*/$cache
rm -rf $homeDir/caches/$cache-* # Also remove the transforms for Gradle 8.7

# Always remove the local build cache, since we are testing connection with remote build cache
rm -rf $homeDir/caches/build-cache-1

./gradlew $task -g $homeDir --no-configuration-cache -Ddevelocity.deprecation.muteWarnings=true -Dscan.uploadInBackground=false -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com/ -Dorg.gradle.dependency.verification=lenient $args

set +x
echo ""
done
done

0 comments on commit b7e552b

Please # to comment.