diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..3aa63aa3c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: test +on: + push: + branches: + - main + pull_request: +jobs: + test: + strategy: + fail-fast: false + matrix: + java: [8, 11, 17] + scala: [2.12.15, 2.13.6, 3.0.2] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: coursier/cache-action@v6 + - uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: ${{matrix.java}} + - name: Test + run: sbt ++${{matrix.scala}} test headerCheck versionPolicyCheck package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..dc3371112 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release +on: + push: + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 8 + - 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 670b12f96..000000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: ~> 1.0 # needed for imports - -import: scala/scala-dev:travis/default.yml - -language: scala - -scala: - - 3.0.2 - - 2.12.15 - - 2.13.6 - -env: - - SCALAJS_VERSION= ADOPTOPENJDK=8 - - SCALAJS_VERSION=1.7.0 ADOPTOPENJDK=8 - - SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - - SCALAJS_VERSION= ADOPTOPENJDK=11 - - SCALAJS_VERSION= ADOPTOPENJDK=17 - -jobs: - exclude: - - scala: 3.0.2 - env: SCALANATIVE_VERSION=0.4.0 ADOPTOPENJDK=8 - -install: - - git fetch --tags # get all tags for sbt-dynver - -script: ./build.sh diff --git a/README.md b/README.md index 4502ef918..535484a24 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ scala-xml -[![Travis](https://img.shields.io/travis/scala/scala-xml.svg)](https://travis-ci.org/scala/scala-xml) [![latest release for 2.12](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.12.svg?label=scala+2.12)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.12) [![latest release for 2.13](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_2.13.svg?label=scala+2.13)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.13) [![latest release for 3.0](https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-xml_3.svg?label=scala+3)](http://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_3) diff --git a/build.sbt b/build.sbt index 674a474cd..fc3906c03 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,7 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} +publish / skip := true // root project + ThisBuild / startYear := Some(2002) ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))) @@ -33,6 +35,8 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings( name := "scala-xml", scalaModuleAutomaticModuleName := Some("scala.xml"), + crossScalaVersions := Seq("2.13.6", "2.12.15", "3.0.2"), + scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((3, _)) => Seq("-language:Scala2") @@ -129,6 +133,7 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform) ) .jsEnablePlugins(ScalaJSJUnitPlugin) .nativeSettings( + crossScalaVersions := Seq("2.13.6", "2.12.15"), // Scala Native cannot run forked tests Test / fork := false, libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test, diff --git a/build.sh b/build.sh deleted file mode 100755 index ab4af6963..000000000 --- a/build.sh +++ /dev/null @@ -1,57 +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. - -# sbt-dynver sets the version number from the tag -# sbt-travisci sets the Scala version from the travis job matrix - -# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: -# - check out the tag for the version that needs to be published -# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary -# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., -# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) - -# We release on JDK 8 (for Scala 2.x and Dotty 0.x) -isReleaseJob() { - if [[ "$ADOPTOPENJDK" == "8" ]]; then - true - else - false - fi -} - -if [[ "$SCALAJS_VERSION" == "" ]] && [[ "$SCALANATIVE_VERSION" == "" ]]; then - projectPrefix="xml/" -elif [[ "$SCALAJS_VERSION" == "" ]]; then - projectPrefix="xmlNative/" -else - projectPrefix="xmlJS/" -fi - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#.*)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - versionCheckTask="versionCheck" - releaseTask="ci-release" - if ! isReleaseJob; then - echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" - exit 0 - fi -fi - -# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions -export CI_RELEASE="${projectPrefix}publishSigned" -export CI_SNAPSHOT_RELEASE="${projectPrefix}publish" - -# default is sonatypeBundleRelease, which closes and releases the staging repo -# see https://github.com/xerial/sbt-sonatype#commands -# for now, until we're confident in the new release scripts, just close the staging repo. -export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" - -sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $versionCheckTask $releaseTask diff --git a/project/plugins.sbt b/project/plugins.sbt index e82b291f2..32c1365e3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,12 +1,6 @@ -val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("1.7.0") - -val scalaNativeVersion = - Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.4.0") - -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.4.0") +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") diff --git a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala index 417a3bcc6..af7daf769 100644 --- a/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala +++ b/shared/src/main/scala-2.13-/scala/xml/ScalaVersionSpecific.scala @@ -1,3 +1,15 @@ +/* + * Scala (https://www.scala-lang.org) + * + * Copyright EPFL and Lightbend, Inc. + * + * Licensed under Apache License 2.0 + * (http://www.apache.org/licenses/LICENSE-2.0). + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + package scala.xml import scala.collection.SeqLike