blob: 8f09f5246f5a09ecd4bd9c52d8de3e950b812f48 [file]
# Workflow to cherry-pick changes from main to release branch.
name: auto-merge
on:
push:
branches: [ main ]
env:
RELEASE_BRANCH: "2.3.11-release"
jobs:
test:
strategy:
fail-fast: false
matrix:
test-suite: [ api-check, unit-test, integration-test-primary, integration-test-secondary, integration-test-android, integration-test-agp, gradle-check ]
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.test-suite == 'integration-test-secondary' || matrix.test-suite == 'integration-test-android' || matrix.test-suite == 'integration-test-agp' }}
permissions:
contents: write
steps:
- name: Free Disk Space (Ubuntu)
run: |
echo "Disk space before cleanup:"
df -h
set -xe
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /opt/hostedtoolcache/
sudo rm -rf /usr/local/graalvm/
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/lib/node_modules
sudo docker image prune --all --force
echo "Disk space after cleanup:"
df -h
# Checkout
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
ref: ${{ env.RELEASE_BRANCH }}
- name: merge commits from main to release branch
run: |
# Cherry pick new changes from main, except for version bumps.
# A commit is a version bump IFF it touches third_party/prebuilt/repo
DONT_PICK=$(cat <<EOF
5c073ba9c1283190467937b4456be9174b9be86c
EOF
)
git config --global user.email "kotlin-symbol-processing@google.com"
git config --global user.name "KSP Auto Pick"
MERGE_BASE=$(git merge-base HEAD origin/main)
CANDIDATES=$(git log --pretty=%H $MERGE_BASE..origin/main)
PICKED=$(git log $MERGE_BASE..HEAD | sed -n "s/^[ ]*(cherry picked from commit \([a-z0-9]*\))$/\1/p")
VERSION_BUMPS=$(git log $MERGE_BASE..origin/main --pretty=%H --grep UPDATE_KOTLIN_VERSION)
TO_PICK=$(grep -Fxv -f <(echo "$PICKED"; echo "$VERSION_BUMPS"; echo "$DONT_PICK") <(echo "$CANDIDATES") | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }')
echo Picking $TO_PICK
if [ -n "$TO_PICK" ]; then git cherry-pick -x --allow-empty $TO_PICK; fi
- name: Setup Java 17
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95
with:
java-version: '17'
distribution: 'zulu'
# Build cache
- name: Cache Gradle Cache
uses: actions/cache@v5
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache gradle wrapper
uses: actions/cache@v5
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
# Check API compatibility
- name: API compatibility check
if: matrix.test-suite == 'api-check'
run: ./gradlew :api:checkApi
- name: Run unit tests
if: matrix.test-suite == 'unit-test'
run: ./gradlew :kotlin-analysis-api:test --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run primary integration tests
if: matrix.test-suite == 'integration-test-primary'
run: ./gradlew :integration-tests:primaryTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run secondary integration tests
if: matrix.test-suite == 'integration-test-secondary'
run: ./gradlew :integration-tests:secondaryTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run android integration tests
if: matrix.test-suite == 'integration-test-android'
run: ./gradlew :integration-tests:androidTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run agp integration tests
if: matrix.test-suite == 'integration-test-agp'
run: ./gradlew :integration-tests:agpTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run remaining tests and checks
if: matrix.test-suite == 'gradle-check'
run: ./gradlew check -x :kotlin-analysis-api:test -x :integration-tests:primaryTest -x :integration-tests:secondaryTest -x :integration-tests:androidTest -x :integration-tests:agpTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-reports-${{ matrix.test-suite }}
path: |
integration-tests/build/reports
gradle-plugin/build/reports
common-util/build/reports
kotlin-analysis-api/build/reports
push:
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
ref: ${{ env.RELEASE_BRANCH }}
- name: merge commits from main to release branch
run: |
# Cherry pick new changes from main, except for version bumps.
# A commit is a version bump IFF it touches third_party/prebuilt/repo
DONT_PICK=$(cat <<EOF
5c073ba9c1283190467937b4456be9174b9be86c
EOF
)
git config --global user.email "kotlin-symbol-processing@google.com"
git config --global user.name "KSP Auto Pick"
MERGE_BASE=$(git merge-base HEAD origin/main)
CANDIDATES=$(git log --pretty=%H $MERGE_BASE..origin/main)
PICKED=$(git log $MERGE_BASE..HEAD | sed -n "s/^[ ]*(cherry picked from commit \([a-z0-9]*\))$/\1/p")
VERSION_BUMPS=$(git log $MERGE_BASE..origin/main --pretty=%H --grep UPDATE_KOTLIN_VERSION)
TO_PICK=$(grep -Fxv -f <(echo "$PICKED"; echo "$VERSION_BUMPS"; echo "$DONT_PICK") <(echo "$CANDIDATES") | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }')
echo Picking $TO_PICK
if [ -n "$TO_PICK" ]; then git cherry-pick -x --allow-empty $TO_PICK; fi
- name: push to release branch
run: git fetch && git rebase && git push origin