diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index dd0a368a75..795ab9a0d7 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -9,5 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - run: ./middleware.sh ${{ secrets.ANYTYPE_SECRET }} - - run: ./gradlew assembleDebug test -Dpre-dex=false + - name: Setup middleware dependency + env: + token_secret: ${{ secrets.ANYTYPE_SECRET }} + user_secret: ${{ secrets.ANYTYPE_USER_SECRET }} + run: ./middleware2.sh $token_secret $user_secret + - name: Run unit tests + run: ./gradlew assembleDebug test -Dpre-dex=false diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5e361ede69..883556be09 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,15 +1,16 @@ on: push: - branches: develop + branches: [develop] name: CI jobs: setup-android: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - run: ./middleware.sh ${{ secrets.ANYTYPE_SECRET }} - - run: ./gradlew build test -Dpre-dex=false - - uses: actions/upload-artifact@master - with: - name: Debug APK - path: app/build/outputs/apk/debug/app-debug.apk + - name: Setup middleware dependency + env: + token_secret: ${{ secrets.ANYTYPE_SECRET }} + user_secret: ${{ secrets.ANYTYPE_USER_SECRET }} + run: ./middleware2.sh $token_secret $user_secret + - name: Run unit tests. Full mode. + run: ./gradlew build test -Dpre-dex=false diff --git a/.gitignore b/.gitignore index effd8dae9f..89567d4d81 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .gradle /local.properties /configuration.properties +/github.properties .idea/* !.idea/copyright .DS_Store diff --git a/build.gradle b/build.gradle index 765f8275d7..64171c8464 100644 --- a/build.gradle +++ b/build.gradle @@ -36,12 +36,22 @@ buildscript { } } +def githubProperties = new Properties() +githubProperties.load(new FileInputStream(rootProject.file('github.properties'))) + allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } - maven { url 'http://dl.bintray.com/ebolo/ebolo-oss' } + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/anytypeio/go-anytype-middleware") + credentials { + username = githubProperties['gpr.usr'] + password = githubProperties['gpr.key'] + } + } } } diff --git a/dependencies.gradle b/dependencies.gradle index a73bf2ec23..538f60a8ef 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -90,6 +90,10 @@ ext { amplitude_version = '2.30.0' okhttp_version = '4.2.2' + // Anytype + + middleware_version = '0.15.4' + mainApplication = [ kotlin: "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version", coroutines: "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version", @@ -189,4 +193,8 @@ ext { amplitude: "com.amplitude:android-sdk:$amplitude_version", okhttp: "com.squareup.okhttp3:okhttp:$okhttp_version" ] + + anytype = [ + middleware: "com.anytype.library:anytype-mw:$middleware_version" + ] } \ No newline at end of file diff --git a/github.properties b/github.properties new file mode 100644 index 0000000000..8c4e13de4d --- /dev/null +++ b/github.properties @@ -0,0 +1,2 @@ +gpr.usr=GITHUB_USERID +gpr.key=PERSONAL_ACCESS_TOKEN \ No newline at end of file diff --git a/middleware/build.gradle b/middleware/build.gradle index 7b60b5c2bb..f520530bcf 100644 --- a/middleware/build.gradle +++ b/middleware/build.gradle @@ -29,14 +29,14 @@ dependencies { implementation project(':protocol') implementation project(':data') - implementation "io.anytype:middleware-library:1.0.0@aar" - def applicationDependencies = rootProject.ext.mainApplication + def anytypeDependencies = rootProject.ext.anytype def unitTestDependencies = rootProject.ext.unitTesting implementation applicationDependencies.kotlin implementation applicationDependencies.timber implementation applicationDependencies.coroutinesAndroid + implementation anytypeDependencies.middleware testImplementation unitTestDependencies.junit testImplementation unitTestDependencies.kotlinTest diff --git a/middleware2.sh b/middleware2.sh new file mode 100755 index 0000000000..844a227f3c --- /dev/null +++ b/middleware2.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +TOKEN=$1 +USER=$2 + +GITHUB_USER_PROPERTY="gpr.usr" +GITHUB_KEY_PROPERTY="gpr.key" + +if [ "$TOKEN" = "" ]; then + echo "ERROR: token is empty" + exit 1 +fi; + +if [ "$USER" = "" ]; then + echo "ERROR: user is empty" + exit 1 +fi; + +rm -rf github.properties +touch github.properties + +echo "$GITHUB_USER_PROPERTY=$USER" >> github.properties +echo "$GITHUB_KEY_PROPERTY=$TOKEN" >> github.properties \ No newline at end of file