Skip to content

Commit d063e25

Browse files
Merge pull request #19 from theseus-rs/add-benchmarks
test: add benchmarks
2 parents dc0adce + 845e540 commit d063e25

File tree

14 files changed

+481
-93
lines changed

14 files changed

+481
-93
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
},
3535

3636
"remoteUser": "vscode"
37-
}
37+
}

.github/workflows/build.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,94 @@ jobs:
3434
uses: ./.github/workflows/checks.yml
3535

3636
build:
37-
name: Build & Test
37+
name: ${{ matrix.platform }}
3838
needs: [initialize, checks]
39-
uses: ./.github/workflows/build.yml
40-
with:
41-
ref: ${{ needs.init.outputs.ref }}
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
platform:
44+
- linux-x64
45+
- macos-arm64
46+
- macos-x64
47+
#- windows-x64
48+
49+
include:
50+
- platform: linux-x64
51+
os: ubuntu-22.04
52+
- platform: macos-arm64
53+
os: macos-14
54+
- platform: macos-x64
55+
os: macos-13
56+
#- platform: windows-x64
57+
# os: windows-2022
58+
59+
steps:
60+
- name: Checkout source code
61+
uses: actions/checkout@v4
62+
with:
63+
ref: ${{ github.ref }}
64+
65+
- name: Install Rust
66+
uses: dtolnay/rust-toolchain@master
67+
with:
68+
components: 'llvm-tools-preview'
69+
toolchain: stable
70+
71+
- name: Install grcov
72+
uses: taiki-e/install-action@main
73+
with:
74+
tool: grcov
75+
76+
- name: Enable caching
77+
uses: Swatinem/rust-cache@v2
78+
79+
- name: Tests
80+
env:
81+
CARGO_TERM_COLOR: always
82+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
83+
LLVM_PROFILE_FILE: postgresql-%p-%m.profraw
84+
RUST_LOG: "info,postgresql_archive=debug,postgresql_embedded=debug"
85+
RUST_LOG_SPAN_EVENTS: full
86+
RUSTFLAGS: -Cinstrument-coverage
87+
RUSTDOCFLAGS: -Cinstrument-coverage
88+
run: |
89+
cargo test --workspace --all-features
90+
91+
- name: Produce coverage info
92+
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
93+
run: |
94+
grcov $(find . -name "postgresql-*.profraw" -print) \
95+
-s . \
96+
--branch \
97+
--ignore-not-existing \
98+
--ignore='target/*' \
99+
--ignore='benches/*' \
100+
--ignore='/*' \
101+
--binary-path ./target/debug/ \
102+
--excl-line='#\[derive' \
103+
-t lcov \
104+
-o lcov.info
105+
106+
- name: Upload to codecov.io
107+
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
108+
uses: codecov/codecov-action@v3
109+
with:
110+
files: lcov.info
111+
fail_ci_if_error: true
112+
113+
- name: Install benchmarking tools
114+
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
115+
uses: bencherdev/bencher@main
116+
117+
- name: Run benchmarks
118+
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
119+
env:
120+
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
121+
BENCHER_PROJECT: theseus-rs-postgresql-embedded
122+
BENCHER_ADAPTER: rust_criterion
123+
run: |
124+
cargo bench --bench archive --features blocking -- --output-format criterion | \
125+
bencher run
126+
cargo bench --bench embedded --features blocking -- --output-format criterion | \
127+
bencher run

0 commit comments

Comments
 (0)