Skip to content

Commit

Permalink
Update to sbt-typelevel 0.5.0-RC12
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Aug 21, 2023
1 parent 2700c0b commit d6bc67a
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 119 deletions.
153 changes: 72 additions & 81 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,76 +15,55 @@ on:
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPARK_LOCAL_IP: localhost


concurrency:
group: ${{ github.workflow }} @ ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11, 2.12.18]
scala: [2.13, 2.12]
java: [temurin@8]
project: [root-spark32, root-spark33, root-spark34]
exclude:
- scala: 2.13.11
- scala: 2.13
project: root-spark32
- scala: 2.13.11
- scala: 2.13
project: root-spark33
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: temurin
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x
cache: sbt

- name: Setup codecov
run: pip install codecov
- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- name: Check code style
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' scalafmtSbtCheck scalafmtCheck
- name: Check formatting
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Test & Compute Coverage
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' coverage test test/coverageReport
Expand All @@ -97,8 +76,7 @@ jobs:
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' doc

- name: Upload Codecov Results
run: codecov -F ${{ matrix.scala }}
- uses: codecov/codecov-action@v3

publish:
name: Publish Artifacts
Expand All @@ -115,50 +93,46 @@ jobs:
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v2
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: temurin
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
cache: sbt

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: echo $PGP_SECRET | base64 -di | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
- name: Publish
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
run: sbt tlCiRelease

site:
name: Generate Site
dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
Expand All @@ -170,40 +144,57 @@ jobs:
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v2
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: root-spark33_2.13 root-spark33_2.12 docs_2.13 docs_2.12 root-spark34_2.13 root-spark34_2.12 root-spark32_2.13 root-spark32_2.12
configs-ignore: test scala-tool scala-doc-tool test-internal

site:
name: Generate Site
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: temurin
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
cache: sbt

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: sbt update
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
run: sbt +update

- name: Generate site
run: sbt docs/tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: peaceiris/[email protected].0
uses: peaceiris/[email protected].3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: mdocs/target/docs/site
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ ThisBuild / tlBaseVersion := "0.14"

ThisBuild / crossScalaVersions := Seq(Scala213, Scala212)
ThisBuild / scalaVersion := Scala212
ThisBuild / tlSkipIrrelevantScalas := true

lazy val root = project
.in(file("."))
.enablePlugins(NoPublishPlugin)
.settings(crossScalaVersions := Nil)
.aggregate(`root-spark34`, `root-spark33`, `root-spark32`, docs)

lazy val `root-spark34` = project
Expand Down Expand Up @@ -396,5 +396,5 @@ val roots = List("root-spark32", "root-spark33", "root-spark34")
ThisBuild / githubWorkflowBuildMatrixAdditions += "project" -> roots

ThisBuild / githubWorkflowBuildMatrixExclusions ++= roots.init.map { project =>
MatrixExclude(Map("scala" -> Scala213, "project" -> project))
MatrixExclude(Map("scala" -> "2.13", "project" -> project))
}
47 changes: 14 additions & 33 deletions github.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,26 @@ ThisBuild / githubWorkflowArtifactUpload := false // doesn't work with scoverage

ThisBuild / githubWorkflowEnv += "SPARK_LOCAL_IP" -> "localhost"

ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Use(
UseRef.Public("actions", "setup-python", "v2"),
name = Some("Setup Python"),
params = Map(
"python-version" -> "3.x"
)
),
WorkflowStep.Run(
List("pip install codecov"),
name = Some("Setup codecov")
)
)

ThisBuild / githubWorkflowArtifactDownloadExtraKeys += "project"

ThisBuild / githubWorkflowBuildSbtStepPreamble += s"project $${{ matrix.project }}"

ThisBuild / tlCiScalafmtCheck := true
ThisBuild / githubWorkflowBuild ~= { steps =>
steps.flatMap { // replace the test step
case _ @WorkflowStep.Sbt(List("test"), _, _, _, _, _) =>
List(
WorkflowStep.Sbt(
List("scalafmtSbtCheck", "scalafmtCheck"),
name = Some("Check code style")
),
WorkflowStep.Sbt(
List("coverage", "test", "test/coverageReport"),
name = Some("Test & Compute Coverage")
)
steps.map { // replace the test step
case _ @WorkflowStep.Sbt(List("test"), _, _, _, _, _, _, _) =>
WorkflowStep.Sbt(
List("coverage", "test", "test/coverageReport"),
name = Some("Test & Compute Coverage")
)

case step => List(step)
case step => step
}
}

ThisBuild / githubWorkflowBuildPostamble ++= Seq(
WorkflowStep.Run(
List(s"codecov -F $${{ matrix.scala }}"),
name = Some("Upload Codecov Results")
ThisBuild / githubWorkflowBuildPostamble +=
WorkflowStep.Use(
UseRef.Public(
"codecov",
"codecov-action",
"v3"
)
)
)
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
val sbtTypelevelVersion = "0.4.22"
val sbtTypelevelVersion = "0.5.0-RC12"

addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % sbtTypelevelVersion)

addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

0 comments on commit d6bc67a

Please sign in to comment.