From ec8cce59f8059b119c222dadf2c049d494762cd3 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Fri, 8 Oct 2021 18:03:36 +0200 Subject: [PATCH] Switch to a lighter CI --- .github/workflows/automerge.yml | 25 ----- .github/workflows/build-and-deploy.yml | 145 +++++++------------------ 2 files changed, 41 insertions(+), 129 deletions(-) delete mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml deleted file mode 100644 index 1dbe4076..00000000 --- a/.github/workflows/automerge.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: automerge -on: - push: - pull_request: - types: - - labeled - - unlabeled - - reopened - - unlocked -jobs: - automerge: - runs-on: ubuntu-latest - steps: - - name: automerge - uses: "DanySK/yaagha@master" - env: - GITHUB_TOKEN: "${{ secrets.AUTOMERGE_TOKEN }}" - MERGE_FORKS: "false" - MERGE_LABELS: "version-upgrade" - BLOCK_LABELS: "blocked, wontfix, invalid" - MERGE_METHOD: "rebase" - CLOSE_ON_CONFLICT: "true" - DELETE_BRANCH_ON_CLOSE: "true" - GIT_USER_NAME: "Danilo Pianini" - GIT_USER_EMAIL: "danilo.pianini@gmail.com" diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 582e30d5..f59d32e7 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -5,102 +5,61 @@ on: branches-ignore: - 'autodelivery**' - 'bump-**' + - 'renovate/**' + paths-ignore: + - 'README.md' + - 'CHANGELOG.md' + - 'LICENSE' pull_request: - schedule: - - cron: '0 3 * * SUN' jobs: Build: strategy: matrix: os: [windows, macos, ubuntu] - jvm_version: [8, 11, 15, 16] - distribution: [adopt] runs-on: ${{ matrix.os }}-latest env: - JAVA_VERSION: ${{ matrix.jvm_version }} - OS: ${{ matrix.os }} TERM: dumb steps: # Checkout the repository - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: recursive - - name: Fetch tags - shell: bash - run: git fetch --tags -f - - name: Populate TAG and BRANCH environment variables - shell: bash - run: | - TAG=$(git describe --tags --exact-match HEAD || echo '') - echo "Current tag is: '$TAG' (setup in the TAG environment variable)" - echo "TAG=$TAG" >> $GITHUB_ENV - BRANCH=$([ -z "$TAG" ] && echo ${GITHUB_REF#refs/heads/} || echo $TAG) - echo "Current tag is: '$BRANCH' (setup in BRANCH TAG environment variable)" - echo "BRANCH=$BRANCH" >> $GITHUB_ENV - # Check if the configuration is supported - # COMPATIBLE means the build can run on this matrix combination - # REFERENCE means this is the combination that produces the reference artifacts - # (hence, artifacts from REFERENCE configuration shall be deployed) - # Only one matrix entry should be REFERENCE=true - # If REFERENCE=true, then also COMPATIBLE=true - - shell: bash - run: .github/build-steps/compatibility_check.sh + uses: danysk/action-checkout@0.1.0 # Install the JDK - uses: actions/setup-java@v2 - if: ${{ env.COMPATIBLE == 'true' }} with: - distribution: ${{ matrix.distribution }} - java-version: ${{ matrix.jvm_version }} + distribution: adopt + java-version: 16 server-id: ossrh server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_PASSWORD gpg-private-key: ${{ secrets.SIGNING_KEY }} gpg-passphrase: SIGNING_PASSWORD - # Install additional packages - - name: Configure Linux - shell: bash - if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'ubuntu') }} - run: | - if [ -x .github/scripts/configure_linux ]; then - .github/scripts/configure_linux - fi - - name: Configure MacOS X - shell: bash - if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'macos') }} - run: | - if [ -f .github/scripts/configure_macos ]; then - .github/scripts/configure_macos - fi - name: Configure the Windows Pagefile - if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'windows') }} + if: ${{ runner.os == 'Windows' }} uses: al-cheb/configure-pagefile-action@v1.2 - - name: Configure Windows - shell: bash - if: ${{ env.COMPATIBLE == 'true' && contains(matrix.os, 'windows') }} - run: | - if [ -f .github/scripts/configure_windows ]; then - .github/scripts/configure_windows - fi + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- - name: Build - if: ${{ env.COMPATIBLE == 'true' }} shell: bash - run: .github/build-steps/build.sh || .github/build-steps/build.sh + run: ./gradlew assemble - name: Check - if: ${{ env.COMPATIBLE == 'true' }} shell: bash - run: .github/build-steps/check.sh || .github/build-steps/check.sh + run: ./gradlew check --parallel - name: CodeCov - if: ${{ env.REFERENCE == 'true' }} - uses: codecov/codecov-action@v1 + if: ${{ runner.os == 'Linux' }} + uses: codecov/codecov-action@v2 - name: Deploy - if: ${{ env.REFERENCE == 'true' && github.event_name == 'push' }} + if: ${{ runner.os == 'Linux' && github.event_name == 'push' }} shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - githubToken: ${{ secrets.AUTOMERGE_TOKEN }} GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} @@ -108,43 +67,21 @@ jobs: ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} - SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} - run: .github/build-steps/deploy.sh || .github/build-steps/deploy.sh - Build-Success: - runs-on: ubuntu-latest - needs: Build - steps: - - shell: bash - run: touch ok - - uses: actions/upload-artifact@v2 - with: - name: success - path: ok - CI-Complete: - needs: Build-Success - if: always() - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v2 - with: - name: success - - shell: bash - run: '[ -f ok ]' - Automerge: - needs: CI-Complete - runs-on: ubuntu-latest - if: success() - steps: - - name: automerge - uses: "DanySK/yaagha@master" - env: - GITHUB_TOKEN: "${{ secrets.AUTOMERGE_TOKEN }}" - MERGE_FORKS: "false" - MERGE_LABELS: "version-upgrade" - BLOCK_LABELS: "blocked, wontfix, invalid" - MERGE_METHOD: "rebase" - CLOSE_ON_CONFLICT: "true" - DELETE_BRANCH_ON_CLOSE: "true" - GIT_USER_NAME: "Danilo Pianini" - GIT_USER_EMAIL: "danilo.pianini@gmail.com" + run: | + ./gradlew publishPluginMavenPublicationToMavenCentralRepository publishKotlinMavenPublicationToMavenCentralRepository + ./gradlew publishPluginMavenPublicationToGithubRepository || true + ./gradlew publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET || true + - name: Turn off the Gradle Daemon + shell: bash + run: ./gradlew --stop + - name: Cleanup the Gradle cache + if: ${{ runner.os != 'Windows' }} + shell: bash + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + - name: Force the Gradle cleanup on Windows + if: ${{ runner.os == 'Windows' }} + run: | + Remove-Item -Force c:\Users\runneradmin\.gradle\caches\modules-2\modules-2.lock + Remove-Item -Force c:\Users\runneradmin\.gradle\caches\modules-2\gc.properties