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

Update Build and Deps #303

Merged
merged 2 commits into from
Nov 29, 2022
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
193 changes: 151 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ 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 }}

jobs:
Expand All @@ -23,19 +28,31 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.10, 2.13.6, 3.1.2]
java: [[email protected], [email protected]]
scala: [2.12.15, 2.13.8, 3.2.1]
java: [temurin@8]
project: [rootJVM]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v12
- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

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

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -49,25 +66,34 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup Ruby
if: matrix.scala == '2.13.6'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.1
- name: Check that workflows are up to date
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck

- name: Install microsite dependencies
if: matrix.scala == '2.13.6'
run: |
gem install saas
gem install jekyll -v 4.2.0
- name: Test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

- name: Check that workflows are up to date
run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck'
- name: Check binary compatibility
if: matrix.java == 'temurin@8'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues

- run: sbt --client '++${{ matrix.scala }}; test; mimaReportBinaryIssues'
- name: Generate API documentation
if: matrix.java == 'temurin@8'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc

- if: matrix.scala == '2.13.6'
run: sbt --client '++${{ matrix.scala }}; site/makeMicrosite'
- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target .js/target site/target .jvm/target .native/target core/target example/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar target .js/target site/target .jvm/target .native/target core/target example/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar

publish:
name: Publish Artifacts
Expand All @@ -76,19 +102,30 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.2]
java: [adopt@1.8]
scala: [2.13.8]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v12
- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

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

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -102,27 +139,99 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- uses: olafurpg/setup-gpg@v3
- name: Download target directories (2.12.15, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM

- name: Inflate target directories (2.12.15, rootJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.8, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM

- name: Inflate target directories (2.13.8, rootJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Download target directories (3.2.1, rootJVM)
uses: actions/download-artifact@v2
with:
ruby-version: 3.0.1
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJVM

- name: Install microsite dependencies
- name: Inflate target directories (3.2.1, rootJVM)
run: |
gem install saas
gem install jekyll -v 4.2.0
tar xf targets.tar
rm targets.tar

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

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.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
run: sbt '++${{ matrix.scala }}' tlRelease

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

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

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

- name: Publish artifacts to Sonatype
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt --client '++${{ matrix.scala }}; ci-release'
- name: Cache sbt
uses: actions/cache@v2
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') }}

- uses: christopherdavenport/create-ghpages-ifnotexists@v1
- name: Generate site
run: sbt '++${{ matrix.scala }}' site/tlSite

- name: Publish microsite
run: sbt --client '++${{ matrix.scala }}; site/publishMicrosite'
- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/docs/site
keep_files: true
2 changes: 1 addition & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ jobs:
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
ghapi -X DELETE $REPO/actions/artifacts/$id
done
done
done
57 changes: 25 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
ThisBuild / tlBaseVersion := "0.4"

ThisBuild / crossScalaVersions := Seq("2.12.10", "2.13.6", "3.1.2")
ThisBuild / organization := "io.chrisdavenport"
ThisBuild / organizationName := "Christopher Davenport"
ThisBuild / licenses := Seq(License.MIT)
ThisBuild / developers := List(
// your GitHub handle and name
tlGitHubDev("christopherdavenport", "Christopher Davenport")
)

val catsV = "2.7.0"
val catsEffectV = "3.3.12"
val fs2V = "3.2.7"
val http4sV = "0.23.0"
val circeV = "0.14.2"
val catsEffectTestingV = "1.4.0"
val log4catsV = "2.3.1"
val logbackClassicV = "1.2.11"
ThisBuild / tlCiReleaseBranches := Seq("main")

val specs2V = "4.12.3"
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.8", "3.2.1")

val catsV = "2.8.0"
val catsEffectV = "3.4.2"
val fs2V = "3.4.0"
val http4sV = "0.23.16"
val circeV = "0.14.3"
val catsEffectTestingV = "1.5.0"
val log4catsV = "2.5.0"
val logbackClassicV = "1.2.11"

lazy val `github` = project.in(file("."))
.disablePlugins(MimaPlugin)
.enablePlugins(NoPublishPlugin)
lazy val `github` = tlCrossRootProject
.aggregate(core, example)

lazy val core = project.in(file("core"))
.enablePlugins(BuildInfoPlugin)
.settings(
name := "github",
scalacOptions -= "-Xfatal-warnings",
scalacOptions ++= {
if (isDotty.value) Seq("-language:postfixOps")
else Seq()
},
mimaVersionCheckExcludedVersions := {
if (isDotty.value) Set("0.3.0")
else Set()
},
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "io.chrisdavenport.github",
libraryDependencies ++= Seq(
Expand All @@ -47,9 +46,7 @@ lazy val core = project.in(file("core"))
"io.circe" %% "circe-core" % circeV,
// "io.circe" %% "circe-literal" % circeV % Test,
"io.circe" %% "circe-parser" % circeV % Test,

("org.specs2" %% "specs2-core" % specs2V % Test).cross(CrossVersion.for3Use2_13),
("org.specs2" %% "specs2-scalacheck" % specs2V % Test).cross(CrossVersion.for3Use2_13),

"org.typelevel" %% "cats-effect-testing-specs2" % catsEffectTestingV % Test
)
)
Expand All @@ -61,16 +58,12 @@ lazy val example = project.in(file("example"))
.settings(
libraryDependencies ++= Seq(
// For Testing As I go
"org.http4s" %% "http4s-blaze-client" % http4sV,
"org.http4s" %% "http4s-ember-client" % http4sV,
"org.typelevel" %% "log4cats-slf4j" % log4catsV,
"ch.qos.logback" % "logback-classic" % logbackClassicV,
)
)

lazy val site = project.in(file("site"))
.disablePlugins(MimaPlugin)
.enablePlugins(NoPublishPlugin)
.enablePlugins(DavenverseMicrositePlugin)
.settings(
micrositeDescription := "Github Integration for Scala",
)
.enablePlugins(TypelevelSitePlugin)
.dependsOn(core)
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ object Repositories {
"public" -> a.isPublic.asJson,
"has_issues" -> a.hasIssues.asJson,
"has_wiki" -> a.hasWiki.asJson,
"has_downloads" -> a.hasDownloads.asJson
"has_downloads" -> a.hasDownloads.asJson,
"visibility" -> a.visibility.asJson
).dropNullValues
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ class GistsSpec extends Specification with CatsEffect with JsonFiles {
.take(1)
.compile
.toList
.map(_ must not beEmpty)
.map(_ must not(beEmpty))
}

"list all public gists" in {
Gists.allPublic[IO](None, None).run(client).take(1).compile.toList.map(_ must not beEmpty)
Gists.allPublic[IO](None, None).run(client).take(1).compile.toList.map(_ must not(beEmpty))
}

"list starred gists" in {
Gists.starred[IO](None, OAuth("")).run(client).take(1).compile.toList.map(_ must not beEmpty)
Gists.starred[IO](None, OAuth("")).run(client).take(1).compile.toList.map(_ must not(beEmpty))
}

"get a single gist" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class ForksSpec extends Specification with CatsEffect {
.run(Client.fromHttpApp(routes.orNotFound))
.compile
.last
.map { _ must not beEmpty }
.map { _ must not(beNone) }
}
}
}
Loading