Skip to content

replace Travis-CI with GitHub Actions #485

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

Closed
wants to merge 14 commits into from
Closed
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
fail-fast: false
matrix:
java: [8, 11, 17]
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: temurin
java-version: ${{matrix.java}}
- name: Test
run: sbt test package
- name: Headers
run: sbt headerCheck
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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: temurin
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}}
14 changes: 4 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/.settings/
/.idea/
target/
*.log
*.iml
/\.target/
/\.cache
/\.project
Expand All @@ -13,16 +10,13 @@ target/
/bin/
/.cache-main
/.cache-tests
admin/.coursier
admin/.scalafmt*

# metals
# IDEs and editors
/.settings/
/.idea/
*.iml
.bloop/
/.metals/
/project/**/metals.sbt

# sbt - Build Server Protocol
/.bsp/

# vscode
/.vscode/
1 change: 1 addition & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xmx4G
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ class ToIteratorVsIteratorSrc(xs: Iterable[Int]) {
- run sbt
and then run the following task `compile`;

5. Format your code with the `scalafmt` sbt task.

6. Commit your changes, push your branch to your fork and create a pull request.
5. Commit your changes, push your branch to your fork and create a pull request.

Then maybe someone will take over and implement your use case… or maybe you will
(see next section)!
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[![Build Status](https://travis-ci.org/scala/scala-collection-compat.svg?branch=master)](https://travis-ci.org/scala/scala-collection-compat)

## Purpose and scope

This library makes some Scala 2.13 APIs available on Scala 2.11 and 2.12.

The idea is to facilitate
Expand All @@ -17,7 +13,7 @@ Only the most commonly used APIs are supported; many are missing. Contributions
To use this library, add the following to your `build.sbt`:

```
libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "2.5.0"
libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "<version>"
```

All future versions will remain backwards binary compatible with 2.0.0. (The 1.0.0 release was withdrawn and should not be used.)
Expand Down Expand Up @@ -51,11 +47,11 @@ And, it includes support for some non-collections classes such as the `@nowarn`

## Migration rules

The migration rules use scalafix. Please see the [official installation instructions](https://scalacenter.github.io/scalafix/docs/users/installation.html) and, in particular, check that your full Scala version is supported (ex 2.12.13).
The migration rules use scalafix. Please see the [official installation instructions](https://scalacenter.github.io/scalafix/docs/users/installation.html) and, in particular, check that your full Scala version is supported (ex 2.12.15).

```scala
// project/plugins.sbt
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.29")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.31")
```

### Collection213Upgrade
Expand Down
20 changes: 0 additions & 20 deletions admin/checkCLA.sh

This file was deleted.

10 changes: 0 additions & 10 deletions admin/install-scalafmt-githook.sh

This file was deleted.

3 changes: 0 additions & 3 deletions admin/pre-commit

This file was deleted.

22 changes: 0 additions & 22 deletions admin/scalafmt.sh

This file was deleted.

107 changes: 7 additions & 100 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.lightbend.tools.scalamoduleplugin.ScalaModulePlugin._
import scala.sys.process._

lazy val commonSettings = Seq(
scalaModuleAutomaticModuleName := Some("scala.collection.compat"),
headerLicense := Some(HeaderLicense.Custom(s"""|Scala (https://www.scala-lang.org)
|
|Copyright EPFL and Lightbend, Inc.
Expand Down Expand Up @@ -65,6 +64,7 @@ lazy val compat = MultiScalaCrossProject(JSPlatform, JVMPlatform, NativePlatform
.settings(
name := "scala-collection-compat",
moduleName := "scala-collection-compat",
scalaModuleAutomaticModuleName := Some("scala.collection.compat"),
scalacOptions ++= Seq("-feature", "-language:higherKinds", "-language:implicitConversions"),
Compile / unmanagedSourceDirectories += {
val sharedSourceDir = (ThisBuild / baseDirectory).value / "compat/src/main"
Expand Down Expand Up @@ -173,6 +173,7 @@ lazy val `scalafix-rules` = project
.settings(scalaModuleSettings)
.settings(commonSettings)
.settings(
scalaModuleAutomaticModuleName := None,
organization := (compat212JVM / organization).value,
publishTo := (compat212JVM / publishTo).value,
versionPolicyIntention := Compatibility.None,
Expand Down Expand Up @@ -212,6 +213,7 @@ lazy val `scalafix-input` = project
.settings(
scalaVersion := scalafixScala212,
publish / skip := true,
excludeFilter := HiddenFileFilter || "*.scala",
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= Seq(
"-Yrangepos",
Expand All @@ -225,7 +227,10 @@ val `scalafix-output` = MultiScalaProject(
"scalafix/output",
_.settings(sharedScalafixSettings)
.settings(commonSettings)
.settings(publish / skip := true)
.settings(
publish / skip := true,
excludeFilter := HiddenFileFilter || "*.scala",
)
.disablePlugins(ScalafixPlugin)
)

Expand Down Expand Up @@ -288,101 +293,3 @@ lazy val `scalafix-tests` = project
)
.dependsOn(`scalafix-input`, `scalafix-rules`)
.enablePlugins(BuildInfoPlugin, ScalafixTestkitPlugin)

val travisScalaVersion = sys.env.get("TRAVIS_SCALA_VERSION").flatMap(Version.parse)
val isTravisTag = sys.env.get("TRAVIS_TAG").exists(_.nonEmpty)
val isScalaJs = sys.env.get("SCALAJS_VERSION").exists(_.nonEmpty)
val isScalaNative = sys.env.get("SCALANATIVE_VERSION").exists(_.nonEmpty)
val isScalafix = sys.env.get("TEST_SCALAFIX").nonEmpty
val isScalafmt = sys.env.get("TEST_SCALAFMT").nonEmpty
val isBinaryCompat = sys.env.get("TEST_BINARY_COMPAT").nonEmpty
val jdkVersion = sys.env.get("ADOPTOPENJDK").map(_.toInt)

// required by sbt-scala-module
inThisBuild(
Seq(
commands += Command.command("scalafmt-test") { state =>
val exitCode = Seq("admin/scalafmt.sh", "--test") ! state.globalLogging.full
if (exitCode == 0) state else state.fail
},
commands += Command.command("scalafmt") { state =>
Seq("admin/scalafmt.sh") ! state.globalLogging.full
state
},
commands += Command.command("ci") { state =>
val toRun: Seq[String] =
if (isScalafmt) {
Seq("scalafmt-test")
} else {
List(
"TRAVIS_SCALA_VERSION",
"TRAVIS_TAG",
"SCALAJS_VERSION",
"SCALANATIVE_VERSION",
"TEST_SCALAFIX",
"TEST_SCALAFMT",
"TEST_BINARY_COMPAT"
).foreach(k =>
println(k.padTo(20, " ").mkString("") + " -> " + sys.env.getOrElse(k, "None")))

val platformSuffix = if (isScalaJs) "JS" else if (isScalaNative) "Native" else ""

val compatProject = "compat" + travisScalaVersion.get.binary + platformSuffix
val binaryCompatProject = "binary-compat"

val testProjectPrefix =
if (isScalafix) {
"scalafix-tests"
} else if (isBinaryCompat) {
binaryCompatProject
} else {
compatProject
}

val projectPrefix =
if (isScalafix) {
"scalafix-rules"
} else if (isBinaryCompat) {
binaryCompatProject
} else {
compatProject
}

val publishTask =
if (isTravisTag && !isBinaryCompat && jdkVersion == Some(8)) {
// we cannot run "ci-release" because that reads the `CI_RELEASE` / `CI_SONATYPE_RELEASE`
// env vars, which we cannot modify from java (easily). so we inline what this command does.
CiReleasePlugin.setupGpg()
List(
// same fix as https://github.com/olafurpg/sbt-ci-release/pull/66
// need to replicate it here since we're not using the `ci-release` command
"set pgpSecretRing := pgpSecretRing.value",
"set pgpPublicRing := pgpPublicRing.value",
s"$projectPrefix/publishSigned",
"sonatypePrepare",
"sonatypeBundleUpload",
"sonatypeClose"
)
} else {
Nil
}

Seq(
List(s"""++${sys.env.get("TRAVIS_SCALA_VERSION").get}!"""),
List(s"$projectPrefix/clean"),
List(s"$testProjectPrefix/test"),
List(s"$projectPrefix/publishLocal"),
publishTask
).flatten
}

println("---------")
println("Running CI: ")
toRun.foreach(println)
println("---------")

val newCommands = toRun.toList.map(Exec(_, None))
state.copy(remainingCommands = newCommands ::: state.remainingCommands)
}
)
)
Original file line number Diff line number Diff line change
@@ -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.jdk

import scala.collection.convert.{DecorateAsJava, DecorateAsScala}
Expand Down
Loading