From: Matt Corallo Date: Sun, 26 Sep 2021 04:55:28 +0000 (+0000) Subject: Use current HEAD for version in CI instead of previous commit X-Git-Tag: v0.0.101.1^2~6 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=39ef1da5adb174818bb6afe0ee9924976018801d;p=ldk-java Use current HEAD for version in CI instead of previous commit --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4c0485d..7c325519 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,30 +57,15 @@ jobs: mv liblightningjni_debug_Linux-amd64.so liblightningjni.so export ASAN_OPTIONS=detect_leaks=0 LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test - - name: Detect current git version - run: | - # We assume the top commit is just a bindings update commit, so we - # check out the previous commit to use as the commit we git describe. - # If the top commit is a merge commit, we need to get the last merge - # head and assume the latest bindings are built against its parent. - COMMIT_PARENTS=$(git show -s --pretty=format:%P HEAD) - if [ "${#COMMIT_PARENTS}" = 40 ]; then - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD^1)" - else - MERGE_HEAD=$(git show --pretty=format:%P HEAD | ( for last in $(cat /dev/stdin); do true; done; echo $last )) - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag $MERGE_HEAD^1)" - fi - echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version" - echo "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" > .git_ver - name: Checkout latest MacOS binaries run: | - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" git clone --depth 1 https://git.bitcoin.ninja/ldk-java-bins mkdir -p src/main/resources/ cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_MacOSX-"* src/main/resources/ - name: Build Java/TS Release Bindings run: | - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" ./genbindings.sh ./ldk-c-bindings/ "-I/usr/lib/jvm/java-11-openjdk-amd64/include/ -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux/" false false - name: Build deterministic release jar run: ./build-release-jar.sh @@ -90,7 +75,7 @@ jobs: git diff --exit-code - name: Check latest library and jars are in bins repo run: | - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" rm "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"*.jar rm "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_Linux*.nativelib cp src/main/resources/liblightningjni_Linux-amd64.nativelib "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/" @@ -169,34 +154,19 @@ jobs: git clone https://github.com/lightningdevkit/ldk-c-bindings cd ldk-c-bindings git checkout 0.0.101 - - name: Detect current git version - run: | - # We assume the top commit is just a bindings update commit, so we - # check out the previous commit to use as the commit we git describe. - # If the top commit is a merge commit, we need to get the last merge - # head and assume the latest bindings are built against its parent. - COMMIT_PARENTS=$(git show -s --pretty=format:%P HEAD) - if [ "${#COMMIT_PARENTS}" = 40 ]; then - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD^1)" - else - MERGE_HEAD=$(git show --pretty=format:%P HEAD | ( for last in $(cat /dev/stdin); do true; done; echo $last )) - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag $MERGE_HEAD^1)" - fi - echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version" - echo "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" > .git_ver - name: Checkout Android AAR binaries and artifacts run: git clone --depth 1 https://git.bitcoin.ninja/ldk-java-bins - name: Build Android aar run: | . $HOME/.cargo/env - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/ldk-java-classes.jar" ./ export ANDROID_TOOLCHAIN="$(pwd)/android-ndk-r22b/toolchains/llvm/prebuilt/linux-x86_64" export PATH="$PATH:$ANDROID_TOOLCHAIN/bin" ./android-build.sh ./rust-lightning ./ldk-c-bindings/ ./ldk-java-bins/android-artifacts - name: Check latest library and jars are in bins repo run: | - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" rm "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/LDK-release.aar" cp LDK-release.aar "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/" cd ldk-java-bins @@ -265,30 +235,15 @@ jobs: tar xvvf openjdk-16.0.1_osx-x64_bin.tar.gz export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home export PATH=$JAVA_HOME/bin:$PATH - - name: Detect current git version - run: | - # We assume the top commit is just a bindings update commit, so we - # check out the previous commit to use as the commit we git describe. - # If the top commit is a merge commit, we need to get the last merge - # head and assume the latest bindings are built against its parent. - COMMIT_PARENTS=$(git show -s --pretty=format:%P HEAD) - if [ "${#COMMIT_PARENTS}" = 40 ]; then - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD^1)" - else - MERGE_HEAD=$(git show --pretty=format:%P HEAD | ( for last in $(cat /dev/stdin); do true; done; echo $last )) - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag $MERGE_HEAD^1)" - fi - echo "Using $LDK_GARBAGECOLLECTED_GIT_OVERRIDE as git version" - echo "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" > .git_ver - name: Checkout latest Linux binaries run: | - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" git clone --depth 1 https://git.bitcoin.ninja/ldk-java-bins mkdir -p src/main/resources/ cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/liblightningjni_Linux-"* src/main/resources/ - name: Build Java/TS Release Bindings run: | - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" # genbindings.sh always fails as there is no wasm32-wasi library # available, so instead we check that the expected JNI library # is created. @@ -314,7 +269,7 @@ jobs: - name: Run Java Tests against built jar run: | mvn -DskipTests=true package - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" JAR_VERSION=${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100} mvn install:install-file -Dfile=target/ldk-java-${JAR_VERSION}.jar -DgroupId=org.lightningdevkit -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar cd javatester @@ -324,7 +279,7 @@ jobs: - name: Check latest release libs are in git run: | if [ "${{ matrix.platform }}" = "macos-11" ]; then - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" rm "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-{x86_64,aarch64}.nativelib cp src/main/resources/liblightningjni_MacOSX-*.nativelib "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/" cd ldk-java-bins @@ -334,7 +289,7 @@ jobs: - name: Run Java Tests against release bins run: | if [ "${{ matrix.platform }}" != "macos-11" ]; then - export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(cat .git_ver)" + export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)" cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-{x86_64,aarch64}.nativelib src/main/resources/ mvn clean mvn -DskipTests=true package diff --git a/.gitignore b/.gitignore index 6c39c2cf..cb19f5e8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ target .idea *.iml __pycache__ +src/main/java/org/ldk/impl/version.java +src/main/jni/version.c +ts/version.ts +ts/version.c