Skip to content

Commit c962ca1

Browse files
Merge pull request #303 from davenverse/updates
Update Build and Deps
2 parents 0e113e3 + f5e4719 commit c962ca1

13 files changed

Lines changed: 204 additions & 106 deletions

File tree

.github/workflows/ci.yml

Lines changed: 151 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
tags: [v*]
1616

1717
env:
18+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
19+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
21+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
22+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
1823
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1924

2025
jobs:
@@ -23,19 +28,31 @@ jobs:
2328
strategy:
2429
matrix:
2530
os: [ubuntu-latest]
26-
scala: [2.12.10, 2.13.6, 3.1.2]
27-
java: [adopt@1.8, adopt@1.11]
31+
scala: [2.12.15, 2.13.8, 3.2.1]
32+
java: [temurin@8]
33+
project: [rootJVM]
2834
runs-on: ${{ matrix.os }}
2935
steps:
3036
- name: Checkout current branch (full)
3137
uses: actions/checkout@v2
3238
with:
3339
fetch-depth: 0
3440

35-
- name: Setup Java and Scala
36-
uses: olafurpg/setup-scala@v12
41+
- name: Download Java (temurin@8)
42+
id: download-java-temurin-8
43+
if: matrix.java == 'temurin@8'
44+
uses: typelevel/download-java@v1
3745
with:
38-
java-version: ${{ matrix.java }}
46+
distribution: temurin
47+
java-version: 8
48+
49+
- name: Setup Java (temurin@8)
50+
if: matrix.java == 'temurin@8'
51+
uses: actions/setup-java@v2
52+
with:
53+
distribution: jdkfile
54+
java-version: 8
55+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
3956

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

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

58-
- name: Install microsite dependencies
59-
if: matrix.scala == '2.13.6'
60-
run: |
61-
gem install saas
62-
gem install jekyll -v 4.2.0
72+
- name: Test
73+
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test
6374

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

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

69-
- if: matrix.scala == '2.13.6'
70-
run: sbt --client '++${{ matrix.scala }}; site/makeMicrosite'
83+
- name: Make target directories
84+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
85+
run: mkdir -p target .js/target site/target .jvm/target .native/target core/target example/target project/target
86+
87+
- name: Compress target directories
88+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
89+
run: tar cf targets.tar target .js/target site/target .jvm/target .native/target core/target example/target project/target
90+
91+
- name: Upload target directories
92+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
96+
path: targets.tar
7197

7298
publish:
7399
name: Publish Artifacts
@@ -76,19 +102,30 @@ jobs:
76102
strategy:
77103
matrix:
78104
os: [ubuntu-latest]
79-
scala: [3.1.2]
80-
java: [adopt@1.8]
105+
scala: [2.13.8]
106+
java: [temurin@8]
81107
runs-on: ${{ matrix.os }}
82108
steps:
83109
- name: Checkout current branch (full)
84110
uses: actions/checkout@v2
85111
with:
86112
fetch-depth: 0
87113

88-
- name: Setup Java and Scala
89-
uses: olafurpg/setup-scala@v12
114+
- name: Download Java (temurin@8)
115+
id: download-java-temurin-8
116+
if: matrix.java == 'temurin@8'
117+
uses: typelevel/download-java@v1
90118
with:
91-
java-version: ${{ matrix.java }}
119+
distribution: temurin
120+
java-version: 8
121+
122+
- name: Setup Java (temurin@8)
123+
if: matrix.java == 'temurin@8'
124+
uses: actions/setup-java@v2
125+
with:
126+
distribution: jdkfile
127+
java-version: 8
128+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
92129

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

105-
- uses: olafurpg/setup-gpg@v3
142+
- name: Download target directories (2.12.15, rootJVM)
143+
uses: actions/download-artifact@v2
144+
with:
145+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM
146+
147+
- name: Inflate target directories (2.12.15, rootJVM)
148+
run: |
149+
tar xf targets.tar
150+
rm targets.tar
151+
152+
- name: Download target directories (2.13.8, rootJVM)
153+
uses: actions/download-artifact@v2
154+
with:
155+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM
156+
157+
- name: Inflate target directories (2.13.8, rootJVM)
158+
run: |
159+
tar xf targets.tar
160+
rm targets.tar
106161
107-
- name: Setup Ruby
108-
uses: ruby/setup-ruby@v1
162+
- name: Download target directories (3.2.1, rootJVM)
163+
uses: actions/download-artifact@v2
109164
with:
110-
ruby-version: 3.0.1
165+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJVM
111166

112-
- name: Install microsite dependencies
167+
- name: Inflate target directories (3.2.1, rootJVM)
113168
run: |
114-
gem install saas
115-
gem install jekyll -v 4.2.0
169+
tar xf targets.tar
170+
rm targets.tar
171+
172+
- name: Import signing key
173+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
174+
run: echo $PGP_SECRET | base64 -di | gpg --import
175+
176+
- name: Import signing key and strip passphrase
177+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
178+
run: |
179+
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
180+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
181+
(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)
182+
183+
- name: Publish
184+
run: sbt '++${{ matrix.scala }}' tlRelease
185+
186+
site:
187+
name: Generate Site
188+
strategy:
189+
matrix:
190+
os: [ubuntu-latest]
191+
scala: [2.13.8]
192+
java: [temurin@8]
193+
runs-on: ${{ matrix.os }}
194+
steps:
195+
- name: Checkout current branch (full)
196+
uses: actions/checkout@v2
197+
with:
198+
fetch-depth: 0
199+
200+
- name: Download Java (temurin@8)
201+
id: download-java-temurin-8
202+
if: matrix.java == 'temurin@8'
203+
uses: typelevel/download-java@v1
204+
with:
205+
distribution: temurin
206+
java-version: 8
207+
208+
- name: Setup Java (temurin@8)
209+
if: matrix.java == 'temurin@8'
210+
uses: actions/setup-java@v2
211+
with:
212+
distribution: jdkfile
213+
java-version: 8
214+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
116215

117-
- name: Publish artifacts to Sonatype
118-
env:
119-
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
120-
PGP_SECRET: ${{ secrets.PGP_SECRET }}
121-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
122-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
123-
run: sbt --client '++${{ matrix.scala }}; ci-release'
216+
- name: Cache sbt
217+
uses: actions/cache@v2
218+
with:
219+
path: |
220+
~/.sbt
221+
~/.ivy2/cache
222+
~/.coursier/cache/v1
223+
~/.cache/coursier/v1
224+
~/AppData/Local/Coursier/Cache/v1
225+
~/Library/Caches/Coursier/v1
226+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
124227

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

127-
- name: Publish microsite
128-
run: sbt --client '++${{ matrix.scala }}; site/publishMicrosite'
231+
- name: Publish site
232+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
233+
uses: peaceiris/actions-gh-pages@v3.8.0
234+
with:
235+
github_token: ${{ secrets.GITHUB_TOKEN }}
236+
publish_dir: site/target/docs/site
237+
keep_files: true

.github/workflows/clean.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ jobs:
5656
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
5757
ghapi -X DELETE $REPO/actions/artifacts/$id
5858
done
59-
done
59+
done

build.sbt

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
1+
ThisBuild / tlBaseVersion := "0.4"
22

3-
ThisBuild / crossScalaVersions := Seq("2.12.10", "2.13.6", "3.1.2")
3+
ThisBuild / organization := "io.chrisdavenport"
4+
ThisBuild / organizationName := "Christopher Davenport"
5+
ThisBuild / licenses := Seq(License.MIT)
6+
ThisBuild / developers := List(
7+
// your GitHub handle and name
8+
tlGitHubDev("christopherdavenport", "Christopher Davenport")
9+
)
410

5-
val catsV = "2.7.0"
6-
val catsEffectV = "3.3.12"
7-
val fs2V = "3.2.7"
8-
val http4sV = "0.23.0"
9-
val circeV = "0.14.2"
10-
val catsEffectTestingV = "1.4.0"
11-
val log4catsV = "2.3.1"
12-
val logbackClassicV = "1.2.11"
11+
ThisBuild / tlCiReleaseBranches := Seq("main")
1312

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

17+
val catsV = "2.8.0"
18+
val catsEffectV = "3.4.2"
19+
val fs2V = "3.4.0"
20+
val http4sV = "0.23.16"
21+
val circeV = "0.14.3"
22+
val catsEffectTestingV = "1.5.0"
23+
val log4catsV = "2.5.0"
24+
val logbackClassicV = "1.2.11"
1625

17-
lazy val `github` = project.in(file("."))
18-
.disablePlugins(MimaPlugin)
19-
.enablePlugins(NoPublishPlugin)
26+
lazy val `github` = tlCrossRootProject
2027
.aggregate(core, example)
2128

2229
lazy val core = project.in(file("core"))
2330
.enablePlugins(BuildInfoPlugin)
2431
.settings(
2532
name := "github",
2633
scalacOptions -= "-Xfatal-warnings",
27-
scalacOptions ++= {
28-
if (isDotty.value) Seq("-language:postfixOps")
29-
else Seq()
30-
},
31-
mimaVersionCheckExcludedVersions := {
32-
if (isDotty.value) Set("0.3.0")
33-
else Set()
34-
},
3534
buildInfoKeys := Seq[BuildInfoKey](version),
3635
buildInfoPackage := "io.chrisdavenport.github",
3736
libraryDependencies ++= Seq(
@@ -47,9 +46,7 @@ lazy val core = project.in(file("core"))
4746
"io.circe" %% "circe-core" % circeV,
4847
// "io.circe" %% "circe-literal" % circeV % Test,
4948
"io.circe" %% "circe-parser" % circeV % Test,
50-
51-
("org.specs2" %% "specs2-core" % specs2V % Test).cross(CrossVersion.for3Use2_13),
52-
("org.specs2" %% "specs2-scalacheck" % specs2V % Test).cross(CrossVersion.for3Use2_13),
49+
5350
"org.typelevel" %% "cats-effect-testing-specs2" % catsEffectTestingV % Test
5451
)
5552
)
@@ -61,16 +58,12 @@ lazy val example = project.in(file("example"))
6158
.settings(
6259
libraryDependencies ++= Seq(
6360
// For Testing As I go
64-
"org.http4s" %% "http4s-blaze-client" % http4sV,
61+
"org.http4s" %% "http4s-ember-client" % http4sV,
6562
"org.typelevel" %% "log4cats-slf4j" % log4catsV,
6663
"ch.qos.logback" % "logback-classic" % logbackClassicV,
6764
)
6865
)
6966

7067
lazy val site = project.in(file("site"))
71-
.disablePlugins(MimaPlugin)
72-
.enablePlugins(NoPublishPlugin)
73-
.enablePlugins(DavenverseMicrositePlugin)
74-
.settings(
75-
micrositeDescription := "Github Integration for Scala",
76-
)
68+
.enablePlugins(TypelevelSitePlugin)
69+
.dependsOn(core)

core/src/main/scala/io/chrisdavenport/github/data/Repositories.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ object Repositories {
183183
"public" -> a.isPublic.asJson,
184184
"has_issues" -> a.hasIssues.asJson,
185185
"has_wiki" -> a.hasWiki.asJson,
186-
"has_downloads" -> a.hasDownloads.asJson
186+
"has_downloads" -> a.hasDownloads.asJson,
187187
"visibility" -> a.visibility.asJson
188188
).dropNullValues
189189
}

core/src/test/scala/io/chrisdavenport/github/endpoints/GistsSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ class GistsSpec extends Specification with CatsEffect with JsonFiles {
5959
.take(1)
6060
.compile
6161
.toList
62-
.map(_ must not beEmpty)
62+
.map(_ must not(beEmpty))
6363
}
6464

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

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

7373
"get a single gist" in {

core/src/test/scala/io/chrisdavenport/github/endpoints/repositories/ForksSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class ForksSpec extends Specification with CatsEffect {
262262
.run(Client.fromHttpApp(routes.orNotFound))
263263
.compile
264264
.last
265-
.map { _ must not beEmpty }
265+
.map { _ must not(beNone) }
266266
}
267267
}
268268
}

0 commit comments

Comments
 (0)