Skip to content

Commit

Permalink
Merge pull request stratum-mining#745 from Fi3/FixGithubActions
Browse files Browse the repository at this point in the history
Fix github action, test all the new workspaces
  • Loading branch information
Fi3 authored Feb 8, 2024
2 parents e2a0f7a + 94736e9 commit a0cc791
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 31 deletions.
36 changes: 14 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
override: true

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
run: |
cargo build --manifest-path=benches/Cargo.toml
cargo build --manifest-path=common/Cargo.toml
Expand All @@ -47,10 +44,8 @@ jobs:
cargo build --manifest-path=utils/Cargo.toml
- name: Run sv1-client-and-server example
uses: actions-rs/cargo@v1
with:
command: run
args: --bin client_and_server -- 60
run: |
cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60
- name: interop-test
run: |
Expand Down Expand Up @@ -81,24 +76,21 @@ jobs:
working-directory: utils/buffer/fuzz

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
run: |
cargo test --manifest-path=benches/Cargo.toml
cargo test --manifest-path=common/Cargo.toml
cargo test --manifest-path=protocols/Cargo.toml
cargo test --manifest-path=roles/Cargo.toml
cargo test --manifest-path=utils/Cargo.toml
- name: Property based testing
uses: actions-rs/cargo@v1
with:
command: test
args: --features prop_test
run: |
cargo test --manifest-path=protocols/Cargo.toml --features prop_test
- name: Run ping-pong-with-noise example
uses: actions-rs/cargo@v1
with:
command: run
args: --bin ping_pong_with_noise -- 10
run: |
cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10
- name: Run ping-pong-without-noise example
uses: actions-rs/cargo@v1
with:
command: run
args: --bin ping_pong_without_noise -- 10
run: |
cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10
10 changes: 6 additions & 4 deletions build_header.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#! /bin/sh
#! /bin/sh

cargo install --version 0.20.0 cbindgen
cargo install --version 0.20.0 cbindgen

rm -f ./sv2.h
touch ./sv2.h

cd protocols
dir=${1:-protocols}

cd "$dir"
cbindgen --crate const_sv2 >> ../sv2.h
cbindgen --crate binary_codec_sv2 >> ../sv2.h
cbindgen --crate common_messages_sv2 >> ../sv2.h
cbindgen --crate template_distribution_sv2 >> ../sv2.h
cbindgen --crate codec_sv2 >> ../sv2.h
cbindgen --crate sv2_ffi >> ../sv2.h
cd ..
cd ..
9 changes: 7 additions & 2 deletions examples/interop-cpp/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ rm -f libsv2_ffi.a
rm -f a.out
rm -f sv2.h

cargo build --release -p sv2_ffi && cp ../../target/release/libsv2_ffi.a ./
../../build_header.sh
cargo build \
--manifest-path=../../protocols/Cargo.toml \
--release \
-p sv2_ffi && \
cp ../../protocols/target/release/libsv2_ffi.a ./

../../build_header.sh ../../protocols && mv ../../sv2.h .

g++ -I ./ ./template-provider/template-provider.cpp libsv2_ffi.a -lpthread -ldl

Expand Down
5 changes: 5 additions & 0 deletions roles/translator/src/lib/downstream_sv1/diff_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ impl Downstream {
}

let delta_time = timestamp_secs - d.difficulty_mgmt.timestamp_of_last_update;
#[cfg(test)]
if delta_time == 0 {
return Ok(None);
}
#[cfg(not(test))]
if delta_time <= 15 {
return Ok(None);
}
Expand Down
158 changes: 155 additions & 3 deletions utils/buffer/fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a0cc791

Please sign in to comment.