From 9d8d8136d8f7efef2e2c9d4a55d790ed97da903a Mon Sep 17 00:00:00 2001 From: Pawel Kurowski Date: Wed, 19 Feb 2025 17:34:31 +0100 Subject: [PATCH 1/3] github actions refactor --- .github/workflows/ci.yml | 100 ++++------------------------ .github/workflows/scala-steward.yml | 23 ++----- 2 files changed, 19 insertions(+), 104 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f070f4c2..a7e738cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,110 +6,38 @@ on: branches: ['**'] tags: [v*] jobs: - ci: + build: + uses: softwaremill/github-actions-workflows/.github/workflows/build-scala.yml@main # run on 1) push, 2) external PRs, 3) softwaremill-ci PRs # do not run on internal, non-steward PRs since those will be run by push to branch if: | github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'softwaremill-ci' - runs-on: ubuntu-22.04 strategy: matrix: java: [ '11', '17', '21' ] fail-fast: false - steps: - - name: Set environment variables for Java - run: echo 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' >> $GITHUB_ENV - - name: Checkout - uses: actions/checkout@v4 - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: ${{ matrix.java }} - cache: 'sbt' - - name: Compile - run: sbt -v compile - - name: Test - run: sbt -v test + with: + java-version: ${{ matrix.java }} + java-opts: 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' publish: - name: Publish release - needs: [ci] + uses: softwaremill/github-actions-workflows/.github/workflows/publish-release.yml@main + needs: [build] if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) - runs-on: ubuntu-22.04 - env: - JAVA_OPTS: -Xmx5G - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: '17' - cache: 'sbt' - - name: Compile - run: sbt compile - - name: Publish artifacts - run: sbt ci-release - env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - - name: Extract version from commit message - run: | - version=${GITHUB_REF/refs\/tags\/v/} - echo "VERSION=$version" >> $GITHUB_ENV - env: - COMMIT_MSG: ${{ github.event.head_commit.message }} - - name: Publish release notes - uses: release-drafter/release-drafter@v5 - with: - config-name: release-drafter.yml - publish: true - name: "v${{ env.VERSION }}" - tag: "v${{ env.VERSION }}" - version: "v${{ env.VERSION }}" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + secrets: inherit + with: + java-version: '17' + java-opts: "-Xmx5G" - # `automerge` label is attached iff there is exactly one file changed by steward and this file belongs to a - # whitelist specified by `labeler.yml` label: - name: Attach automerge label # only for PRs by softwaremill-ci if: github.event.pull_request.user.login == 'softwaremill-ci' - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - # count number of files changed - - name: Count number of files changed - id: count-changed-files - run: | - N=$(git diff --name-only -r HEAD^1 HEAD | wc -w) - echo "changed_files_num=$N" >> $GITHUB_OUTPUT - - name: Launch labeler - # skip if more than one file changed - if: steps.count-changed-files.outputs.changed_files_num == 1 - uses: srvaroa/labeler@master - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + uses: softwaremill/github-actions-workflows/.github/workflows/label.yml@main auto-merge: - name: Auto merge # only for PRs by softwaremill-ci if: github.event.pull_request.user.login == 'softwaremill-ci' - needs: [ ci, label ] - runs-on: ubuntu-22.04 - steps: - - id: automerge - name: automerge - uses: "pascalgn/automerge-action@v0.15.6" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_METHOD: "squash" \ No newline at end of file + needs: [ build, label ] + uses: softwaremill/github-actions-workflows/.github/workflows/auto-merge.yml@main \ No newline at end of file diff --git a/.github/workflows/scala-steward.yml b/.github/workflows/scala-steward.yml index 8adddbcb..85c7a656 100644 --- a/.github/workflows/scala-steward.yml +++ b/.github/workflows/scala-steward.yml @@ -8,21 +8,8 @@ on: jobs: scala-steward: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - cache: 'sbt' - - name: Launch Scala Steward - uses: scala-steward-org/scala-steward-action@v2 - with: - author-name: scala-steward - author-email: scala-steward - github-token: ${{ secrets.REPO_GITHUB_TOKEN }} - repo-config: .scala-steward.conf - ignore-opts-files: false + uses: softwaremill/github-actions-workflows/.github/workflows/scala-steward.yml@main + with: + java-version: '17' + secrets: + repo-github-token: ${{secrets.REPO_GITHUB_TOKEN}} \ No newline at end of file From 2c9a0a84c0c1339354e1d17ea8073a8e3dd0e2bd Mon Sep 17 00:00:00 2001 From: Pawel Kurowski Date: Thu, 20 Feb 2025 10:58:11 +0100 Subject: [PATCH 2/3] java-opts fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7e738cf..615ab886 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false with: java-version: ${{ matrix.java }} - java-opts: 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' + java-opts: '-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' publish: uses: softwaremill/github-actions-workflows/.github/workflows/publish-release.yml@main From 892980116ce141ea6816911d8cf1976e36c045f8 Mon Sep 17 00:00:00 2001 From: Pawel Kurowski Date: Wed, 5 Mar 2025 14:41:31 +0100 Subject: [PATCH 3/3] Trigger Build