diff options
author | Ting-Yuan Huang <laszio@google.com> | 2021-06-25 16:30:04 -0700 |
---|---|---|
committer | laszio <ting-yuan@users.noreply.github.com> | 2021-07-01 11:55:37 -0700 |
commit | f30aa06eb951728e82389ac3f1224a5bf0333af0 (patch) | |
tree | a4a8bcd4a3744d4a33109a15d00538f1cc5211b8 /.github/workflows/auto-merge.yml | |
parent | 25b844ed0d212e5126abd63eeb535d91a5793abc (diff) | |
download | ksp-f30aa06eb951728e82389ac3f1224a5bf0333af0.tar.gz |
Auto merge commits to 1.5.20
Diffstat (limited to '.github/workflows/auto-merge.yml')
-rw-r--r-- | .github/workflows/auto-merge.yml | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000..3c2f80b9 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,91 @@ +# Workflow to cherry-pick changes from main to release branch. + +name: auto-merge + +on: + push: + branches: [ main ] + +jobs: + build-and-test: + strategy: + fail-fast: false + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + steps: + # Checkout + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: kotlin-1.5.20 + + - 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 + 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 --pretty=%H $MERGE_BASE..origin/main third_party/prebuilt/repo) + TO_PICK=$(grep -Fxv -f <(echo "$PICKED"; echo "$VERSION_BUMPS") <(echo "$CANDIDATES") | tac) + if [ -n "$TO_PICK" ]; then git cherry-pick -x $TO_PICK; fi + + - name: Setup Java 9 + uses: actions/setup-java@v1.4.3 + with: + java-version: '9' + java-package: jdk + architecture: x64 + - name: set JDK_9 environment variable for kotlin compiler + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: echo ::set-env name=JDK_9::$(echo $JAVA_HOME) + - name: Setup Java 11 + uses: actions/setup-java@v1.4.3 + with: + java-version: '11' + java-package: jdk + architecture: x64 + - name: Setup Java 8 + uses: actions/setup-java@v1.4.3 + with: + java-version: '8' + java-package: jdk + architecture: x64 + - name: set JDK 6,7,8 environment variables for kotlin compiler + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: echo ::set-env name=JDK_16::$(echo $JAVA_HOME) && echo ::set-env name=JDK_17::$(echo $JAVA_HOME) && echo ::set-env name=JDK_18::$(echo $JAVA_HOME) + + # Build cache + - name: Cache Gradle Cache + uses: actions/cache@v2 + 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@v2 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + + # Run ksp generated tests + - name: test + run: ./gradlew --stacktrace --info test -PcompilerTestEnabled=true + - name: Upload test results + if: always() + uses: actions/upload-artifact@v2 + with: + name: test-reports + path: compiler-plugin/build/reports + + - name: push to release branch + run: git push origin + |