Skip to content

Commit 0bb5fe7

Browse files
authored
Merge pull request #238 from lrytz/ci-release
New scala-module-plugin with sbt-ci-release / travisci / dynver / header
2 parents f47a4a7 + 0bc7846 commit 0bb5fe7

12 files changed

+97
-251
lines changed

.travis.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,21 @@ scala:
66
- 2.13.0
77

88
env:
9-
global:
10-
# PGP_PASSPHRASE
11-
- secure: "SkBtn/6OjEldoikn0MFuyeLT/pau27kwKSDYTVQeJ4BKDzdWLwLE5Q3RukLGttIfNdhOvRoocpQSW9GkZfibTHmwrRnAokucfZCqTsKbwoOp1xIoOh5GrrVrB6gcP7WBTKinqFdBgSvLOrP7GviImz4ZuB9wq1r+mToGG4pDrXc="
12-
# SONA_USER
13-
- secure: "JSv/Er6q1XtTpRH1bpU63YBf7ufwg0vW+Kv/udQBtr8YX/P3gRYC1x6hW4uwftaKMYh7wXDkfNy51SRpH3kUptdJvjPUifVElyPiYlsumetmD+rZJmxX6agx+U5pdjIXPqPoton9MdSVHNTROeTu339bDak0Z+N5ht5wRfjP7F4="
14-
# SONA_PASS
15-
- secure: "OIVtcj7AHZr8Grpf03ZmZsygcADewiYIvSnRwLYCx+5AqOzs39EZ68DsIOxi7wEXVUbVj5RvLXpKzLX3iN+UszLOQRoFPFQyyn+3Y50f8T2aRxdZtInzXn0sCVTj4Hhd/zbKl1W+2Nh3Sqazab7tFoQVzEyYqhcPeiNRMF7h+aY="
16-
matrix:
17-
# The empty SCALAJS_VERSION will only compile for the JVM
18-
- SCALAJS_VERSION= ADOPTOPENJDK=8
19-
- SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8
20-
- SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8
21-
- SCALAJS_VERSION= ADOPTOPENJDK=11
9+
- ADOPTOPENJDK=8 SCALAJS_VERSION=
10+
- ADOPTOPENJDK=8 SCALAJS_VERSION=0.6.28
11+
- ADOPTOPENJDK=8 SCALAJS_VERSION=1.0.0-M8
12+
- ADOPTOPENJDK=11 SCALAJS_VERSION=
2213

2314
matrix:
2415
include:
25-
- env: SCALANATIVE_VERSION=0.3.9 ADOPTOPENJDK=8
26-
- env: SCALANATIVE_VERSION=0.4.0-M2 ADOPTOPENJDK=8
16+
- scala: 2.11.12
17+
env: ADOPTOPENJDK=8 SCALANATIVE_VERSION=0.3.9
18+
- scala: 2.11.12
19+
env: ADOPTOPENJDK=8 SCALANATIVE_VERSION=0.4.0-M2
2720

2821
before_install:
2922
# adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation
30-
- "[[ -d $HOME/.sdkman/bin/ ]] || rm -rf $HOME/.sdkman/"
23+
- "[[ -d $HOME/.sdkman/bin ]] || rm -rf $HOME/.sdkman/"
3124
- curl -sL https://get.sdkman.io | bash
3225
- echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
3326
- source "$HOME/.sdkman/bin/sdkman-init.sh"
@@ -36,21 +29,21 @@ install:
3629
- sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1)
3730
- unset JAVA_HOME
3831
- java -Xmx32m -version
39-
- javac -J-Xmx32m -version
32+
- git fetch --tags # get all tags for sbt-dynver
4033

41-
script: admin/build.sh
34+
script: ./build.sh
4235

4336
notifications:
4437
email:
4538
4639
4740

4841
before_cache:
49-
- find $HOME/.sbt -name "*.lock" | xargs rm
50-
- find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm
42+
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
43+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
44+
- find $HOME/.sbt -name "*.lock" -print -delete
5145
cache:
5246
directories:
5347
- $HOME/.ivy2/cache
54-
- $HOME/.sbt/boot
55-
- $HOME/.sbt/launchers
48+
- $HOME/.sbt
5649
- $HOME/.sdkman

admin/README.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

admin/build.sh

Lines changed: 0 additions & 62 deletions
This file was deleted.

admin/encryptEnvVars.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

admin/genKeyPair.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

admin/gpg.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

admin/publish-settings.sbt

Lines changed: 0 additions & 9 deletions
This file was deleted.

admin/pubring.asc

Lines changed: 0 additions & 18 deletions
This file was deleted.

admin/secring.asc.enc

-1.84 KB
Binary file not shown.

build.sbt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
import ScalaModulePlugin._
21
import sbtcrossproject.CrossPlugin.autoImport.crossProject
32

4-
crossScalaVersions in ThisBuild := List("2.12.9", "2.11.12", "2.13.0")
5-
63
useCoursier in ThisBuild := !scalaVersion.value.startsWith("2.11.") // https://github.com/sbt/sbt/issues/4995
74

8-
lazy val root = project.in(file("."))
9-
.aggregate(`scala-parser-combinatorsJS`, `scala-parser-combinatorsJVM`, `scala-parser-combinatorsNative`)
10-
.settings(disablePublishing)
11-
12-
lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform, NativePlatform)
5+
lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatform)
136
.withoutSuffixFor(JVMPlatform).in(file("."))
14-
.settings(scalaModuleSettings: _*)
15-
.jvmSettings(scalaModuleSettingsJVM)
7+
.settings(ScalaModulePlugin.scalaModuleSettings)
8+
.jvmSettings(ScalaModulePlugin.scalaModuleSettingsJVM)
169
.settings(
1710
name := "scala-parser-combinators",
18-
version := "1.2.0-SNAPSHOT",
19-
mimaPreviousVersion := None,
11+
scalaModuleMimaPreviousVersion := None,
2012

2113
apiMappings += (scalaInstance.value.libraryJar ->
2214
url(s"https://www.scala-lang.org/api/${scalaVersion.value}/")),
@@ -60,7 +52,3 @@ lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform, Nati
6052
else libraryDependencies.value
6153
}
6254
)
63-
64-
lazy val `scala-parser-combinatorsJVM` = `scala-parser-combinators`.jvm
65-
lazy val `scala-parser-combinatorsJS` = `scala-parser-combinators`.js
66-
lazy val `scala-parser-combinatorsNative` = `scala-parser-combinators`.native

build.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Builds of tagged revisions are published to sonatype staging.
6+
7+
# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice.
8+
# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds.
9+
10+
# sbt-dynver sets the version number from the tag
11+
# sbt-travisci sets the Scala version from the travis job matrix
12+
13+
# When a new binary incompatible Scala version becomes available, a previously released version
14+
# can be released using that new Scala version by creating a new tag containing the Scala version
15+
# after a hash, e.g., v1.2.3#2.13.0-M3. In this situation, the first job of the travis job
16+
# matrix builds the release. All other jobs are stopped. Make sure that the first job uses
17+
# the desired JVM version.
18+
19+
# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x
20+
isReleaseJob() {
21+
if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[01234]\..*$ ]]; then
22+
true
23+
else
24+
false
25+
fi
26+
}
27+
28+
# For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases
29+
isTagScalaReleaseJob() {
30+
if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then
31+
true
32+
else
33+
false
34+
fi
35+
}
36+
37+
if [[ "$SCALAJS_VERSION" != "" ]]; then
38+
projectPrefix="parserCombinatorsJS"
39+
elif [[ "$SCALANATIVE_VERSION" != "" ]]; then
40+
projectPrefix="parserCombinatorsNative"
41+
else
42+
projectPrefix="parserCombinators"
43+
fi
44+
45+
verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"
46+
tagPat="^v$verPat(#$verPat)?$"
47+
48+
if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
49+
releaseTask="ci-release"
50+
tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
51+
if [[ "$tagScalaVer" == "" ]]; then
52+
if ! isReleaseJob; then
53+
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
54+
exit 0
55+
fi
56+
else
57+
if isTagScalaReleaseJob; then
58+
setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"'
59+
else
60+
echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix"
61+
exit 0
62+
fi
63+
fi
64+
fi
65+
66+
# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions
67+
export CI_RELEASE="$projectPrefix/publishSigned"
68+
export CI_SNAPSHOT_RELEASE="$projectPrefix/publish"
69+
70+
# default is sonatypeBundleRelease, which closes and releases the staging repo
71+
# see https://github.com/xerial/sbt-sonatype#commands
72+
# for now, until we're confident in the new release scripts, just close the staging repo.
73+
export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"
74+
75+
sbt "$setTagScalaVersion" clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask

0 commit comments

Comments
 (0)