From 0ee59318e72f240ca81b07717fde817f6637fd15 Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Tue, 30 Jan 2024 14:25:58 -0500 Subject: [PATCH] Add workflow to check pull requests in JDT UI that may break JDT-LS. Signed-off-by: Roland Grunberg --- .github/workflows/check-breaking-prs.yml | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/check-breaking-prs.yml diff --git a/.github/workflows/check-breaking-prs.yml b/.github/workflows/check-breaking-prs.yml new file mode 100644 index 0000000000..e0ce710073 --- /dev/null +++ b/.github/workflows/check-breaking-prs.yml @@ -0,0 +1,65 @@ +name: Check JDT.UI For Breaking PRs + +on: + schedule: + - cron: '0 8 * * *' + workflow_dispatch: + +jobs: + pr-verify-job: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CC_LIST: '@rgrunber' + steps: + - uses: actions/checkout@v4 + with: + repository: 'eclipse-jdt/eclipse.jdt.ui' + fetch-depth: 2 + path: eclipse.jdt.ui + - uses: actions/checkout@v4 + with: + repository: 'eclipse-jdtls/eclipse.jdt.ls' + fetch-depth: 2 + path: eclipse.jdt.ls + - name: Cache Maven local repository + uses: actions/cache@v4 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/eclipse/jdt + key: maven-local-${{ hashFiles('eclipse.jdt.ui/pom.xml') }} + - name: Set Up Java + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'adopt' + - name: Set up Maven + uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5 + with: + maven-version: 3.9.4 + - name: Check eclipse.jdt.ui PRs + continue-on-error: true + run: | + PRS=`gh --repo=eclipse-jdt/eclipse.jdt.ui pr list --json number | jq .[].number` + set +e + for number in `echo ${PRS}`; do + touchesFiles=`gh --repo=eclipse-jdt/eclipse.jdt.ui pr view ${number} --json files | jq .files[].path | grep 'org.eclipse.jdt.core.manipulation' | wc -l` + alreadyCommented=`gh --repo=eclipse-jdt/eclipse.jdt.ui pr view ${number} --json comments | jq -r .comments[].body | grep 'eclipse-jdtls/eclipse.jdt.ls' | wc -l` + if [ "${touchesFiles}" != "0" ] && [ "${alreadyCommented}" == "0" ]; then + pushd eclipse.jdt.ui + git fetch origin pull/${number}/head + git checkout FETCH_HEAD + mvn -B clean install -Pbuild-individual-bundles -pl org.eclipse.jdt.core.manipulation + if [ $? -eq 0 ]; then + popd + pushd eclipse.jdt.ls + mvn -B clean verify -DskipTests + if [ $? -ne 0 ]; then + gh --repo=eclipse-jdt/eclipse.jdt.ui pr comment ${number} --body="This pull request may break the eclipse-jdtls/eclipse.jdt.ls project. CC'ing ${{ env.CC_LIST }} for awareness." + fi + fi + popd + fi + done + set -e