Skip to content

Commit

Permalink
Merge #9
Browse files Browse the repository at this point in the history
9: JNI support with CI workflow r=tgrospic a=tgrospic



Co-authored-by: Tomislav Grospic <[email protected]>
  • Loading branch information
bors[bot] and tgrospic authored Aug 14, 2022
2 parents 110c963 + 62b6c12 commit b6e85f1
Show file tree
Hide file tree
Showing 21 changed files with 1,626 additions and 529 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Compile secp256k1 native code

on:
push:
branches:
- master

jobs:
compile:
name: Compile secp256k1 native code
strategy:
matrix:
os: [ubuntu-22.04, macos-11]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

# TODO: add release job
68 changes: 68 additions & 0 deletions .github/workflows/test-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test compile secp256k1 native code

on:
pull_request:
branches:
- master
push:
branches:
- trying
- staging

jobs:
test-compile:
name: Compile secp256k1 native code
strategy:
matrix:
os: [ubuntu-22.04, macos-11]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install dependencies ubuntu
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y build-essential libtool
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y openjdk-17-jdk-headless
- name: Install dependencies macos
if: matrix.os == 'macos-11'
run: |
brew install automake libtool
brew install openjdk@17
sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
echo 'export PATH="/usr/local/opt/openjdk@17/bin:$PATH"' >> /Users/runner/.bash_profile
export CPPFLAGS="-I/usr/local/opt/openjdk@17/include"
- name: Build native code
run: |
./compile.sh
- name: Export artifacts linux
if: matrix.os == 'ubuntu-22.04'
uses: actions/upload-artifact@v3
with:
name: linux64
path: ./secp256k1-tmp/.libs/

- name: Export artifacts macos
if: matrix.os == 'macos-11'
uses: actions/upload-artifact@v3
with:
name: macos64
path: ./secp256k1-tmp/.libs/

# Job to notify bors when run is successful. Skipped and cancelled job is considered
# as failure. More info https://github.com/bors-ng/bors-ng/issues/1115.
bors_success:
name: bors build finished
needs:
- test-compile
if: "github.event_name == 'push' && (github.ref == 'refs/heads/trying' || github.ref == 'refs/heads/staging') && success()"
runs-on: ubuntu-latest
steps:
- run: true
124 changes: 2 additions & 122 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,122 +1,2 @@
# Created by .ignore support plugin (hsz.mobi)
### Autotools template
# http://www.gnu.org/software/automake

Makefile.in
/ar-lib
/mdate-sh
/py-compile
/test-driver
/ylwrap

# http://www.gnu.org/software/autoconf

/autom4te.cache
/autoscan.log
/autoscan-*.log
/aclocal.m4
/compile
/config.guess
/config.h.in
/config.sub
/configure
/configure.scan
/depcomp
/install-sh
/missing
/stamp-h1

# https://www.gnu.org/software/libtool/

/ltmain.sh

# http://www.gnu.org/software/texinfo

/texinfo.tex

# http://www.gnu.org/software/m4/

m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
autom4te.cache
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/dictionaries
.idea/**/shelf

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/
cmake-build-release/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests
### CMake template
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar

.idea
secp256k1-tmp/
Dockerfile
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# require the below checks before bors merges anything
status = [
"bors build finished"
]

# Ensure that reviewers (all maintainers!) can't merge their own PRs without review.
# This works because Github doesn't allow self-review.
required_approvals = 1

# Number of seconds from when a merge commit is created to when its statuses must pass.
timeout_sec = 600 # 10min

# A marker in the PR description that indicates boilerplate that does not belong in the merge-commit message.
cut_body_after = "## Overview"

delete_merged_branches = true
23 changes: 23 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -e

cp -r secp256k1/ secp256k1-tmp/

pushd secp256k1-tmp/

# Modify secp256k1 native code with addition of JNI support
# Files copied from removed JNI support in bitcoin-core/secp256k1 repo
# https://github.com/bitcoin-core/secp256k1/pull/682
cp ../jni/build-aux/m4/* build-aux/m4/
cp -r ../jni/java/ src/java/
cp ../jni/Makefile.am Makefile.am
cp ../jni/configure.ac configure.ac

# Compile secp256k1 native code
./autogen.sh
./configure --enable-jni --enable-module-ecdh --enable-experimental --enable-module-schnorrsig --enable-module-ecdsa-adaptor
# ./configure --enable-jni --enable-module-ecdh
make CFLAGS="-std=c99"
make
make check
Loading

0 comments on commit b6e85f1

Please sign in to comment.