Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from meetup/MUP-17325_Update_build_config
Browse files Browse the repository at this point in the history
MUP-17325 update build config
  • Loading branch information
mkleymenov committed Nov 29, 2017
2 parents 6c08810 + dcd0961 commit 397bb4d
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
realm = Bintray API Realm
host = api.bintray.com
user = {{ BINTRAY_USER }}
password = {{ BINTRAY_SECRET }}
67 changes: 56 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,59 @@
sudo: false
sudo: required
language: bash

# exclude tags.
branches:
except:
- /^v\d+.\d+.\d+$/

services:
- docker

cache:
directories:
- "$HOME/.ivy2"
- "$HOME/.sbt"

env:
global:
- CI_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER
- CLOUDSDK_CORE_DISABLE_PROMPTS=1

before_script:
- "echo $JAVA_OPTS"
- "export JAVA_OPTS='-Xmx512m -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M'"
language: scala
scala:
- 2.10.5
- 2.11.7
jdk:
- openjdk6
cache:
directories:
- $HOME/.ivy2
- $HOME/.sbt

before_install:

# Install envtpl for easy templating.
- sudo pip install envtpl

- mkdir "$HOME/.bintray"
- envtpl < .credentials > "$HOME/.bintray/.credentials"

# Use SNAPSHOT for all other than master builds.
- export CI_BUILD_NUMBER=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then echo $CI_BUILD_NUMBER; else echo "${TRAVIS_BUILD_NUMBER}-SNAPSHOT"; fi)
- echo "CI_BUILD_NUMBER=${CI_BUILD_NUMBER}"

script:
- >
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
make publish;
else
make package;
fi
after_success:
- >
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then
eval "$(ssh-agent)";
echo "$GITHUB_DEPLOY_KEY" > /tmp/github_deploy_key;
chmod 600 /tmp/github_deploy_key;
ssh-add /tmp/github_deploy_key;
git config --global user.email "builds@travis-ci.org";
git config --global user.name "Travis CI";
export GIT_TAG=v$(make version);
echo "GIT_TAG=$GIT_TAG";
git tag $GIT_TAG -f -a -m "Version $GIT_TAG built by Travis CI - https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID";
git push -q git@github.com:$TRAVIS_REPO_SLUG.git --tags;
fi
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Meetup, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
PROJECT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TARGET_DIR=$(PROJECT_DIR)target

CI_BUILD_NUMBER ?= $(USER)-SNAPSHOT
CI_IVY_CACHE ?= $(HOME)/.ivy2
CI_SBT_CACHE ?= $(HOME)/.sbt
CI_WORKDIR ?= $(shell pwd)

TARGET ?= __package-sbt

VERSION ?= 0.1.$(CI_BUILD_NUMBER)

BUILDER_TAG = "meetup/sbt-builder:0.1.5"

package: __contained-target ## Packages jar artifact.

publish: __set-publish __contained-target ## Publishes jar artifact.

version: ## Prints artifact version.
@echo $(VERSION)

__clean: # Cleans sbt artifacts
@sbt clean
rm -rf $(TARGET_DIR)

__package-sbt:
sbt clean \
"set coverageEnabled := true" \
"set coverageOutputHTML := false" \
test \
coverageReport \
coverallsMaybe \
coverageOff \
publishLocal \
component:test

__publish-sbt: __package-sbt
sbt publish cleanLocal

__set-publish:
$(eval TARGET=__publish-sbt)

__contained-target:
docker run \
--rm \
-v $(CI_WORKDIR):/data \
-v $(CI_IVY_CACHE):/root/.ivy2 \
-v $(CI_SBT_CACHE):/root/.sbt \
-v $(HOME)/.bintray:/root/.bintray \
-e CI_BUILD_NUMBER=$(CI_BUILD_NUMBER) \
-e TRAVIS_JOB_ID=$(TRAVIS_JOB_ID) \
-e TRAVIS_PULL_REQUEST=$(TRAVIS_PULL_REQUEST) \
$(BUILDER_TAG) \
make $(TARGET)
36 changes: 15 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
enablePlugins(CommonSettingsPlugin)
enablePlugins(CoverallsWrapper)

// Preserve the author's coding style
includeFilter in scalariformFormat := NothingFilter

organization := "me.lessis"

name := "prints"

version := "0.1.2"

description := "jwt interface for scala"

homepage := Some(url(s"https://github.com/softprops/${name.value}"))

crossScalaVersions := Seq("2.10.5", "2.11.7")

scalaVersion := crossScalaVersions.value.last
homepage := Some(url(s"https://github.com/meetup/${name.value}"))

resolvers += "softprops-maven" at "http://dl.bintray.com/content/softprops/maven"

libraryDependencies ++= Seq(
"me.lessis" %% "base64" % "0.2.0",
"org.json4s" %% "json4s-native" % "3.5.3",
"org.scalatest" %% "scalatest" % "2.2.1" % "test"
"org.json4s" %% "json4s-native" % "3.5.3"
)

licenses := Seq(
("MIT", url(s"https://github.com/softprops/${name.value}/blob/${version.value}/LICENSE")))

seq(bintraySettings:_*)
bintrayOrganization in ThisBuild := Some("meetup")
bintrayPackageLabels in ThisBuild := Seq("jwt")

bintray.Keys.packageLabels in bintray.Keys.bintray := Seq("jwt")

pomExtra := (
pomExtra :=
<scm>
<url>git@github.com:softprops/{name.value}.git</url>
<connection>scm:git:git@github.com:softprops/{name.value}.git</connection>
<url>git@github.com:meetup/{name.value}.git</url>
<connection>scm:git:git@github.com:meetup/{name.value}.git</connection>
</scm>
<developers>
<developer>
<id>softprops</id>
<id>meetup</id>
<name>Doug Tangren</name>
<url>https://github.com/softprops</url>
<url>https://github.com/meetup</url>
</developer>
</developers>
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.8
sbt.version=0.13.13
14 changes: 12 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
//addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.1-SNAPSHOT")
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.2.0")
resolvers += Resolver.url(
"meetup-sbt-plugins",
new java.net.URL("https://dl.bintray.com/meetup/sbt-plugins/")
)(Resolver.ivyStylePatterns)

addSbtPlugin("com.meetup" % "sbt-plugins" % "0.3.33")

addSbtPlugin("com.eed3si9n" % "sbt-dirty-money" % "0.1.0")

addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0")
3 changes: 1 addition & 2 deletions src/main/scala/JWT.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package prints

import java.util.Arrays
import scala.concurrent.duration._

object JWT {
Expand Down Expand Up @@ -76,7 +75,7 @@ object JWT {
if (!verified) Left(Err.SignatureInvalid)
else if (!exp) Left(Err.Expired)
else if (!nbf) Left(Err.TooEarly)
else Right(header, claims, sig)
else Right((header, claims, sig))
}
}

Expand Down

0 comments on commit 397bb4d

Please sign in to comment.