test: just a commit to test workflow #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark Mining Code | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: setup toolchain | |
uses: hecrj/setup-rust-action@v1 | |
with: | |
rust-version: stable | |
- name: Build the project | |
run: cargo build --release | |
- name: Run benchmark | |
run: | | |
echo "Running benchmark for mining code..." | |
start_time=$(date +%s%N) # Get start time in nanoseconds | |
./target/release/mining-btc | |
end_time=$(date +%s%N) # Get end time in nanoseconds | |
elapsed_time=$((end_time - start_time)) # Calculate elapsed time | |
echo "Elapsed time: $((elapsed_time / 1000000)) ms" # Convert to milliseconds |