Skip to content

Upgrade CI #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ lazy val root = Project(id = "all", base = file("."))
.notPublished
.aggregate(`pico-hashids`)

crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0", "2.13.2")
crossScalaVersions := Seq("2.11.8", "2.12.0", "2.13.2")

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

credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
Expand Down
66 changes: 49 additions & 17 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,49 @@
dependencies:
cache_directories:
- ~/.sbt/boot

pre:
- scripts/check-env-variables.sh
- scripts/get-credentials.sh

post:
- find ~/.sbt -name "*.lock" | xargs rm
- find ~/.ivy2 -name "ivydata-*.properties" | xargs rm

deployment:
master:
branch: master
commands:
- sbt +publish
version: 2
jobs:
build:
docker:
- image: openjdk:8
environment:
SBT_VERSION: 1.0.4
steps:
- run: echo 'export ARTIFACT_BUILD=$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM.zip' >> $BASH_ENV
- run:
name: Get sbt binary
command: |
apt update && apt install -y curl
curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb
dpkg -i sbt-$SBT_VERSION.deb
rm sbt-$SBT_VERSION.deb
- checkout
- run: scripts/check-env-variables.sh
- run: scripts/get-credentials.sh
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: sbt-cache
- run:
name: Compile
command: |
sbt -batch +test:compile +package
- run:
name: Test
command: |
sbt +test
- run:
name: Coverage
command: |
sbt coverage clean test coverageReport coverageAggregate
mkdir -p target/scala-2.11/coverage-report/
sbt codacyCoverage
bash <(curl -s https://codecov.io/bash)
- store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: target/universal/project.zip
destination: project
- save_cache:
key: sbt-cache
paths:
- "~/.ivy2/cache"
- "~/.sbt"
- "~/.m2"
- "~/.coursier"
# - deploy:
# command: sbt +publish
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ package object impl {
if (i + 1 < numbers.size) {
val num = x % (last.codePointAt(0) + i)
val sepsIndex = (num % seps.length).toInt
(newResult + seps.charAt((num % seps.length).toInt), newAlpha)
(newResult + seps.charAt(sepsIndex), newAlpha)
} else {
(newResult, newAlpha)
}
Expand Down
8 changes: 4 additions & 4 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import sbt._
import Keys._

object Build {
val specs2_core = "org.specs2" %% "specs2-core" % "3.8.8"
val specs2_scalacheck = "org.specs2" %% "specs2-scalacheck" % "3.8.8"
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.13.4"
val specs2_core = "org.specs2" %% "specs2-core" % "4.8.3"
val specs2_scalacheck = "org.specs2" %% "specs2-scalacheck" % "4.8.3"
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.3"

implicit class ProjectOps(self: Project) {
def standard: Project = {
self
.settings(organization := "org.picoworks")
.settings(resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases")
.settings(resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases")
.settings(scalacOptions := Seq("-feature", "-deprecation", "-unchecked", "-Xlint", "-Yrangepos", "-encoding", "utf8"))
.settings(scalacOptions in Test ++= Seq("-Yrangepos"))
}
Expand Down
8 changes: 6 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "3.0.3")
23 changes: 14 additions & 9 deletions scripts/check-env-variables.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
#!/bin/bash

declare -a var_descriptions=(\
"PUBLISH_ACCESS_KEY S3 access key for publishing" \
"PUBLISH_SECRET_KEY S3 secret key for publishing" \
declare -a vars=(\
"AWS_ACCESS_KEY_ID Access key for publishing to S3" \
"AWS_SECRET_ACCESS_KEY Secret key for publishing to S3" \
)

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

test -z "${_not_found}"
[ -z "${_not_found}" ] && exit 0

echo "*****************************"
echo "MISSING ENVIRONMENT VARIABLES"
echo "*****************************"
exit 1