Skip to content

Commit 4f55c06

Browse files
authored
Merge pull request #6 from pico-works/upgrade-ci
Upgrade CI
2 parents 41dd019 + ad9a3d1 commit 4f55c06

File tree

6 files changed

+76
-35
lines changed

6 files changed

+76
-35
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ lazy val root = Project(id = "all", base = file("."))
1515
.notPublished
1616
.aggregate(`pico-hashids`)
1717

18-
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0", "2.13.2")
18+
crossScalaVersions := Seq("2.11.8", "2.12.0", "2.13.2")
1919

20-
version in ThisBuild := Process("./version.sh").lines.head.trim
20+
version in ThisBuild := Process("./version.sh").lineStream.head.trim
2121

2222
credentials += Credentials("Sonatype Nexus Repository Manager",
2323
"oss.sonatype.org",

circle.yml

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,49 @@
1-
dependencies:
2-
cache_directories:
3-
- ~/.sbt/boot
4-
5-
pre:
6-
- scripts/check-env-variables.sh
7-
- scripts/get-credentials.sh
8-
9-
post:
10-
- find ~/.sbt -name "*.lock" | xargs rm
11-
- find ~/.ivy2 -name "ivydata-*.properties" | xargs rm
12-
13-
deployment:
14-
master:
15-
branch: master
16-
commands:
17-
- sbt +publish
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: openjdk:8
6+
environment:
7+
SBT_VERSION: 1.0.4
8+
steps:
9+
- run: echo 'export ARTIFACT_BUILD=$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM.zip' >> $BASH_ENV
10+
- run:
11+
name: Get sbt binary
12+
command: |
13+
apt update && apt install -y curl
14+
curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb
15+
dpkg -i sbt-$SBT_VERSION.deb
16+
rm sbt-$SBT_VERSION.deb
17+
- checkout
18+
- run: scripts/check-env-variables.sh
19+
- run: scripts/get-credentials.sh
20+
- restore_cache:
21+
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
22+
key: sbt-cache
23+
- run:
24+
name: Compile
25+
command: |
26+
sbt -batch +test:compile +package
27+
- run:
28+
name: Test
29+
command: |
30+
sbt +test
31+
- run:
32+
name: Coverage
33+
command: |
34+
sbt coverage clean test coverageReport coverageAggregate
35+
mkdir -p target/scala-2.11/coverage-report/
36+
sbt codacyCoverage
37+
bash <(curl -s https://codecov.io/bash)
38+
- store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
39+
path: target/universal/project.zip
40+
destination: project
41+
- save_cache:
42+
key: sbt-cache
43+
paths:
44+
- "~/.ivy2/cache"
45+
- "~/.sbt"
46+
- "~/.m2"
47+
- "~/.coursier"
48+
# - deploy:
49+
# command: sbt +publish

pico-hashids/src/main/scala/org/pico/hashids/impl/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ package object impl {
6767
if (i + 1 < numbers.size) {
6868
val num = x % (last.codePointAt(0) + i)
6969
val sepsIndex = (num % seps.length).toInt
70-
(newResult + seps.charAt((num % seps.length).toInt), newAlpha)
70+
(newResult + seps.charAt(sepsIndex), newAlpha)
7171
} else {
7272
(newResult, newAlpha)
7373
}

project/Build.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import sbt._
22
import Keys._
33

44
object Build {
5-
val specs2_core = "org.specs2" %% "specs2-core" % "3.8.8"
6-
val specs2_scalacheck = "org.specs2" %% "specs2-scalacheck" % "3.8.8"
7-
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.13.4"
5+
val specs2_core = "org.specs2" %% "specs2-core" % "4.8.3"
6+
val specs2_scalacheck = "org.specs2" %% "specs2-scalacheck" % "4.8.3"
7+
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.3"
88

99
implicit class ProjectOps(self: Project) {
1010
def standard: Project = {
1111
self
1212
.settings(organization := "org.picoworks")
13-
.settings(resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases")
13+
.settings(resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases")
1414
.settings(scalacOptions := Seq("-feature", "-deprecation", "-unchecked", "-Xlint", "-Yrangepos", "-encoding", "utf8"))
1515
.settings(scalacOptions in Test ++= Seq("-Yrangepos"))
1616
}

project/plugins.sbt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.2")
2-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
1+
resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/"
2+
3+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.2")
4+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
5+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
6+
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "3.0.3")

scripts/check-env-variables.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
#!/bin/bash
22

3-
declare -a var_descriptions=(\
4-
"PUBLISH_ACCESS_KEY S3 access key for publishing" \
5-
"PUBLISH_SECRET_KEY S3 secret key for publishing" \
3+
declare -a vars=(\
4+
"AWS_ACCESS_KEY_ID Access key for publishing to S3" \
5+
"AWS_SECRET_ACCESS_KEY Secret key for publishing to S3" \
66
)
77

8-
for var_description in "${var_descriptions[@]}"; do
9-
var_name="${var_description%% *}"
10-
if [ "${!var_name-x}" = "x" -a "${!var_name-y}" = "y" ]; then
11-
echo -e "\x1B[31mError: Variable not defined: $var_description\x1B[0m"
8+
for var in "${vars[@]}"; do
9+
v=${var%% *}
10+
if [ "${!v-x}" = "x" -a "${!v-y}" = "y" ]; then
11+
printf 'NOT FOUND: $%s\n' "$var"
1212
_not_found=true
1313
else
14-
echo -e "\x1B[32mVariable defined: $var_description\x1B[0m"
14+
printf 'found: $%s\n' "$v"
1515
fi
1616
done
1717

18-
test -z "${_not_found}"
18+
[ -z "${_not_found}" ] && exit 0
19+
20+
echo "*****************************"
21+
echo "MISSING ENVIRONMENT VARIABLES"
22+
echo "*****************************"
23+
exit 1

0 commit comments

Comments
 (0)