Skip to content

Commit

Permalink
Merge pull request #278 from scala/sbt-scala-module-3
Browse files Browse the repository at this point in the history
replace Travis-CI with GitHub Actions
  • Loading branch information
SethTisue authored Sep 1, 2021
2 parents 6f03ac0 + b6ee218 commit 0055ba3
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 103 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
fail-fast: false
matrix:
java: [8, 11, 17-ea]
scala: [2.12.14, 2.13.6]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2
with:
distribution: adopt
java-version: ${{matrix.java}}
- name: Test
run: sbt ++${{matrix.scala}} test proj/headerCheck package
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: 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}}
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# scala-async [![Build Status](https://travis-ci.org/scala/scala-async.svg?branch=master)](https://travis-ci.org/scala/scala-async) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-async_2.12.svg?label=latest%20release%20for%202.12">](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-async_2.12) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-async_2.13.svg?label=latest%20release%20for%202.13">](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-async_2.13)
# scala-async [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-async_2.12.svg?label=latest%20release%20for%202.12">](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-async_2.12) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-async_2.13.svg?label=latest%20release%20for%202.13">](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-async_2.13)

A DSL to enable a direct style of programming with when composing values wrapped in Scala `Future`s.
A Scala DSL to enable a direct style of coding when composing `Future`s.

## Quick start

To include scala-async in an existing project use the library published on Maven Central.
For sbt projects add the following to your build definition - build.sbt or project/Build.scala:

### Use a modern Scala compiler
## Usage

As of scala-async 1.0, Scala 2.12.12+ or 2.13.3+ are required.

Expand Down Expand Up @@ -44,6 +39,7 @@ to match your project’s Scala binary version):
Add the `-Xasync` to the Scala compiler options.

#### SBT Example

```scala
scalacOptions += "-Xasync"
```
Expand Down Expand Up @@ -133,7 +129,7 @@ def combined: Future[Int] = async {

### `await` must be directly in the control flow of the async expression

The `await` cannot be nested under a local method, object, class or lambda:
The `await` cannot be nested under a local method, object, class or lambda:

```
async {
Expand Down
15 changes: 12 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
val sharedSettings = ScalaModulePlugin.scalaModuleSettings ++ ScalaModulePlugin.scalaModuleOsgiSettings ++ Seq(
name := "scala-async",
scalaModuleAutomaticModuleName := Some("scala.async"),
versionPolicyIntention := Compatibility.BinaryAndSourceCompatible,

crossScalaVersions := Seq("2.13.6", "2.12.14"),
scalaVersion := crossScalaVersions.value.head,

OsgiKeys.exportPackage := Seq(s"scala.async.*;version=${version.value}"),

Expand All @@ -12,16 +14,23 @@ val sharedSettings = ScalaModulePlugin.scalaModuleSettings ++ ScalaModulePlugin.
ScalaModulePlugin.enableOptimizer,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s"),
Test / scalacOptions ++= Seq("-Yrangepos"),
scalacOptions ++= List("-deprecation" , "-Xasync")
scalacOptions ++= List("-deprecation" , "-Xasync"),
)

lazy val proj = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("."))
.settings(sharedSettings)
// until we have actually published for Scala.js
.jvmSettings(versionPolicyIntention := Compatibility.BinaryAndSourceCompatible)
.jsSettings(versionPolicyIntention := Compatibility.None)
// override sbt-scala-module default (which is unsuitable for Scala.js)
.jsSettings(Test / fork := false)

lazy val root = project.in(file(".")).settings(sharedSettings)
lazy val root = project.in(file("."))
.settings(sharedSettings)
.aggregate(proj.jvm, proj.js)

Global / parallelExecution := false

Expand Down
66 changes: 0 additions & 66 deletions build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.4.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
1 change: 1 addition & 0 deletions src/main/scala/scala/async/FutureStateMachine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.async

import java.util.Objects
Expand Down
12 changes: 12 additions & 0 deletions src/test/scala/scala/async/ExceptionalTest.scala
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.async

import java.util.concurrent.atomic.AtomicReference
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/scala/async/FutureSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.async

import java.util.concurrent.ConcurrentHashMap
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/scala/async/SmokeTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.async

import org.junit.{Assert, Test}
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/scala/async/TestUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.async

import java.util.concurrent.{CountDownLatch, TimeUnit}
Expand Down

0 comments on commit 0055ba3

Please sign in to comment.