diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f28e0cfea --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,15 @@ +name: test +on: + push: +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + - uses: sbt/setup-sbt@v1 + - name: Test + run: sbt test publishLocal diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml new file mode 100644 index 000000000..3549dedc2 --- /dev/null +++ b/.github/workflows/cla.yml @@ -0,0 +1,11 @@ +name: "Check Scala CLA" +on: + pull_request: +jobs: + cla-check: + runs-on: ubuntu-latest + steps: + - name: Verify CLA + uses: scala/cla-checker@v1 + with: + author: ${{ github.event.pull_request.user.login }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..1e5360b8a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Release +on: + push: + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + - uses: sbt/setup-sbt@v1 + - run: sbt versionCheck ci-release + env: + PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} + PGP_SECRET: ${{secrets.PGP_SECRET}} + SONATYPE_PASSWORD: ${{secrets.SONATYPE_PASSWORD}} + SONATYPE_USERNAME: ${{secrets.SONATYPE_USERNAME}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index da13dbfe3..000000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: ~> 1.0 # needed for imports - -import: scala/scala-dev:travis/default.yml - -language: scala - -scala: 2.12.7 - -env: - global: - - ADOPTOPENJDK=8 - # PGP_PASSPHRASE - - secure: "HdhgvdpbCivSOQMKbjVCZKtlDnhJ4hGcIDQlUDop52gmXhLEkMQB97F1UO79VQiP1co0vRi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WL0MRT20cOKi7pUZnZ44L1uSjIrzjWVXv3qI64Ne/4gtoZTDPUTQ0LR+snGqqDTTbw5utSqEXwoq6+/V/F0CuwzPXrrOYOFqvCMhbznGGrrIJLvn6BQJK7Ydd/lQ8KaUOite9ocfIY+eZNBqn6FAZCvasjWLwMjQWordTUMqsbY0/fyR4zPhUwUSFJZ8hiR1ssh9pzwB/RNVCAQSUSP4YoFvWiMLPe0dJp0=" - # SONA_PASS - - secure: "bM/vkl6piSxf9ZGnII7AuNmEEmTuAiKUx99B000g8uou52SzXnHjaiJgJNCX2RporyWVVm/4VZDfbgx//rWLBsOBMisd1JeuruT6Ar/g0bpcQrdWafmlwSWLbb4+PggRk4f8MvoFldXnHZK4oqbo+8lWzGWdUSYOf9Or+wYWMP+eBeHnXkix6Nuexwqnh9fl/MMoJN19WdqD5C9ZHWKi1UzSUG2TI5MdlCxrTY8Ge+2lTZAPqWYCSirwWYGcQbHEpy2r477p/d3z9NpzM2t3p69jplNTocdrI8B2/P2Xs6FDwWTed3yRp3Bo3OasW5Trv4RsQO64vg6vNvPvhWoiE82CGZFDpyJUYPv4XVJz6i1CJPN1GRgchoHY5vxfogXtDPyYbwe+fpLNHTAhTnV5mMZ8HrkId+pfyY4ldtrtNTIsMvOSixGvmpLEepGLbmh1QcRQkzmW+wXy6+cyIPaTsFIj10FLId9HtB+ImpfadyrDbRKk5w18xp0+i5xFzG0Ov5vImB0omVg3jifH1IVL91LSRlvIQx952Kh0MfDlgIpgFN3eGuc58K0A/fgm8v9uHQBYxOE31mVT2J0zoVsrt5jJGA4tGBeexh+ftDXZy7g7qkuihTAUtLEqV6LgNSBpBK+dFNmnmqnlH/QBi1HFOJbBTOQ2YUwHKBuXzNdAK9U=" - -script: admin/build.sh - -notifications: - email: lukas.rytz@lightbend.com diff --git a/admin/README.md b/admin/README.md deleted file mode 100644 index 3e9d1bfa2..000000000 --- a/admin/README.md +++ /dev/null @@ -1,69 +0,0 @@ -## Tag Driven Releasing - -### Initial setup for the repository - -To configure tag driven releases from Travis CI. - - 1. Generate a key pair for this repository with `./admin/genKeyPair.sh`. - Edit `.travis.yml` and `admin/build.sh` as prompted. - 1. Publish the public key to https://pgp.mit.edu - 1. Store other secrets as encrypted environment variables with `./admin/encryptEnvVars.sh`. - Edit `.travis.yml` as prompted. - 1. Edit `.travis.yml` to use `./admin/build.sh` as the build script, - and edit that script to use the tasks required for this project. - Ensure that `RELEASE_COMBO` is `true` for build matrix combinations - that should be released to sonatype (when building a tag). - -It is important to add comments in `.travis.yml` to identify the name -of each environment variable encoded in a `secure` section. - -After these steps, your `.travis.yml` should contain config of the form: - -``` -language: scala - -jdk: - - openjdk6 - - oraclejdk8 - -scala: - - 2.11.12 - - 2.12.6 - -env: - global: - # PGP_PASSPHRASE - - secure: "XXXXXX" - # SONA_USER - - secure: "XXXXXX" - # SONA_PASS - - secure: "XXXXXX" - -script: admin/build.sh - -notifications: - email: - - a@b.com -``` - -If Sonatype credentials change in the future, step 3 can be repeated -without generating a new key. - -### Testing - - 1. Follow the release process below to create a dummy release (e.g., `v0.1.0-TEST1`). - Confirm that the release was staged to Sonatype but do not release it to Maven - central. Instead, drop the staging repository. - -### Performing a release - - 1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub - web interface. - 1. The release will be published using the Scala and JVM version combinations specified - in the travis build matrix where `[ "$RELEASE_COMBO" = "true" ]`. - - If you need to release against a different Scala version, create a new commit that modifies - `.travis.yml` and push a new tag, e.g., `v1.2.3#2.13.0-M5`. The suffix after `#` is ignored. - 1. Travis CI will schedule a build for this release. Review the build logs. - 1. Log into https://oss.sonatype.org/ and identify the staging repository. - 1. Sanity check its contents. - 1. Release staging repository to Maven and send out release announcement. diff --git a/admin/build.sh b/admin/build.sh deleted file mode 100755 index 0c01285a2..000000000 --- a/admin/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -# Builds of tagged revisions are published to sonatype staging. - -# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. -# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. -# Checking the local git clone would not work because git on travis does not fetch tags. - -# The version number to be published is extracted from the tag, e.g., v1.2.3 publishes -# version 1.2.3 on all combinations of the travis matrix where `[ "$RELEASE_COMBO" = "true" ]`. - -# In order to build a previously released version against a new (binary incompatible) Scala release, -# a new commit that modifies (and prunes) the Scala versions in .travis.yml needs to be added on top -# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`. -# Everything after the `#` in the tag name is ignored. - -RELEASE_COMBO=true - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#.*)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//) - publishVersion='set every version := "'$tagVer'"' - if [ "$RELEASE_COMBO" = "true" ]; then - currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') - echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer." - publishTask="publish-signed" - cat admin/gpg.sbt >> project/plugins.sbt - cp admin/publish-settings.sbt . - # Copied from the output of genKeyPair.sh - K=$encrypted_6368ca85cfa9_key - IV=$encrypted_6368ca85cfa9_iv - openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d - fi -fi - -sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" clean test publishLocal "$publishTask" diff --git a/admin/encryptEnvVars.sh b/admin/encryptEnvVars.sh deleted file mode 100755 index b62566798..000000000 --- a/admin/encryptEnvVars.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Encrypt sonatype credentials so that they can be -# decrypted in trusted builds on Travis CI. -# -set -e - -read -s -p 'SONA_USER: ' SONA_USER -travis encrypt SONA_USER="$SONA_USER" -read -s -p 'SONA_PASS: ' SONA_PASS -travis encrypt SONA_PASS="$SONA_PASS" diff --git a/admin/genKeyPair.sh b/admin/genKeyPair.sh deleted file mode 100755 index aabeb167b..000000000 --- a/admin/genKeyPair.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# Generates a key pair for this repository to sign artifacts. -# Encrypt the private key and its passphrase in trusted builds -# on Travis CI. -# -set -e - -# Based on https://gist.github.com/kzap/5819745: -function promptDelete() { - if [[ -f "$1" ]]; then - echo About to delete $1, Enter for okay / CTRL-C to cancel - read - rm "$1" - fi -} -for f in admin/secring.asc.enc admin/secring.asc admin/pubring.asc; do promptDelete "$f"; done - -echo Generating key pair. Please enter 1. repo name 2. scala-internals@googlegroups.com, 3. a new passphrase -echo Be careful when using special characters in the passphrase, see http://docs.travis-ci.com/user/encryption-keys/#Note-on-escaping-certain-symbols -cp admin/gpg.sbt project -sbt 'set pgpReadOnly := false' \ - 'set pgpPublicRing := file("admin/pubring.asc")' \ - 'set pgpSecretRing := file("admin/secring.asc")' \ - 'pgp-cmd gen-key' -rm project/gpg.sbt - -echo ============================================================================================ -echo Encrypting admin/secring.asc. Update K and IV variables in admin/build.sh accordingly. -echo ============================================================================================ -travis encrypt-file admin/secring.asc -rm admin/secring.asc -mv secring.asc.enc admin - -echo ============================================================================================ -echo Encrypting environment variables. Add each to a line in .travis.yml. Include a comment -echo with the name of the corresponding variable -echo ============================================================================================ -read -s -p 'PGP_PASSPHRASE: ' PGP_PASSPHRASE -travis encrypt PGP_PASSPHRASE="$PGP_PASSPHRASE" diff --git a/admin/gpg.sbt b/admin/gpg.sbt deleted file mode 100644 index 68ae46411..000000000 --- a/admin/gpg.sbt +++ /dev/null @@ -1,2 +0,0 @@ - -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") // only added when publishing, see build.sh diff --git a/admin/publish-settings.sbt b/admin/publish-settings.sbt deleted file mode 100644 index 026c6ee3e..000000000 --- a/admin/publish-settings.sbt +++ /dev/null @@ -1,8 +0,0 @@ -def env(key: String) = Option(System.getenv(key)).getOrElse("") - -inThisBuild(Seq( - pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray), - pgpPublicRing := file("admin/pubring.asc"), - pgpSecretRing := file("admin/secring.asc"), - credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) -)) diff --git a/admin/pubring.asc b/admin/pubring.asc deleted file mode 100644 index 0d645827a..000000000 --- a/admin/pubring.asc +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.49 - -mQENBFm6iTwBCACgT230xyUVy3/YSEMJ5MJeDepARKBB/Vqg4tvIDvvjsuS+CH9t -ErpsZnGf5t7iw+nURNn3lYohSPdO2huezWScgCpJt5OH3uQ+ywp0J8cyYDyTIs4O -E224fAC0T0Tx/wT9OPWgyA7yuKvgJZ5fER/IszDrjgtxsKuy6lZMnF2U1LIIb4Tl -vIMki0Fkjr2fcu3n6cumY+9556Rj8/FJYhqG2iMAosG+u5HNEdiy1CdpBQAVqR6x -y4LdFrvwgAf128tmoGTRWBTRY/R1Dt+3PJm3EIPoCv/nIAogHUcAYpt13AiSrvYk -C5YN9cyZMI/du0LsZIv6Whpk9hwDhC+o5cQdABEBAAG0LHNjYWxhLWFzbSA8c2Nh -bGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEcBBMBAgAGBQJZuok8AAoJ -EAHZuceVLEof5wAH/REb7QU1k1hvr0pOvbdTlB8Jwwns9FA/htSqPxhjO9zSYYKO -0Z6cbbGqva32rAG7GUAxm7ciNmveLyuNYtV3wujZtmgO/ZpU+3NvN5KPjuXTn5ta -7obfDqGJllZlEvJFqXbSmB0WheNou4nXsSIoVYXH3Rs8SddCoHVO3wnxV2sNm4Y4 -IY4iLovOhLPncalDD08RI3CuLTb/nvmL8VRbolF47Z9jO2YH79ZvkJvb7H1zO/By -qbMoRO9pZ+Y0fhMsQ+NAnBK71Y9jxKuQfGRrIURw948KHOrJsLr+Z5O1RzJ6654i -0p36SLdk2JAO3nHkAWePC0/CN6LE1KuNmbS9/po= -=oQR+ ------END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc deleted file mode 100644 index f0fb78f5b..000000000 Binary files a/admin/secring.asc.enc and /dev/null differ diff --git a/build.sbt b/build.sbt index 5889519cd..4f05ea963 100644 --- a/build.sbt +++ b/build.sbt @@ -1,37 +1,16 @@ -import ScalaModulePlugin._ - -scalaModuleSettings -scalaModuleSettingsJVM - -name := "scala-asm" - -enablePlugins(GitVersioning) -lazy val AsmTag = """ASM_(\d+)_(\d+)(?:_(\d+))?(?:_([\w\d_]+))?(-\d+-[\w\d]+)?""".r -lazy val ScalaAsmTag = """v(.*)""".r -git.gitTagToVersionNumber := { - case AsmTag(maj, min, pat, suf, des) => - // map a git-describe version built from an asm tag to a compatible version number - val p = if (pat != null && pat != "") s".$pat" else "" - val s = if (suf != null && suf != "") s"-$suf" else "" - val d = if (des != null && des != "") des else "" - Some(s"$maj.$min$p$s$d") - case ScalaAsmTag(v) => - Some(v) - case v => - throw new Error(s"Cannot get version number from git-describe: $v") -} -git.useGitDescribe := true - -// No Scala sources, but still set some version. Need to set `crossScalaVersions` for the -// sbt-scala-module plugin, which will then set scalaVersion. -crossScalaVersions in ThisBuild := List("2.12.7") - -// Otherwise the artifact has a dependency on scala-library +// build autoScalaLibrary := false - -// Don't add `_` to the jar file name - it's a Java-only project, no Scala cross-versioning needed crossPaths := false +Compile / compile / javacOptions ++= Seq("-g", "-parameters") -javacOptions in compile ++= Seq("-g", "-parameters") - -OsgiKeys.exportPackage := Seq(s"scala.tools.asm.*;version=${version.value}") +// publish +name := "scala-asm" +organization := "org.scala-lang.modules" +sonatypeProfileName := "org.scala-lang" +homepage := Some(url("https://github.com/scala/scala-asm")) +licenses := Seq("BSD 3-clause" -> url("http://opensource.org/licenses/BSD-3-Clause")) +scmInfo := Some(ScmInfo(url("https://github.com/scala/scala-asm"), + "scm:git:git@github.com:scala/scala-asm.git")) + +// override sbt-dynver (sbt-ci-release brings it, but we don't want it) +version := "9.7.1-scala-1" diff --git a/project/build.properties b/project/build.properties index 8e682c526..e88a0d817 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.18 +sbt.version=1.10.6 diff --git a/project/plugins.sbt b/project/plugins.sbt index 6fa2784f3..772616fa0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") - -// Last version that works on Java 6 -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0")