Skip to content

Commit

Permalink
Dependencies update and GitHub Actions Configuration (#607)
Browse files Browse the repository at this point in the history
* Dependencies update and GitHub Actions Configuration

* Add .sbtopts

* Run JDK11 tests only

* Corss Scala warnings fix

* Configure CI release

* Configure dependabot
  • Loading branch information
pomadchin authored Oct 3, 2023
1 parent 8cdec71 commit c9e85e1
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 296 deletions.
128 changes: 0 additions & 128 deletions .circleci/config.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI
on:
pull_request:
branches: ['**']
push:
branches: ['**']
tags: [v*]
jobs:
build:
name: Build and Test
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'stac-utils/stac4s'
strategy:
matrix:
os: [ubuntu-latest]
java: [11]
distribution: [temurin]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v3
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}

- name: Check formatting
run: sbt ";scalafix --check; scalafmtCheck; scalafmtSbtCheck; scapegoat;"

- name: Build project
run: sbt +test

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
strategy:
matrix:
os: [ubuntu-latest]
java: [8]
distribution: [temurin]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}

- name: Release
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
if: ${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }}
9 changes: 9 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-J-Xmx2g
-J-Xms64m
-J-Xss2M
-J-XX:+UseG1GC
-J-XX:+UseStringDeduplication
-J-XX:+UseCompressedOops
-Dfile.encoding=UTF8
-Djava.awt.headless=true
-Dsun.io.serialization.extendedDebugInfo=true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# stac4s

[![CircleCI](https://circleci.com/gh/azavea/stac4s/tree/master.svg?style=svg)](https://circleci.com/gh/azavea/stac4s/tree/master) [![Maven Central](https://img.shields.io/maven-central/v/com.azavea.stac4s/client_2.12?color=blue)](http://search.maven.org/#search%7Cga%7C1%7com.azavea.stac4s) [![Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.azavea.stac4s/client_2.12.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/azavea/stac4s/)
[![CI](https://github.com/stac-utils/stac4s/workflows/CI/badge.svg)](https://github.com/stac-utils/stac4s/actions) [![Maven Central](https://img.shields.io/maven-central/v/com.azavea.stac4s/client_2.12?color=blue)](http://search.maven.org/#search%7Cga%7C1%7com.azavea.stac4s) [![Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.azavea.stac4s/client_2.12.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/azavea/stac4s/)

[![Join the chat at https://gitter.im/azavea/stac4s](https://badges.gitter.im/azavea/stac4s.svg)](https://gitter.im/azavea/stac4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand Down
50 changes: 11 additions & 39 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,17 @@ import xerial.sbt.Sonatype._
ThisBuild / versionScheme := Some("semver-spec")

lazy val commonSettings = Seq(
// We are overriding the default behavior of sbt-git which, by default, only
// appends the `-SNAPSHOT` suffix if there are uncommitted changes in the
// workspace.
version := {
if (git.gitDescribedVersion.value.isEmpty)
git.gitHeadCommit.value.get.substring(0, 7) + "-SNAPSHOT"
else if (git.gitCurrentTags.value.isEmpty || git.gitUncommittedChanges.value)
git.gitDescribedVersion.value.get + "-SNAPSHOT"
else
git.gitDescribedVersion.value.get
},
scalaVersion := "2.12.17",
crossScalaVersions := List("2.12.17", "2.13.10"),
scalaVersion := "2.13.12",
crossScalaVersions := List("2.13.12", "2.12.18"),
Global / cancelable := true,
scalafmtOnCompile := true,
scalafmtOnCompile := false,
ThisBuild / scapegoatVersion := Versions.Scapegoat,
scapegoatDisabledInspections := Seq("ObjectNames", "EmptyCaseClass"),
unusedCompileDependenciesFilter -= moduleFilter("com.sksamuel.scapegoat", "scalac-scapegoat-plugin"),
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"),
addCompilerPlugin(scalafixSemanticdb),
autoCompilerPlugins := true,
externalResolvers := Seq(
DefaultMavenRepository,
Resolver.sonatypeRepo("snapshots"),
externalResolvers := Seq(DefaultMavenRepository) ++ Resolver.sonatypeOssRepos("snapshots") ++ Seq(
Resolver.typesafeIvyRepo("releases"),
Resolver.bintrayRepo("azavea", "maven"),
Resolver.bintrayRepo("azavea", "geotrellis"),
Expand All @@ -39,8 +25,7 @@ lazy val commonSettings = Seq(
Resolver.file("local", file(Path.userHome.absolutePath + "/.ivy2/local"))(
Resolver.ivyStylePatterns
)
),
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"
)
)

lazy val noPublishSettings = Seq(
Expand All @@ -55,7 +40,7 @@ lazy val publishSettings = Seq(
organizationHomepage := Some(new URL("https://azavea.com/")),
description := "stac4s is a scala library with primitives to build applications using the SpatioTemporal Asset Catalogs specification",
Test / publishArtifact := false
) ++ sonatypeSettings ++ credentialSettings
) ++ sonatypeSettings

lazy val sonatypeSettings = Seq(
publishMavenStyle := true,
Expand Down Expand Up @@ -93,20 +78,7 @@ lazy val sonatypeSettings = Seq(
url = url("https://www.azavea.com")
)
),
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
publishTo := sonatypePublishTo.value
)

lazy val credentialSettings = Seq(
credentials ++= List(
for {
id <- sys.env.get("GPG_KEY_ID")
} yield Credentials("GnuPG Key ID", "gpg", id, "ignored"),
for {
user <- sys.env.get("SONATYPE_USERNAME")
pass <- sys.env.get("SONATYPE_PASSWORD")
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass)
).flatten
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
)

val jvmGeometryDependencies = Def.setting {
Expand Down Expand Up @@ -166,7 +138,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
)
})
.jvmSettings(libraryDependencies ++= coreDependenciesJVM.value)
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.3.0")
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % Versions.ScalaJavaTime)

lazy val coreJVM = core.jvm
lazy val coreJS = core.js
Expand All @@ -191,7 +163,7 @@ lazy val testing = crossProject(JSPlatform, JVMPlatform)
)
)
.jvmSettings(libraryDependencies ++= testingDependenciesJVM.value)
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.3.0" % Test)
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % Versions.ScalaJavaTime % Test)

lazy val testingJVM = testing.jvm
lazy val testingJS = testing.js
Expand All @@ -209,7 +181,7 @@ lazy val coreTest = crossProject(JSPlatform, JVMPlatform)
"org.typelevel" %%% "discipline-scalatest" % Versions.DisciplineScalatest % Test
)
)
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.3.0" % Test)
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % Versions.ScalaJavaTime % Test)

lazy val coreTestJVM = coreTest.jvm
lazy val coreTestJS = coreTest.js
Expand Down Expand Up @@ -237,7 +209,7 @@ lazy val client = crossProject(JSPlatform, JVMPlatform)
"org.scalatest" %%% "scalatest" % Versions.Scalatest % Test
)
)
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.3.0")
.jsSettings(libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % Versions.ScalaJavaTime)
.jvmSettings(libraryDependencies ++= jvmGeometryDependencies.value)

lazy val clientJVM = client.jvm
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.azavea.stac4s.api.client

import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.refined._
import io.circe.{Decoder, Encoder}

trait ETagCodecs {
implicit def encoderETag[T: Encoder]: Encoder[ETag[T]] = deriveEncoder
implicit def decoderETag[T: Decoder]: Decoder[ETag[T]] = deriveDecoder
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.azavea.stac4s.api.client

import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.refined._
import io.circe.{Decoder, Encoder}

import scala.annotation.unused

trait ETagCodecs {
implicit def encoderETag[T](implicit @unused e: Encoder[T]): Encoder[ETag[T]] = deriveEncoder
implicit def decoderETag[T](implicit @unused d: Decoder[T]): Decoder[ETag[T]] = deriveDecoder
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package com.azavea.stac4s.api.client

import eu.timepit.refined.types.string.NonEmptyString
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.refined._
import io.circe.{Decoder, Encoder}

import scala.annotation.nowarn

case class ETag[T](entity: T, tag: Option[NonEmptyString])

object ETag {
@nowarn implicit def encoderETag[T: Encoder]: Encoder[ETag[T]] = deriveEncoder
@nowarn implicit def decoderETag[T: Decoder]: Decoder[ETag[T]] = deriveDecoder
}
object ETag extends ETagCodecs
Loading

0 comments on commit c9e85e1

Please sign in to comment.