Skip to content

Commit 473a936

Browse files
authored
update version to 0.2.2
update version to 0.2.2
2 parents 2ff4415 + 2dffea9 commit 473a936

File tree

7 files changed

+140
-26
lines changed

7 files changed

+140
-26
lines changed

.github/workflows/build-and-release.yml

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ jobs:
2929
cmake_args: '-DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON'
3030
artifact_name: 'librandomx_macos_x86_64.dylib'
3131
output_lib: 'librandomx_macos_x86_64.dylib'
32-
# macOS - aarch64
33-
- os: macos-latest
34-
arch: aarch64
35-
cmake_args: '-DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON'
36-
artifact_name: 'librandomx_macos_aarch64.dylib'
37-
output_lib: 'librandomx_macos_aarch64.dylib'
3832
# Windows - x86_64
3933
- os: windows-latest
4034
arch: x86_64
@@ -49,6 +43,9 @@ jobs:
4943
arch: amd64
5044
- os: macos-latest
5145
arch: amd64
46+
# Exclude macOS-aarch64 from GitHub Actions build
47+
- os: macos-latest
48+
arch: aarch64
5249
- os: windows-latest
5350
arch: aarch64
5451
- os: windows-latest
@@ -75,15 +72,34 @@ jobs:
7572
run: |
7673
cd randomx
7774
mkdir build && cd build
75+
76+
echo "Configuring for native compilation"
7877
cmake .. ${{ matrix.cmake_args }}
78+
7979
make -j4
8080
mkdir -p ../../src/main/resources/native
81+
82+
# Platform-specific copy commands with verification
8183
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
82-
cp *.so ../../src/main/resources/native/${{ matrix.output_lib }}
84+
cp -v librandomx.so ../../src/main/resources/native/${{ matrix.output_lib }}
85+
ls -la ../../src/main/resources/native/
8386
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
84-
cp *.dylib ../../src/main/resources/native/${{ matrix.output_lib }}
87+
cp -v librandomx.dylib ../../src/main/resources/native/${{ matrix.output_lib }}
88+
ls -la ../../src/main/resources/native/
8589
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
86-
cp *.dll ../../src/main/resources/native/${{ matrix.output_lib }}
90+
cp -v librandomx.dll ../../src/main/resources/native/${{ matrix.output_lib }}
91+
ls -la ../../src/main/resources/native/
92+
fi
93+
shell: bash
94+
95+
- name: Verify library file
96+
run: |
97+
echo "Verifying library file in native resources directory"
98+
if [ -f "src/main/resources/native/${{ matrix.output_lib }}" ]; then
99+
echo "✅ Library file ${{ matrix.output_lib }} exists"
100+
else
101+
echo "❌ Library file ${{ matrix.output_lib }} is missing"
102+
exit 1
87103
fi
88104
shell: bash
89105

@@ -100,12 +116,29 @@ jobs:
100116
- name: Checkout code
101117
uses: actions/checkout@v4
102118

103-
- name: Download Dynamic Link Library Artifacts
119+
- name: Download all artifacts
104120
uses: actions/download-artifact@v4
105121
with:
106122
path: src/main/resources/native/
107-
pattern: librandomx-*
108-
- run: ls src/main/resources/native/
123+
merge-multiple: true
124+
125+
- name: Check for Apple Silicon Library
126+
run: |
127+
echo "Checking for macOS ARM64 library (should be precompiled locally)"
128+
if [ -f "src/main/resources/native/librandomx_macos_aarch64.dylib" ]; then
129+
echo "✅ Found precompiled Apple Silicon library"
130+
else
131+
echo "⚠️ WARNING: Apple Silicon library (librandomx_macos_aarch64.dylib) not found!"
132+
echo "⚠️ Please compile this library locally on an Apple Silicon Mac and commit it to the repository."
133+
echo "⚠️ Build will continue but the final JAR will not support Apple Silicon Macs."
134+
fi
135+
shell: bash
136+
137+
- name: List downloaded artifacts
138+
run: |
139+
echo "Contents of native resources directory:"
140+
ls -la src/main/resources/native/
141+
shell: bash
109142

110143
- name: Set up JDK
111144
uses: actions/setup-java@v4
@@ -126,6 +159,8 @@ jobs:
126159
release:
127160
runs-on: ubuntu-latest
128161
needs: build-java
162+
# Only run release job on master branch
163+
if: github.ref == 'refs/heads/master'
129164
steps:
130165
- name: Checkout code
131166
uses: actions/checkout@v4
@@ -149,34 +184,52 @@ jobs:
149184
- name: Find Main JAR File
150185
id: find_jar
151186
run: |
152-
JAR_FILE=$(find target/ -type f -name "xdagj-native-randomx-*.jar" | head -n 1)
187+
JAR_FILE=$(find target/ -type f -name "xdagj-native-randomx-*.jar" ! -name "*-sources.jar" ! -name "*-javadoc.jar" | head -n 1)
153188
if [ -z "$JAR_FILE" ]; then
154189
echo "Error: No main JAR file found!"
155190
exit 1
156191
fi
157192
echo "Found JAR file: $JAR_FILE"
158193
echo "jar_file=$JAR_FILE" >> $GITHUB_ENV
194+
# Also set the JAR filename without path for easier use
195+
JAR_BASENAME=$(basename "$JAR_FILE")
196+
echo "jar_basename=$JAR_BASENAME" >> $GITHUB_ENV
159197
160198
- name: Generate Release Notes
199+
if: github.ref == 'refs/heads/master' # Only on master branch
161200
run: |
162-
echo "### Changelog" > RELEASE_NOTES.md
201+
echo "# xdagj-native-randomx v${{ env.VERSION }}" > RELEASE_NOTES.md
163202
echo "" >> RELEASE_NOTES.md
164-
echo "$(git log --pretty=format:"* %s (%h)" --no-merges $(git rev-list --tags --max-count=1)..HEAD)" >> RELEASE_NOTES.md
203+
echo "## Changes" >> RELEASE_NOTES.md
204+
echo "- Updated RandomX native libraries" >> RELEASE_NOTES.md
205+
echo "- Improved build process" >> RELEASE_NOTES.md
165206
echo "" >> RELEASE_NOTES.md
166-
echo "### Additional Notes" >> RELEASE_NOTES.md
167-
echo "- Build improvements." >> RELEASE_NOTES.md
207+
echo "## Native libraries included" >> RELEASE_NOTES.md
208+
echo "- Linux: x86_64" >> RELEASE_NOTES.md
209+
echo "- Windows: x86_64" >> RELEASE_NOTES.md
210+
echo "- macOS: x86_64, aarch64 (Apple Silicon)" >> RELEASE_NOTES.md
211+
echo "" >> RELEASE_NOTES.md
212+
echo "## System requirements" >> RELEASE_NOTES.md
213+
echo "- JDK 17 or later" >> RELEASE_NOTES.md
214+
echo "" >> RELEASE_NOTES.md
215+
echo "## Known issues" >> RELEASE_NOTES.md
168216
echo "- Known issues: None." >> RELEASE_NOTES.md
169217
170218
- name: Create Release using gh CLI
219+
if: github.ref == 'refs/heads/master' # Only on master branch
171220
run: |
172221
gh release create "v${{ env.VERSION }}" --title "xdagj-native-randomx v${{ env.VERSION }}" --notes-file RELEASE_NOTES.md
173222
env:
174223
GH_TOKEN: ${{ github.token }} # Use the token automatically generated by GitHub
175224

176225
- name: Rename output file
177-
run: mv "target/xdagj-native-randomx-${{ env.VERSION }}.jar" "target/xdagj-native-randomx.jar"
226+
run: |
227+
echo "Original JAR path: ${{ env.jar_file }}"
228+
cp "${{ env.jar_file }}" "target/xdagj-native-randomx.jar"
229+
echo "✅ Renamed JAR file created at target/xdagj-native-randomx.jar"
178230
179231
- name: Upload JAR using gh CLI
232+
if: github.ref == 'refs/heads/master' # Only on master branch
180233
run: |
181234
gh release upload "v${{ env.VERSION }}" target/xdagj-native-randomx.jar --clobber
182235
env:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
/target/
25+
26+
.DS_Store

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Support the project with XDAG donations:
4040

4141
- **JDK**: v17 or later
4242
- **Maven**: v3.9.9 or later
43+
- **CMake**: v3.5 or later
44+
- **GCC/Compiler**: GCC v4.8 or later (v7+ recommended for best performance)
4345

4446
### **2. Build Steps**
4547

@@ -73,12 +75,19 @@ make -j4
7375
cp -i librandomx.dylib ../../src/main/resources/native/librandomx_macos_x86_64.dylib
7476
```
7577

76-
##### **macOS aarch64**
78+
##### **macOS aarch64 (Apple Silicon)**
79+
For Apple Silicon Macs (M1, M2, M3), use the provided script:
80+
```bash
81+
# Run from the project root
82+
./scripts/build-macos-arm64.sh
83+
```
84+
85+
Or manually:
7786
```bash
7887
cd randomx
7988
mkdir build && cd build
8089
cmake .. -DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON
81-
make -j4
90+
make -j$(sysctl -n hw.ncpu)
8291
cp -i librandomx.dylib ../../src/main/resources/native/librandomx_macos_aarch64.dylib
8392
```
8493

@@ -90,6 +99,7 @@ cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_S
9099
make -j4
91100
cp -i randomx.dll ../../src/main/resources/native/librandomx_windows_x86_64.dll
92101
```
102+
You can also compile using Visual Studio, as the official RandomX repository provides solution files.
93103

94104
#### **2.3 Compile Java Library**
95105
```bash
@@ -204,6 +214,18 @@ JIT flag will cause jvm to crash in MacOS
204214

205215
We welcome contributions to improve the project! Please feel free to submit issues or pull requests.
206216

217+
### **Contributing to the library**
218+
219+
If you're submitting changes that might affect the native libraries:
220+
221+
1. For platform-specific changes, compile the native library for your platform:
222+
* Linux x86_64, macOS x86_64, or Windows x86_64: Follow the compilation steps above.
223+
* macOS aarch64 (Apple Silicon): Must be compiled on an Apple Silicon Mac using provided script.
224+
225+
2. Commit both your code changes and the updated native library files.
226+
227+
3. GitHub Actions will build for other platforms and generate a complete multi-platform JAR.
228+
207229
For discussions or questions, contact the [xdagj community](https://github.com/XDagger/xdagj).
208230

209231
---

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.xdag</groupId>
88
<artifactId>xdagj-native-randomx</artifactId>
9-
<version>0.2.1</version>
9+
<version>0.2.2</version>
1010

1111
<name>xdagj-native-randomx</name>
1212
<description>A Java RandomX Library For XDAGJ</description>
@@ -22,10 +22,10 @@
2222

2323
<!-- Dependency versions -->
2424
<commons-lang3.version>3.17.0</commons-lang3.version>
25-
<jna.version>5.15.0</jna.version>
26-
<lombok.version>1.18.34</lombok.version>
27-
<slf4j.version>2.0.16</slf4j.version>
28-
<junit.version>5.10.3</junit.version>
25+
<jna.version>5.17.0</jna.version>
26+
<lombok.version>1.18.38</lombok.version>
27+
<slf4j.version>2.0.17</slf4j.version>
28+
<junit.version>5.12.2</junit.version>
2929
<jmh.version>1.37</jmh.version>
3030

3131
<!-- Plugin versions -->

randomx

scripts/build-macos-arm64.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# Script to build RandomX for Apple Silicon (M series chips)
4+
# This script should be run on an Apple Silicon Mac
5+
6+
# Check if running on ARM Mac
7+
if [[ $(uname -m) != "arm64" ]]; then
8+
echo "❌ This script must be run on an Apple Silicon Mac (M1/M2/M3)"
9+
exit 1
10+
fi
11+
12+
echo "🔍 Building RandomX library for Apple Silicon (ARM64)..."
13+
14+
# Navigate to randomx directory
15+
cd "$(dirname "$0")/../randomx" || exit 1
16+
17+
# Create build directory if it doesn't exist
18+
mkdir -p build
19+
cd build || exit 1
20+
21+
echo "🔧 Running CMake..."
22+
cmake .. -DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON
23+
24+
echo "🔨 Compiling RandomX..."
25+
make -j$(sysctl -n hw.ncpu)
26+
27+
# Create native resources directory if it doesn't exist
28+
mkdir -p ../../src/main/resources/native
29+
30+
echo "📦 Copying library to resources directory..."
31+
cp -vf librandomx.dylib ../../src/main/resources/native/librandomx_macos_aarch64.dylib
32+
33+
echo "✅ Build complete!"
34+
echo "Library location: src/main/resources/native/librandomx_macos_aarch64.dylib"
35+
echo ""
36+
echo "Please commit this file to your repository before pushing to GitHub."
37+
echo "This will allow GitHub Actions to package it with the other platform libraries."
112 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)