added more OS to benchmark #5
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: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
arch: x64 | ||
- os: windows-latest | ||
arch: x64 | ||
- os: macos-13 | ||
arch: x64 | ||
- os: macos-14 | ||
arch: arm64 | ||
runs-on: ${{ matrix.os }} | ||
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 (unix) | ||
if: ${{ matrix.os != "windows-latest" }} | ||
Check failure on line 41 in .github/workflows/benchmark.yml GitHub Actions / Benchmark Mining CodeInvalid workflow file
|
||
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 | ||
- name: Run benchmark (windows) | ||
if: ${{ matrix.os == "windows-latest" }} | ||
shell: pwsh | ||
run: | | ||
Write-Output "Running benchmark for mining code..." | ||
$startTime = [DateTime]::UtcNow.Ticks | ||
./target/release/mining-btc | ||
$endTime = [DateTime]::UtcNow.Ticks | ||
$elapsedTime = ($endTime - $startTime) / 10000 | ||
Write-Output "Elapsed time: $elapsedTime ms" |