diff --git a/.github/workflows/neo4j-almaren-githubactions.yml b/.github/workflows/neo4j-almaren-githubactions.yml new file mode 100644 index 0000000..860a905 --- /dev/null +++ b/.github/workflows/neo4j-almaren-githubactions.yml @@ -0,0 +1,51 @@ +name: Neo4j.Almaren +on: [push, pull_request] + +jobs: + Build: + runs-on: ubuntu-20.04 + services: + neo4j: + image: neo4j:3.5 + ports: + - 7474:7474 + - 7687:7687 + env: + neo4j-user: neo4j + neo4j-password: neo4j + postgres: + image: postgres:13.4 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - name: Update NEO4j password + run: | + curl -H "Content-Type: application/json" -XPOST -d '{"password":"neo4j1234"}' -u neo4j:neo4j http://localhost:7474/user/neo4j/password + - name : Check out repository code + uses: actions/checkout@v2 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: sbt + - name: Build and test scala version + run: | + PGPASSWORD="postgres" psql -c 'create database almaren;' -U postgres -h localhost + PGPASSWORD="postgres" psql -c "ALTER USER postgres PASSWORD 'postgres' ;" -U postgres -h localhost + PGPASSWORD="postgres" psql -c 'create role runner;' -U postgres -h localhost + PGPASSWORD="postgres" psql -c 'ALTER ROLE "runner" WITH LOGIN SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;' -U postgres -h localhost + sbt ++2.12.15 test + rm -rf "$HOME/.ivy2/local" || true + find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.sbt -name "*.lock" -delete || true \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 23869d2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: scala - -jdk: openjdk8 - -scala: - - 2.11.12 - -cache: - directories: - - $HOME/.cache/coursier - - $HOME/.ivy2/cache - - $HOME/.sbt - -before_cache: - - sudo apt-get -y install perl - - rm -fv $HOME/.ivy2/.sbt.ivy.lock - - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete - - find $HOME/.sbt -name "*.lock" -print -delete - -env: - global: - - NEO4J_FILE_NAME=neo4j-community - - NEO4J=3.5.26 - -install: - - wget http://dist.neo4j.org/${NEO4J_FILE_NAME}-${NEO4J}-unix.tar.gz - - tar xzf ${NEO4J_FILE_NAME}-${NEO4J}-unix.tar.gz - - ${PWD}/${NEO4J_FILE_NAME}-${NEO4J}/bin/neo4j --version - -before_script: - - ${PWD}/${NEO4J_FILE_NAME}-${NEO4J}/bin/neo4j start - - sleep 15 - - 'curl -H ''Content-Type: application/json'' -XPOST -d ''{"password":"neo4j1234"}'' -u neo4j:neo4j http://localhost:7474/user/neo4j/password' - - ${PWD}/${NEO4J_FILE_NAME}-${NEO4J}/bin/neo4j stop - - sleep 15 - - ${PWD}/${NEO4J_FILE_NAME}-${NEO4J}/bin/neo4j start - -after_script: - - ${PWD}/${NEO4J_FILE_NAME}-${NEO4J}/bin/neo4j stop - -script: - - sbt +test diff --git a/README.md b/README.md index 0616bac..0c2adce 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,35 @@ # Neo4j Connector -[![Build Status](https://travis-ci.com/modakanalytics/neo4j.almaren.svg?branch=master)](https://travis-ci.com/modakanalytics/neo4j.almaren) +[![Build Status](https://github.com/modakanalytics/neo4j.almaren/actions/workflows/neo4j-almaren-githubactions.yml/badge.svg)](https://github.com/modakanalytics/neo4j.almaren/actions/workflows/neo4j-almaren-githubactions.yml) + +Neo4j Connector was implemented using [https://github.com/neo4j-contrib/neo4j-spark-connector](https://github.com/neo4j-contrib/neo4j-spark-connector). +For more details check the following [link](https://github.com/neo4j-contrib/neo4j-spark-connector). + +To add Neo4j connector dependency to your sbt build: ``` -libraryDependencies += "com.github.music-of-the-ainur" %% "neo4j-almaren" % "0.1.2-2.4" +libraryDependencies += "com.github.music-of-the-ainur" %% "neo4j-almaren" % "0.1.3-2.4" ``` -Neo4j Connector was implemented using [https://github.com/neo4j-contrib/neo4j-spark-connector](https://github.com/neo4j-contrib/neo4j-spark-connector). -For more details check the following [link](https://github.com/neo4j-contrib/neo4j-spark-connector). +To run in spark-shell: ``` -spark-shell --master "local[*]" --packages "com.github.music-of-the-ainur:almaren-framework_2.12:0.9.3-$SPARK_VERSION,com.github.music-of-the-ainur:neo4j-almaren_2.12:0.1.2-$SPARK_VERSION" +spark-shell --master "local[*]" --packages "com.github.music-of-the-ainur:almaren-framework_2.12:0.9.8-2.4,com.github.music-of-the-ainur:neo4j-almaren_2.12:0.1.3-2.4" ``` +Neo4j Connector is available in [Maven Central](https://mvnrepository.com/artifact/com.github.music-of-the-ainur) +repository. + +| version | Connector Artifact | +|----------------------------|--------------------------------------------------------------| +| Spark 3.3.x and scala 2.13 | `com.github.music-of-the-ainur:neo4j-almaren_2.13:0.1.3-3.3` | +| Spark 3.3.x and scala 2.12 | `com.github.music-of-the-ainur:neo4j-almaren_2.12:0.1.3-3.3` | +| Spark 3.2.x and scala 2.12 | `com.github.music-of-the-ainur:neo4j-almaren_2.12:0.1.3-3.2` | +| Spark 3.1.x and scala 2.12 | `com.github.music-of-the-ainur:neo4j-almaren_2.12:0.1.3-3.1` | +| Spark 2.4.x and scala 2.12 | `com.github.music-of-the-ainur:neo4j-almaren_2.12:0.1.3-2.4` | +| Spark 2.4.x and scala 2.11 | `com.github.music-of-the-ainur:neo4j-almaren_2.11:0.1.3-2.4` | + + ## Source and Target ### Source diff --git a/build.sbt b/build.sbt index 70de56c..60b68c8 100644 --- a/build.sbt +++ b/build.sbt @@ -17,9 +17,9 @@ scalacOptions ++= Seq("-deprecation", "-feature") libraryDependencies ++= Seq( "org.apache.spark" %% "spark-core" % sparkVersion % "provided", "org.apache.spark" %% "spark-sql" % sparkVersion % "provided", - "com.github.music-of-the-ainur" %% "almaren-framework" % s"0.9.3-${majorVersion}" % "provided", - "com.typesafe.scala-logging" %% "scala-logging" % "3.9.0", - "org.scalatest" %% "scalatest" % "3.0.5" % "test", + "com.github.music-of-the-ainur" %% "almaren-framework" % s"0.9.8-${majorVersion}" % "provided", + "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5", + "org.scalatest" %% "scalatest" % "3.2.14" % "test", "neo4j-contrib" %% "neo4j-connector-apache-spark" % "4.0.1" ) diff --git a/src/test/scala/com/github/music/of/the/ainur/almaren/neo4j/Test.scala b/src/test/scala/com/github/music/of/the/ainur/almaren/neo4j/Test.scala index 3725c47..fd5443e 100644 --- a/src/test/scala/com/github/music/of/the/ainur/almaren/neo4j/Test.scala +++ b/src/test/scala/com/github/music/of/the/ainur/almaren/neo4j/Test.scala @@ -6,8 +6,9 @@ import org.apache.spark.sql.functions._ import com.github.music.of.the.ainur.almaren.Almaren import com.github.music.of.the.ainur.almaren.builder.Core.Implicit import com.github.music.of.the.ainur.almaren.neo4j.Neo4j.Neo4jImplicit +import org.scalatest.funsuite.AnyFunSuite -class Test extends FunSuite with BeforeAndAfter { +class Test extends AnyFunSuite with BeforeAndAfter { val almaren = Almaren("neo4j-almaren")