Skip to content

Commit 64354c6

Browse files
authored
add: ci for java (#6)
1 parent 63dfb5c commit 64354c6

File tree

6 files changed

+102
-7
lines changed

6 files changed

+102
-7
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Java CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
branches:
7+
- main
8+
- master
9+
push:
10+
branches:
11+
- main
12+
- master
13+
workflow_dispatch:
14+
15+
jobs:
16+
validate_gradle_wrapper:
17+
name: "Validate Gradle Wrapper"
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: gradle/actions/wrapper-validation@v4
22+
23+
build:
24+
name: Build and Test
25+
needs: validate_gradle_wrapper
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
matrix:
29+
os: [ubuntu-latest, macos-latest]
30+
fail-fast: false
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: recursive
37+
38+
- name: Set up JDK 25
39+
uses: actions/setup-java@v5
40+
with:
41+
java-version: 25
42+
distribution: 'temurin'
43+
cache: 'gradle'
44+
45+
- name: Install Ubuntu dependencies
46+
if: runner.os == 'Linux'
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y cmake build-essential libboost-all-dev
50+
51+
- name: Install macOS dependencies
52+
if: runner.os == 'macOS'
53+
run: |
54+
brew install cmake boost
55+
56+
- name: Cache Bitcoin Kernel build
57+
uses: actions/cache@v4
58+
with:
59+
path: |
60+
bitcoinkernel/bitcoin/build
61+
/usr/local/lib/libbitcoinkernel.*
62+
key: ${{ runner.os }}-bitcoinkernel-${{ hashFiles('bitcoinkernel/bitcoin/**') }}
63+
restore-keys: |
64+
${{ runner.os }}-bitcoinkernel-
65+
66+
- name: Build bitcoinkernel
67+
run: |
68+
cd bitcoinkernel/bitcoin
69+
cmake -B build -DBUILD_KERNEL_LIB=ON -DBUILD_UTIL_CHAINSTATE=ON -DBUILD_KERNEL_TEST=ON -DENABLE_IPC=OFF
70+
cmake --build build -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
71+
sudo cmake --install build
72+
73+
- name: Grant execute permission for gradlew
74+
run: chmod +x gradlew
75+
76+
- name: Build with Gradle
77+
run: ./gradlew build
78+
79+
- name: Upload test results
80+
if: always()
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: test-results-${{ matrix.os }}-java25
84+
path: |
85+
build/reports/tests/
86+
build/test-results/
87+
88+
- name: Upload build artifacts
89+
if: success()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: build-artifacts-${{ matrix.os }}-java25
93+
path: build/libs/

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ plugins {
33
id 'application'
44
}
55

6+
java {
7+
toolchain {
8+
languageVersion = JavaLanguageVersion.of(25)
9+
}
10+
}
11+
612
repositories {
713
mavenCentral()
814
}

gradle/wrapper/gradle-wrapper.jar

1.83 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH="\\\"\\\""
118117

119118

120119
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
172171
# For Cygwin or MSYS, switch paths to Windows format before running java
173172
if "$cygwin" || "$msys" ; then
174173
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175-
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176174

177175
JAVACMD=$( cygpath --unix "$JAVACMD" )
178176

@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
212210

213211
set -- \
214212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215-
-classpath "$CLASSPATH" \
216213
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217214
"$@"
218215

gradlew.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=
7473

7574

7675
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
76+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7877

7978
:end
8079
@rem End local scope for the variables with windows NT shell

0 commit comments

Comments
 (0)