Skip to content

Commit

Permalink
Merge pull request #535 from permutive-engineering/update/all
Browse files Browse the repository at this point in the history
Dependency Updates
  • Loading branch information
alejandrohdezma committed Apr 17, 2024
2 parents b3728b3 + 366a099 commit 95d6bc1
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 133 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 2.7.5
9b933a36e7a7c0363fcbb315cae9ec275b126f1b
136 changes: 58 additions & 78 deletions .github/workflows/ci.yml
Expand Up @@ -15,86 +15,72 @@ 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 }}


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

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10, 2.12.17, 3.2.0]
scala: [2.13, 2.12, 3]
java: [temurin@11]
project: [rootJVM]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

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

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

- 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') }}
- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

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

- name: Check headers and formatting
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p fs2-google-pubsub-grpc/target target .js/target fs2-google-pubsub/target .jvm/target .native/target fs2-google-pubsub-http/target project/target
run: mkdir -p fs2-google-pubsub-grpc/target fs2-google-pubsub/target fs2-google-pubsub-http/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 fs2-google-pubsub-grpc/target target .js/target fs2-google-pubsub/target .jvm/target .native/target fs2-google-pubsub-http/target project/target
run: tar cf targets.tar fs2-google-pubsub-grpc/target fs2-google-pubsub/target fs2-google-pubsub-http/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
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar
Expand All @@ -106,83 +92,77 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}
- name: sbt update
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
run: sbt +update

- 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') }}

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

- name: Inflate target directories (2.13.10, rootJVM)
- name: Inflate target directories (2.13, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.17, rootJVM)
uses: actions/download-artifact@v2
- name: Download target directories (2.12, rootJVM)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM

- name: Inflate target directories (2.12.17, rootJVM)
- name: Inflate target directories (2.12, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.2.0, rootJVM)
uses: actions/download-artifact@v2
- name: Download target directories (3, rootJVM)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.0-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM

- name: Inflate target directories (3.2.0, rootJVM)
- name: Inflate target directories (3, rootJVM)
run: |
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
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: echo $PGP_SECRET | base64 -d -i - | 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_SECRET" | base64 -d -i - > /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
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
run: sbt tlCiRelease
2 changes: 1 addition & 1 deletion .scalafmt.conf
@@ -1,4 +1,4 @@
version = 2.7.1
version = 2.7.5

align.preset = more
assumeStandardLibraryStripMargin = true
Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Expand Up @@ -14,11 +14,12 @@ ThisBuild / startYear := Some(2018)

ThisBuild / tlSonatypeUseLegacyHost := true

val Scala213 = "2.13.10"
ThisBuild / crossScalaVersions := Seq(Scala213, "2.12.17", "3.2.0")
val Scala213 = "2.13.13"
ThisBuild / crossScalaVersions := Seq(Scala213, "2.12.19", "3.3.1")
ThisBuild / scalaVersion := Scala213 // the default Scala
ThisBuild / tlJdkRelease := Some(11)
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
ThisBuild / tlCiDependencyGraphJob := false

lazy val root = tlCrossRootProject
.aggregate(common, http, grpc)
Expand Down
Expand Up @@ -30,17 +30,15 @@ import scala.util.control.NoStackTrace

object PubsubGoogleConsumer {

/**
* Indicates the underlying Java PubSub consumer has failed.
/** Indicates the underlying Java PubSub consumer has failed.
*
* @param cause the cause of the failure
*/
case class InternalPubSubError(cause: Throwable)
extends Throwable("Internal Java PubSub consumer failed", cause)
with NoStackTrace

/**
* Subscribe with manual acknowledgement
/** Subscribe with manual acknowledgement
*
* The stream fails with an [[InternalPubSubError]] if the underlying Java consumer fails.
*
Expand Down Expand Up @@ -71,8 +69,7 @@ object PubsubGoogleConsumer {
),
)

/**
* Subscribe with automatic acknowledgement
/** Subscribe with automatic acknowledgement
*
* The stream fails with an [[InternalPubSubError]] if the underlying Java consumer fails.
*
Expand All @@ -94,8 +91,7 @@ object PubsubGoogleConsumer {
onDecode = (record, value) => record.ack.as(value),
)

/**
* Subscribe to the raw stream, receiving the the message as retrieved from PubSub
/** Subscribe to the raw stream, receiving the the message as retrieved from PubSub
*
* The stream fails with an [[InternalPubSubError]] if the underlying Java consumer fails.
*/
Expand Down
Expand Up @@ -20,8 +20,7 @@ import com.google.cloud.pubsub.v1.Subscriber

import scala.concurrent.duration._

/**
* Pubsub subscriber config.
/** Pubsub subscriber config.
*
* @param maxQueueSize configures two options: the max size of the backing queue, and, the "max outstanding element count" option of Pubsub
* @param parallelPullCount number of parallel pullers, see [[https://javadoc.io/static/com.google.cloud/google-cloud-pubsub/1.100.0/com/google/cloud/pubsub/v1/Subscriber.Builder.html#setParallelPullCount-int-]]
Expand Down
Expand Up @@ -159,7 +159,7 @@ private[consumer] class Wrapper[A](val underlying: Builder[A, Vector[A]]) extend

override def clear(): Unit = ???

def toChunk: Chunk[A] = Chunk.vector(underlying.result())
def toChunk: Chunk[A] = Chunk.from(underlying.result())

}

Expand Down
Expand Up @@ -35,8 +35,7 @@ import scala.concurrent.duration._

object PubsubHttpConsumer {

/**
* Subscribe with manual acknowledgement
/** Subscribe with manual acknowledgement
*
* @param projectId google cloud project id
* @param subscription name of the subscription
Expand Down Expand Up @@ -69,8 +68,7 @@ object PubsubHttpConsumer {
onDecode = (record, value) => Applicative[F].pure(record.toConsumerRecord(value)),
)

/**
* Subscribe with automatic acknowledgement
/** Subscribe with automatic acknowledgement
*
* @param projectId google cloud project id
* @param subscription name of the subscription
Expand Down Expand Up @@ -103,8 +101,7 @@ object PubsubHttpConsumer {
onDecode = (record, value) => record.ack.as(value),
)

/**
* Subscribe to the raw stream, receiving the the message as retrieved from PubSub
/** Subscribe to the raw stream, receiving the the message as retrieved from PubSub
*
* @param projectId google cloud project id
* @param subscription name of the subscription
Expand Down
Expand Up @@ -18,8 +18,7 @@ package com.permutive.pubsub.consumer.http

import scala.concurrent.duration._

/**
* Configuration for the PubSub HTTP consumer.
/** Configuration for the PubSub HTTP consumer.
*
* Note: It is up to the user to raise exceptions and terminate the lifecyle of services if this is desired when
* retries are exhausted. Token refreshing runs on a background fiber so raising exceptions in
Expand Down
Expand Up @@ -27,8 +27,7 @@ trait PubsubReader[F[_]] {

def nack(ackId: List[AckId]): F[Unit]

/**
* The new ack deadline with respect to the time this request was sent to the Pub/Sub system.
/** The new ack deadline with respect to the time this request was sent to the Pub/Sub system.
* For example, if the value is 10, the new ack deadline will expire 10 seconds after
* the subscriptions.modifyAckDeadline call was made. Specifying zero might immediately make the message
* available for delivery to another subscriber client. This typically results in an increase in the rate of
Expand Down
Expand Up @@ -24,8 +24,7 @@ import scala.concurrent.duration.FiniteDuration

object CachedTokenProvider {

/**
* Generate a cached token provider from an underlying provider.
/** Generate a cached token provider from an underlying provider.
*
* @param underlying the underlying token provider to use when a new token is required
* @param safetyPeriod how much time less than the indicated expiry to cache a token for; this is to give a
Expand Down
Expand Up @@ -22,8 +22,7 @@ import scala.concurrent.duration.FiniteDuration

trait OAuth[F[_]] {

/**
* Based on https://developers.google.com/identity/protocols/OAuth2ServiceAccount
/** Based on https://developers.google.com/identity/protocols/OAuth2ServiceAccount
* @param iss The email address of the service account.
* @param scope A space-delimited list of the permissions that the application requests.
* @param exp The expiration time of the assertion, specified as milliseconds since 00:00:00 UTC, January 1, 1970.
Expand Down
Expand Up @@ -25,8 +25,7 @@ import scala.concurrent.duration.FiniteDuration

object RefCache {

/**
* Caches a single instance of type `A` for a period of time before refreshing it automatically.
/** Caches a single instance of type `A` for a period of time before refreshing it automatically.
*
* The time between refreshes is dynamic and based on the value of each `A` itself. This is similar to
* [[RefreshableEffect]] except that only exposes a fixed refresh frequency.
Expand Down

0 comments on commit 95d6bc1

Please sign in to comment.