From 5ec6d7e5be96a51d1da1b242a693cfff583fa51f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Zejnilovi=C4=87?= Date: Wed, 20 Jan 2021 10:18:41 +0200 Subject: [PATCH] #9 Add test github action --- .editorconfig | 24 +++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 21 ++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 23 +++++++++++++ .github/workflows/test.yml | 42 +++++++++++++++++++++++ build.sbt | 7 ++++ project/Dependencies.scala | 2 +- project/build.properties | 2 +- 7 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/test.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d6071ba --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +# top-most EditorConfig file +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true + +[*.xml] +indent_size = 4 +indent_style = space +insert_final_newline = true + +[*.properties] +insert_final_newline = true + +[*.{java,scala,js,json,css}] +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 120 + +[*.md] +trim_trailing_whitespace = false diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8bf129b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,21 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..46bab01 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +## Background +A clear and concise description of where the limitation lies. + +## Feature +A description of the requested feature. + +## Example [Optional] +A simple example if applicable. + +## Proposed Solution [Optional] +Solution Ideas +1. +2. +3. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d5568c8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Run Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build-scala-2_11-spark-2_4: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Scala + uses: olafurpg/setup-scala@v10 + with: + java-version: "adopt@1.8" + - name: Build and run tests + run: sbt ++2.11.12 test -DSPARK_VERSION=2.4.7 + build-scala-2_12-spark-2_4: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Scala + uses: olafurpg/setup-scala@v10 + with: + java-version: "adopt@1.8" + - name: Build and run tests + run: sbt ++2.12.12 test -DSPARK_VERSION=2.4.7 + build-scala-2_12-spark-3_0: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Scala + uses: olafurpg/setup-scala@v10 + with: + java-version: "adopt@1.8" + - name: Build and run tests + run: sbt ++2.12.12 test -DSPARK_VERSION=3.0.1 diff --git a/build.sbt b/build.sbt index 2c1761e..6afc472 100644 --- a/build.sbt +++ b/build.sbt @@ -27,9 +27,16 @@ ThisBuild / crossScalaVersions := Seq(scala211, scala212) // Scala shouldn't be packaged so it is explicitly added as a provided dependency below ThisBuild / autoScalaLibrary := false +lazy val printSparkVersion = taskKey[Unit]("Print Spark version spark-cobol is building against.") + lazy val hofs = (project in file(".")) .settings( name := "spark-hofs", + printSparkVersion := { + val log = streams.value.log + log.info(s"Building with Spark $sparkVersion") + sparkVersion + }, libraryDependencies ++= SparkHofsDependencies :+ getScalaDependency(scalaVersion.value), releasePublishArtifactsAction := PgpKeys.publishSigned.value, Test / fork := true diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 215e53b..a310f4b 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -18,7 +18,7 @@ import sbt._ object Dependencies { - private val sparkVersion = "2.4.4" + def sparkVersion: String = sys.props.getOrElse("SPARK_VERSION", "2.4.7") private val scalatestVersion = "3.0.3" diff --git a/project/build.properties b/project/build.properties index 00b48d9..d91c272 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.6 +sbt.version=1.4.6