Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target JDK 1.8 and use sbt-github-actions for snapshot publish #97

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 64 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
scala: [2.12.18]
java: [temurin@11, temurin@17, temurin@21]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -45,33 +45,79 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 8
cache: sbt

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v4
- name: Check that workflows are up to date
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

- shell: bash
run: sbt '++ ${{ matrix.scala }}' test scripted

- name: Compress target directories
shell: bash
run: tar cf targets.tar target theme/target plugin/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v4
with:
distribution: temurin
java-version: 17
cache: sbt
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.18]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false

- name: Setup Java (temurin@21)
if: matrix.java == 'temurin@21'
- name: Configure pagefile for Windows
if: contains(runner.os, 'windows')
uses: al-cheb/[email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why all this windows stuff? not a blocker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just making sure that the plugin can be built on windows for people such as @He-Pin . The specific code you are pointing out is a workaround for how windows handles page files (tl;dr due to limited resources of github actions runners its possible to run out of memory specifically for windows).

with:
minimum-size: 2GB
maximum-size: 8GB
disk-root: 'C:'

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
java-version: 8
cache: sbt

- name: Check that workflows are up to date
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
- name: Download target directories (2.12.18)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-2.12.18-${{ matrix.java }}

- shell: bash
run: sbt '++ ${{ matrix.scala }}' test scripted
- name: Inflate target directories (2.12.18)
run: |
tar xf targets.tar
rm targets.tar

- name: Publish project
env:
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PW: ${{ secrets.NEXUS_PW }}
run: sbt publish
33 changes: 0 additions & 33 deletions .github/workflows/publish.yml

This file was deleted.

21 changes: 15 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver

scalaVersion := "2.13.11"
val scala212 = "2.12.18"

ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := Seq(scala212)

ThisBuild / apacheSonatypeProjectProfile := "pekko"
ThisBuild / dynverSonatypeSnapshots := true
Expand Down Expand Up @@ -88,12 +91,18 @@ lazy val pekkoPlugin = project
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "scripted")))

ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
ThisBuild / githubWorkflowPublish := Seq()
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
RefPredicate.Equals(Ref.Branch("main")))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures that we only run +publish when a PR is merged into main, i.e. snapshots (see https://github.com/sbt/sbt-github-actions?tab=readme-ov-file#integration-with-sbt-ci-release for instructions).


ThisBuild / githubWorkflowPublish := Seq(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly the same as the original publish.yml.

WorkflowStep.Sbt(
commands = List("publish"),
name = Some("Publish project"),
env = Map(
"NEXUS_USER" -> "${{ secrets.NEXUS_USER }}",
"NEXUS_PW" -> "${{ secrets.NEXUS_PW }}")))

ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-latest", "windows-latest")

ThisBuild / githubWorkflowJavaVersions := Seq(
JavaSpec.temurin("11"),
JavaSpec.temurin("17"),
JavaSpec.temurin("21"))
JavaSpec.temurin("8"))
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

// When updating the sbt-paradox version,
// remember to also update build.sbt
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.10.6")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.9.2")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.10")
Expand Down
Loading