Skip to content

Commit

Permalink
Release/1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyand authored Nov 6, 2019
2 parents 8e27172 + 4a1d3b3 commit 9cad7e2
Show file tree
Hide file tree
Showing 29 changed files with 806 additions and 186 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ scala:
jdk:
- oraclejdk8
script:
- sbt test
- sbt coverage test
deploy:
skip_cleanup: true
provider: script
Expand All @@ -23,3 +23,4 @@ env:
# SONA_PASS
- secure: oDu2dXzektYr/7K5nw7EL2qDUR5AhO4Uz6XGHoOQsN1gJiovdsa5nJeDHgo2YFGpJljyTo+lABbxpGIFQpcnKGIG9eAaXIyYpRlEiksTUnZdwIlCXkRMg2l9cUr30ZDOoVS8QpQbCDdogOSqJ+RUShSuiXR8Qi2e0RfrsVucgkNogQ6w1IoB9kV8CAYsnJVzi/oenTJZjEh5qrKiUALpkiHGjB9WSIHQ80sAO/rwnr88w++HcOIqgnvhJ3/Ig3N6201Slud5pF2yVz4MxzY8bedetqNil5ffosYiU7dladOiKTVj8efZPx0cGq0dhpAZFVhehlXyu4EA24NRgKYvAIc0xWVVm49IBaMpDDI/nh24uF9fBPt2+Apj5BY/ETpKS5tFqFaGkBjlL9KFL3l2DfnWC8AfTHlBXFlkH8tKPSN4so612QAmWuULtrVuQpV8DF40HNwJoR2Lyyy5aHrZtpdjHsp3OJI83QfCxH2yTYhes4eHAxi4ynZDSDolt6mrjx651mmlQCsJWJ5KdWHQwjqzgRP8q1/bCaDYdODhrz0K1JPl6YYA+dzwRP+rFeSQbzG0yGo12p7FZGpq36/Hq9C/HSw6WVDN3Lr8CUxZr1rDhtmAvaMJG5EyYDXpNGn9j2DJX76A1Ifu7KXCp8h+FTLPa1CIxJruNxEA6vFSdqA=
- SONA_USER=snowplow
- ENCRYPTION_LABEL: 15f61f58913b
1 change: 1 addition & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pwd

project_version=$(sbt version -Dsbt.log.noformat=true | perl -ne 'print $1 if /(\d+\.\d+\.\d+[^\r\n]*)/')
if [ "${project_version}" == "${tag_version}" ]; then
./.travis/deploy_docs.sh
sbt +publish
sbt +bintraySyncMavenCentral
else
Expand Down
17 changes: 17 additions & 0 deletions .travis/deploy_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}

git config --global user.name "$USER"
git config --global user.email "$TRAVIS_BUILD_NUMBER@$TRAVIS_COMMIT"

openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in project/travis-deploy-key.enc -out project/travis-deploy-key -d
chmod 600 project/travis-deploy-key

eval "$(ssh-agent -s)"
ssh-add project/travis-deploy-key

sbt ghpagesPushSite
14 changes: 14 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Version 1.0.0 (2019-11-06)
--------------------------
Make parsing errors type-safe (#75)
Add function to create minimal event (#81)
Deprecate run manifest (#86)
Fix empty contexts and unstruct_event decoding bug (#92)
Integrate MiMa (#87)
Integrate scoverage (#90)
Integrate sbt-gh-pages to create GH Pages from Scaladoc (#91)
Remove Vagrant setup (#84)
Add Travis CI secret key (#93)
Add encryption label to .travis.yml (#94)
Extend copyright notice to 2019 (#85)

Version 0.4.2 (2019-08-06)
--------------------------
Bump iglu-core to 0.5.1 (#73)
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Use this SDK with **[Apache Spark][spark]**, **[AWS Lambda][lambda]**, **[Apache

## Documentation

[Setup guide][setup-guide] and [User guide][user-guide] are available at [Snowplow wiki][snowplow-wiki].
[Setup guide][setup-guide] and [User guide][user-guide] are available on the [Snowplow wiki][snowplow-wiki].
The Scaladoc website of the project can be found [here][scala-doc].

## Copyright and license

The Snowplow Scala Analytics SDK is copyright 2016-2017 Snowplow Analytics Ltd.
The Snowplow Scala Analytics SDK is copyright 2016-2019 Snowplow Analytics Ltd.

Licensed under the **[Apache License, Version 2.0][license]** (the "License");
you may not use this software except in compliance with the License.
Expand All @@ -33,12 +34,13 @@ limitations under the License.
[license-image]: http://img.shields.io/badge/license-Apache--2-blue.svg?style=flat
[license]: http://www.apache.org/licenses/LICENSE-2.0

[release-image]: http://img.shields.io/badge/release-0.4.2-blue.svg?style=flat
[release-image]: http://img.shields.io/badge/release-1.0.0-blue.svg?style=flat
[releases]: https://github.com/snowplow/snowplow-scala-analytics-sdk/releases

[setup-guide]: https://github.com/snowplow/snowplow/wiki/Scala-Analytics-SDK-setup
[user-guide]: https://github.com/snowplow/snowplow/wiki/Scala-Analytics-SDK
[snowplow-wiki]: https://github.com/snowplow/snowplow/wiki
[scala-doc]: http://snowplow.github.io/snowplow-scala-analytics-sdk/

[snowplow]: http://snowplowanalytics.com
[enriched-events]: https://github.com/snowplow/snowplow/wiki/canonical-event-model
Expand Down
19 changes: 0 additions & 19 deletions Vagrantfile

This file was deleted.

8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ lazy val root = project.in(file("."))
.settings(Seq[Setting[_]](
name := "snowplow-scala-analytics-sdk",
organization := "com.snowplowanalytics",
version := "0.4.2",
version := "1.0.0",
description := "Scala analytics SDK for Snowplow",
scalaVersion := "2.12.8",
crossScalaVersions := Seq("2.11.12", "2.12.8")
))
.enablePlugins(SiteScaladocPlugin)
.enablePlugins(GhpagesPlugin)
.enablePlugins(PreprocessPlugin)
.settings(BuildSettings.buildSettings)
.settings(BuildSettings.publishSettings)
.settings(BuildSettings.mimaSettings)
.settings(BuildSettings.scoverageSettings)
.settings(BuildSettings.ghPagesSettings)
.settings(Seq(
shellPrompt := { _ => name.value + " > " }
))
Expand Down
51 changes: 50 additions & 1 deletion project/BuildSettings.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
* Copyright (c) 2016-2019 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
Expand All @@ -19,6 +19,19 @@ import Keys._
import bintray.BintrayPlugin._
import bintray.BintrayKeys._

// Mima plugin
import com.typesafe.tools.mima.plugin.MimaKeys._
import com.typesafe.tools.mima.plugin.MimaPlugin

// Scoverage plugin
import scoverage.ScoverageKeys._

import com.typesafe.sbt.sbtghpages.GhpagesPlugin.autoImport._
import com.typesafe.sbt.site.SitePlugin.autoImport._
import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._
import com.typesafe.sbt.SbtGit.GitKeys.{gitBranch, gitRemoteRepo}
import com.typesafe.sbt.site.preprocess.PreprocessPlugin.autoImport._

object BuildSettings {

// Basic settings for our app
Expand Down Expand Up @@ -59,4 +72,40 @@ object BuildSettings {
</developer>
</developers>)
)

// If new version introduces breaking changes,
// clear-out mimaBinaryIssueFilters and mimaPreviousVersions.
// Otherwise, add previous version to set without
// removing other versions.
val mimaPreviousVersions = Set()

val mimaSettings = MimaPlugin.mimaDefaultSettings ++ Seq(
mimaPreviousArtifacts := mimaPreviousVersions.map { organization.value %% name.value % _ },
mimaBinaryIssueFilters ++= Seq(),
test in Test := {
mimaReportBinaryIssues.value
(test in Test).value
}
)

val scoverageSettings = Seq(
coverageMinimum := 50,
coverageFailOnMinimum := true,
coverageHighlighting := false,
(test in Test) := {
(coverageReport dependsOn (test in Test)).value
}
)

val ghPagesSettings = Seq(
ghpagesPushSite := (ghpagesPushSite dependsOn makeSite).value,
ghpagesNoJekyll := false,
gitRemoteRepo := "[email protected]:snowplow/snowplow-scala-analytics-sdk.git",
gitBranch := Some("gh-pages"),
siteSubdirName in SiteScaladoc := s"${version.value}",
preprocessVars in Preprocess := Map("VERSION" -> version.value),
excludeFilter in ghpagesCleanSite := new FileFilter {
def accept(f: File) = true
}
)
}
5 changes: 5 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.3")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.5.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
Binary file added project/travis-deploy-key.enc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,18 @@ object Event {
*/
def parse(line: String): DecodeResult[Event] =
parser.parse(line)
}

/**
* Creates an event with only required fields.
* All optional fields are set to [[None]].
*/
def minimal(id: UUID, collectorTstamp: Instant, vCollector: String, vEtl: String): Event =
Event(None, None, None, collectorTstamp, None, None, id, None, None, None, vCollector, vEtl, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
Contexts(Nil), None, None, None, None, None, UnstructEvent(None), None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
Contexts(Nil), None, None, None, None, None, None, None, None)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Copyright (c) 2016-2019 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
package com.snowplowanalytics.snowplow.analytics.scalasdk

import cats.data.NonEmptyList
import cats.syntax.either._
import io.circe._
import io.circe.syntax._
import com.snowplowanalytics.snowplow.analytics.scalasdk.decode.Key
import com.snowplowanalytics.snowplow.analytics.scalasdk.decode.Key._

/**
* Represents an error raised when parsing a TSV line.
*/
sealed trait ParsingError extends Product with Serializable

object ParsingError {

/**
* Represents an error indicating a non-TSV line.
*/
final case object NotTSV extends ParsingError

/**
* Represents an error indicating the number of actual fields is not equal
* to the number of expected fields.
* @param fieldCount The number of fields in the TSV line.
*/
final case class FieldNumberMismatch(fieldCount: Int) extends ParsingError

/**
* Represents an error raised when trying to decode the values in a line.
* @param errors A non-empty list of errors encountered when trying to decode the values.
*/
final case class RowDecodingError(errors: NonEmptyList[RowDecodingErrorInfo]) extends ParsingError

/**
* Contains information about the reasons behind errors raised when trying to decode the values in a line.
*/
sealed trait RowDecodingErrorInfo extends Product with Serializable

object RowDecodingErrorInfo {
/**
* Represents cases where tha value in a field is not valid,
* e.g. an invalid timestamp, an invalid UUID, etc.
* @param key The name of the field.
* @param value The value of field.
* @param message The error message.
*/
final case class InvalidValue(key: Key, value: String, message: String) extends RowDecodingErrorInfo

/**
* Represents unhandled errors raised when trying to decode a line.
* For example, while parsing a list of tuples to [[HList]] in
* [[RowDecoder]], type checking should make it impossible to get more or less values
* than expected.
* @param message The error message.
*/
final case class UnhandledRowDecodingError(message: String) extends RowDecodingErrorInfo

implicit val analyticsSdkRowDecodingErrorInfoCirceEncoder: Encoder[RowDecodingErrorInfo] =
Encoder.instance {
case InvalidValue(key, value, message) =>
Json.obj(
"type" := "InvalidValue",
"key" := key,
"value" := value,
"message" := message
)
case UnhandledRowDecodingError(message: String) =>
Json.obj(
"type" := "UnhandledRowDecodingError",
"message" := message
)
}

implicit val analyticsSdkRowDecodingErrorInfoCirceDecoder: Decoder[RowDecodingErrorInfo] =
Decoder.instance { cursor =>
for {
errorType <- cursor.downField("type").as[String]
result <- errorType match {
case "InvalidValue" =>
for {
key <- cursor.downField("key").as[Key]
value <- cursor.downField("value").as[String]
message <- cursor.downField("message").as[String]
} yield InvalidValue(key, value, message)

case "UnhandledRowDecodingError" =>
cursor
.downField("message")
.as[String]
.map(UnhandledRowDecodingError)
}
} yield result
}
}

implicit val analyticsSdkParsingErrorCirceEncoder: Encoder[ParsingError] =
Encoder.instance {
case NotTSV =>
Json.obj("type" := "NotTSV")
case FieldNumberMismatch(fieldCount) =>
Json.obj(
"type" := "FieldNumberMismatch",
"fieldCount" := fieldCount
)
case RowDecodingError(errors) =>
Json.obj(
"type" := "RowDecodingError",
"errors" := errors.asJson
)
}

implicit val analyticsSdkParsingErrorCirceDecoder: Decoder[ParsingError] =
Decoder.instance { cursor =>
for {
error <- cursor.downField("type").as[String]
result <- error match {
case "NotTSV" =>
NotTSV.asRight
case "FieldNumberMismatch" =>
cursor
.downField("fieldCount")
.as[Int]
.map(FieldNumberMismatch)
case "RowDecodingError" =>
cursor
.downField("errors")
.as[NonEmptyList[RowDecodingErrorInfo]]
.map(RowDecodingError)
case _ =>
DecodingFailure(
s"Error type $error is not an Analytics SDK Parsing Error.",
cursor.history).asLeft
}
} yield result
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
* Copyright (c) 2016-2019 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
Expand Down Expand Up @@ -32,6 +32,7 @@ import com.amazonaws.services.s3.model.{ ListObjectsV2Request, ListObjectsV2Resu
* @param dynamodb AWS DynamoDB client
* @param tableName existing DynamoDB table name with run manifests
*/
@deprecated("In favor of https://github.com/snowplow-incubator/snowplow-processing-manifest/", "snowplow-scala-analytics-sdk 1.0.0")
class RunManifests(dynamodb: AmazonDynamoDB, tableName: String) {
/**
* Creates DynamoDB table with all necessary settings
Expand Down Expand Up @@ -62,6 +63,7 @@ class RunManifests(dynamodb: AmazonDynamoDB, tableName: String) {
/**
* Module with primary run-manifests functions, without applied client
*/
@deprecated("In favor of https://github.com/snowplow-incubator/snowplow-processing-manifest/", "snowplow-scala-analytics-sdk 1.0.0")
object RunManifests {

/**
Expand Down
Loading

0 comments on commit 9cad7e2

Please sign in to comment.