Skip to content

Commit

Permalink
Remove Travis, add GitHub Actions, add basic scripted test
Browse files Browse the repository at this point in the history
  • Loading branch information
tpunder committed Jan 6, 2022
1 parent 5261b71 commit 4064eb9
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 38 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and Tests

on:
push:
pull_request:

jobs:
get_scala_versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- uses: tpunder/cross-scala-versions@master
id: run
outputs:
sbt_versions: ${{ steps.run.outputs.sbt_versions }}

# This builds and runs local tests
build:
needs: get_scala_versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
#os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
os: [ 'ubuntu-latest' ]
java: [ '8', '11', '17' ]
sbt: ${{ fromJson(needs.get_scala_versions.outputs.sbt_versions) }}
name: Build/Test - SBT ${{ matrix.sbt }}, Java ${{ matrix.Java }} (${{ matrix.os }})
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- run: sbt ^^${{ matrix.sbt }} test

# This runs the SBT "scripted" tests
scripted:
needs: build # Don't bother running the scripted tests if the main build/test fails.
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
#os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
os: [ 'ubuntu-latest' ]
java: [ '8', '11', '17' ]
sbt:
- 0.13.18
- 1.1.6
- 1.2.8
- 1.3.13
- 1.4.9
- 1.5.8
- 1.6.1
exclude:
# These SBT versions don't work on Java 17
- sbt: 1.1.6
java: 17
- sbt: 1.2.8
java: 17
name: Scripted - SBT ${{ matrix.sbt }}, Java ${{ matrix.Java }} (${{ matrix.os }})
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
# This will publishLocal for all crossSbtVersions then test example apps
# using the matrix.sbt version. For example we will publish the 0.13 and
# 1.0 compatible versions of the plugin (via our configured
# crossSbtVersions) and then test using a wider range of SBT versions.
- run: sbt -v ^publishLocal ^^${{ matrix.sbt }} scripted
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

7 changes: 6 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ enablePlugins(SbtPlugin)

scriptedBufferLog := false

// Don't depend on publishLocal when running "scripted". This allows us to run
// "^publishLocal" for the crossSbtVersions and then run "scripted" on arbitrary
// SBT versions for testing.
scriptedDependencies := {}

scriptedLaunchOpts ++= Seq("-Xmx1024M", "-Dplugin.version=" + version.value)

crossSbtVersions := Vector("0.13.16", "1.1.0")
crossSbtVersions := Vector("0.13.18", "1.1.0")

val amazonSDKVersion = "1.12.134"

Expand Down
1 change: 0 additions & 1 deletion src/sbt-test/fm-sbt-s3-resolver/addSbtPlugin/test

This file was deleted.

7 changes: 0 additions & 7 deletions src/sbt-test/fm-sbt-s3-resolver/javax.ws.rs-api/build.sbt

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/sbt-test/fm-sbt-s3-resolver/javax.ws.rs-api/test

This file was deleted.

30 changes: 30 additions & 0 deletions src/sbt-test/fm-sbt-s3-resolver/publish_and_resolve/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

// This could be pulled from an environment variable or Java system properties
val s3Bucket: String = "fm-sbt-s3-resolver-example-bucket"

// By default we use a random UUID to prevent conflicts across test runs
// if we are using an actual S3 bucket or another shared S3 compatible storage.
val s3Directory: String = java.util.UUID.randomUUID().toString()

// This shouldn't matter since we aren't testing the Scala code.
// Note: Cannot be named "scalaVersion" since that conflicts with SBT
val scalaVersionForCompile: String = "2.13.7"

lazy val lib = (project in file("example-lib"))
.settings(
name := "example-lib",
organization := "com.example",
version := "1.0.0",
scalaVersion := scalaVersionForCompile,
publishMavenStyle := true,
publishTo := Some(s"S3 Test Repository - $s3Bucket" at s"s3://$s3Bucket/$s3Directory")
)

lazy val app = (project in file("example-app"))
.settings(
name := "example-app",
scalaVersion := scalaVersionForCompile,
// Note: We configure this as the only resolver by overwriting any default resolvers
resolvers := Seq(s"S3 Test Repository - $s3Bucket" at s"s3://$s3Bucket/$s3Directory"),
libraryDependencies += "com.example" %% "example-lib" % "1.0.0"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app

object App {
def main(args: Array[String]): Unit = {
val res: String = lib.Lib.helloWorld()
println("lib.Lib.helloWorld(): " + res)
if (res != "Hello World!") System.exit(1)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package lib

object Lib {
def helloWorld(): String = "Hello World!"
}
7 changes: 7 additions & 0 deletions src/sbt-test/fm-sbt-s3-resolver/publish_and_resolve/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# First we need to publish something
> project lib
> publish

# Now let's try to resolve what we just published
> project app
> run

0 comments on commit 4064eb9

Please sign in to comment.