Skip to content

Commit

Permalink
AND-6762 Publishing BLST library
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoggam1 committed Apr 19, 2024
1 parent 6ea4af7 commit 8ad9c1e
Show file tree
Hide file tree
Showing 11 changed files with 491 additions and 30 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/neutral-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Neutral Build

on:
push:
branches:
- 'release/**'
- 'release-app_[0-9]+.[0-9]+'
- 'develop'
- 'master'
workflow_dispatch:

env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }}

jobs:
tag:
name: Create tag
runs-on: ubuntu-latest
steps:
- name: Setup swig
uses: mmomtchev/setup-swig@v1

- name: Verify
run: swig -version
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'

- name: Install Android Dependencies
run: |
tools/install-android-dependencies
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Create tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}",
sha: context.sha
})
- name: Build and publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
run: |
echo sdk.dir = $ANDROID_HOME > local.properties
GITHUB_USER=${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} ./gradlew build assembleRelease publish -Pversion=${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}
- name: Build notification
if: always()
uses: adamkdean/simple-slack-notify@master
with:
channel: '#development-android'
status: ${{ job.status }}
success_text: 'Blockchain SDK build (${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}) has been created and uploaded to Nexus.'
failure_text: 'GitHub Action #${{ github.run_number }} failed. Tag has not been not created.'
cancelled_text: 'GitHub Action #${{ github.run_number }} was cancelled'
fields: |
[{"title": "TAG", "value": "${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}"},
{"title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ local.properties

# Gradle generated files
.gradle
/gradle
gradlew
gradlew.bat

# OS-specific files
.DS_Store
Expand Down
36 changes: 10 additions & 26 deletions blstlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,14 @@ plugins {
android {
namespace 'com.tangem.blstlib'
compileSdk 33
ndkVersion '24.0.8215888'

defaultConfig {
minSdk 23
targetSdk 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
// externalNativeBuild {
// cmake {
// cppFlags ""
// }
// ndkBuild {
// arguments "NDK_PROJECT_PATH=/Users/vladislav/Documents/projects/BlstAndroid/blstlib"
// arguments "APP_PLATFORM=22"
// arguments "NDK_APPLICATION_MK=/Users/vladislav/Documents/projects/BlstAndroid/blstlib/src/main/cpp/Application.mk"
//
// }
// }
}

sourceSets {
Expand All @@ -40,15 +30,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// externalNativeBuild {
// ndkBuild {
// path "src/main/cpp/Android.mk"
// }
//// cmake {
//// path "src/main/cpp/CMakeLists.txt"
//// version "3.22.1"
//// }
// }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -70,12 +51,15 @@ dependencies {

tasks.register('runNdkBuild', Exec) {
def ndkDir = android.ndkDirectory
def blstlibDir = project.projectDir.path
executable = "$ndkDir/ndk-build"
args = ['APP_BUILD_SCRIPT=/Users/vladislav/Documents/projects/BlstAndroid/blstlib/src/main/cpp/Android.mk',
'NDK_PROJECT_PATH=/Users/vladislav/Documents/projects/BlstAndroid/blstlib/',
'NDK_LIBS_OUT=src/main/jniLibs',
'APP_PLATFORM=23',
'NDK_APPLICATION_MK=/Users/vladislav/Documents/projects/BlstAndroid/blstlib/src/main/cpp/Application.mk']
args = ["APP_BUILD_SCRIPT=$blstlibDir/src/main/cpp/Android.mk",
"NDK_PROJECT_PATH=$blstlibDir",
"NDK_LIBS_OUT=src/main/jniLibs",
"APP_PLATFORM=23",
"NDK_APPLICATION_MK=$blstlibDir/src/main/cpp/Application.mk"]
}

preBuild.dependsOn runNdkBuild
preBuild.dependsOn runNdkBuild

apply from: 'maven-push.gradle'
23 changes: 23 additions & 0 deletions blstlib/maven-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apply plugin: 'maven-publish'

publishing {
publications {
release(MavenPublication) {
groupId = "$project.GROUP"
afterEvaluate {
from components.release
}
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/tangem/blst-android")
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true

GROUP=com.tangem
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 8ad9c1e

Please sign in to comment.