-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Travis, add GitHub Actions, add basic scripted test
- Loading branch information
Showing
12 changed files
with
137 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/sbt-test/fm-sbt-s3-resolver/javax.ws.rs-api/project/plugins.sbt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
src/sbt-test/fm-sbt-s3-resolver/publish_and_resolve/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
) |
9 changes: 9 additions & 0 deletions
9
src/sbt-test/fm-sbt-s3-resolver/publish_and_resolve/example-app/src/main/scala/app/App.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/sbt-test/fm-sbt-s3-resolver/publish_and_resolve/example-lib/src/main/scala/lib/Lib.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package lib | ||
|
||
object Lib { | ||
def helloWorld(): String = "Hello World!" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |