Skip to content

Commit 8d506ca

Browse files
authored
chore(ci): fix windows build with rust 1.87.0 plus add additional ci test targets (#76)
* chore(ci): fix windows build with rust 1.87.0, linking with advapi32.lib. Add and update CI for native and new target builds for testing * cargo fmt * bump thiserror to 1.0.50 * Make codeRabbit happy * fix test runs
1 parent a748f94 commit 8d506ca

File tree

6 files changed

+49
-13
lines changed

6 files changed

+49
-13
lines changed

.github/workflows/build_tests.json

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[
22
{
33
"name": "linux-x86_64",
4-
"runs-on": "ubuntu-20.04",
5-
"rust": "nightly-2024-07-07",
4+
"runs-on": "ubuntu-22.04",
5+
"rust": "stable",
66
"target": "x86_64-unknown-linux-gnu",
77
"cross": false
88
},
99
{
1010
"name": "linux-arm64",
11-
"runs-on": "ubuntu-latest",
11+
"runs-on": "ubuntu-22.04-arm",
1212
"rust": "stable",
1313
"target": "aarch64-unknown-linux-gnu",
14-
"cross": true
14+
"cross": false
1515
},
1616
{
1717
"name": "linux-riscv64",
@@ -51,14 +51,32 @@
5151
"best_effort": true
5252
},
5353
{
54-
"name": "windows-arm64",
54+
"name": "windows-x64-2025",
55+
"runs-on": "windows-2025",
56+
"rust": "stable",
57+
"target": "x86_64-pc-windows-msvc",
58+
"cross": false,
59+
"build_enabled": true,
60+
"best_effort": true
61+
},
62+
{
63+
"name": "windows-arm64-cross",
5564
"runs-on": "windows-latest",
5665
"rust": "stable",
5766
"target": "aarch64-pc-windows-msvc",
5867
"cross": false,
5968
"build_enabled": true,
6069
"best_effort": true
6170
},
71+
{
72+
"name": "windows-arm64",
73+
"runs-on": "windows-11-arm",
74+
"rust": "stable",
75+
"target": "aarch64-pc-windows-msvc",
76+
"cross": false,
77+
"build_enabled": true,
78+
"best_effort": true
79+
},
6280
{
6381
"name": "ios-x86_64",
6482
"runs-on": "macos-latest",
@@ -107,7 +125,7 @@
107125
{
108126
"name": "android-riscv64",
109127
"runs-on": "ubuntu-latest",
110-
"rust": "nightly-2024-07-07",
128+
"rust": "nightly",
111129
"target": "riscv64-linux-android",
112130
"cross": true,
113131
"build_enabled": true,

.github/workflows/build_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
if: ${{ ( ! startsWith(github.ref, 'refs/tags/v') ) && ( ! matrix.builds.cross ) && ( env.CARGO_CACHE ) }}
154154
uses: Swatinem/rust-cache@v2
155155
with:
156-
key: ${{ matrix.builds.target }}
156+
key: ${{ matrix.builds.runs-on }}-${{ matrix.builds.target }}-${{ matrix.builds.name }}
157157

158158
- name: Install and setup cargo cross
159159
if: ${{ matrix.builds.cross }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [1.4.0](https://github.com/tari-project/randomx-rs/compare/v1.3.2...v1.4.0) (2025-05-21)
6+
### Feature
7+
8+
* switch to cmake crate and support less hard-coded build system
9+
10+
## [1.3.2](https://github.com/tari-project/randomx-rs/compare/v1.3.1...v1.3.2) (2024-11-13)
11+
### Feature
12+
13+
* support windows builds with either visual studio 2022 or visual studio 2019
14+
515
## [1.3.1](https://github.com/tari-project/randomx-rs/compare/v1.3.1...v1.3.0) (2024-10-07)
616
### Feature
717

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repository = "https://github.com/tari-project/randomx-rs"
66
homepage = "https://tari.com"
77
readme = "README.md"
88
license = "BSD-3-Clause"
9-
version = "1.3.2"
9+
version = "1.4.0"
1010
edition = "2018"
1111
build = "build.rs"
1212

@@ -16,13 +16,16 @@ build = "build.rs"
1616
crate-type = ["cdylib", "lib"]
1717

1818
[dependencies]
19-
bitflags = "1.3.2"
2019
libc = "0.2.121"
21-
thiserror = "1.0.30"
20+
bitflags = "1.3.2"
21+
thiserror = "1.0.50"
2222

2323
[dev-dependencies]
2424
hex = "0.4.3"
2525
quickcheck = "1"
2626

2727
[build-dependencies]
2828
cmake = "0.1"
29+
30+
[profile.release]
31+
lto = false

build.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ fn main() {
3333
println!("cargo:rustc-link-lib=static=randomx");
3434
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or("linux".to_string());
3535
let dylib_name = match target_os.as_str() {
36-
"macos" | "ios" => "c++", // macOS and iOS use "c++"
37-
"windows" => "msvcrt", // Use MSVC runtime on Windows
38-
_ => "stdc++", // Default for other systems (Linux, etc.)
36+
"macos" | "ios" => "c++", // macOS and iOS use "c++"
37+
"windows" => "msvcrt", // Use MSVC runtime on Windows
38+
_ => "stdc++", // Default for other systems (Linux, etc.)
3939
};
4040
println!("cargo:rustc-link-lib=dylib={}", dylib_name);
41+
42+
if cfg!(target_os = "windows") {
43+
println!("cargo:rustc-link-lib=advapi32");
44+
}
4145
}

rust-toolchain.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
# only used for cargo fmt settings, repo should always compile on stable too
33
[toolchain]
44
channel = "stable"
5+
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)