48
48
with :
49
49
toolchain : stable
50
50
override : true
51
+ components : llvm-tools-preview
51
52
- uses : useblacksmith/rust-cache@v3
52
53
with :
53
54
prefix-key : " v1" # Change this when updating tooling
@@ -68,18 +69,35 @@ jobs:
68
69
bash integration/toxi/setup.sh
69
70
- name : Install test dependencies
70
71
run : cargo install cargo-nextest --version "0.9.78" --locked
71
- - name : Run tests
72
- run : cargo nextest run -E 'package(pgdog)' --no-fail-fast --test-threads=1
72
+ - name : Install coverage tooling
73
+ run : cargo install cargo-llvm-cov --locked --version "0.6.10"
74
+ - name : Run tests with coverage
75
+ env :
76
+ RUSTFLAGS : " -C link-dead-code"
77
+ run : |
78
+ cargo llvm-cov clean --workspace
79
+ cargo llvm-cov nextest --lcov --output-path lcov.info --no-fail-fast --test-threads=1 --filter-expr "package(pgdog)"
73
80
- name : Run documentation tests
74
81
run : cargo test --doc
82
+ # Requires CODECOV_TOKEN secret for upload
83
+ - uses : codecov/codecov-action@v4
84
+ env :
85
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
86
+ with :
87
+ files : lcov.info
88
+ flags : unit
89
+ fail_ci_if_error : true
75
90
integration :
76
91
runs-on : blacksmith-4vcpu-ubuntu-2404
92
+ env :
93
+ LLVM_PROFILE_FILE : ${{ github.workspace }}/target/llvm-cov-target/profiles/pgdog-%p-%m.profraw
77
94
steps :
78
95
- uses : actions/checkout@v4
79
96
- uses : actions-rs/toolchain@v1
80
97
with :
81
98
toolchain : stable
82
99
override : true
100
+ components : llvm-tools-preview
83
101
- uses : useblacksmith/rust-cache@v3
84
102
with :
85
103
prefix-key : release-1
@@ -101,29 +119,82 @@ jobs:
101
119
bash integration/toxi/setup.sh
102
120
sudo curl -SL https://github.com/docker/compose/releases/download/v2.36.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
103
121
sudo chmod +x /usr/local/bin/docker-compose
104
- - name : Build PgDog
105
- run : cargo build --release
122
+ - name : Install coverage tooling
123
+ run : cargo install cargo-llvm-cov --locked --version "0.6.10"
124
+ - name : Prepare instrumented PgDog build
125
+ env :
126
+ RUSTFLAGS : " -C link-dead-code"
127
+ run : |
128
+ cargo llvm-cov clean --workspace
129
+ mkdir -p target/llvm-cov-target/profiles
130
+ cargo llvm-cov run --no-report --release --package pgdog --bin pgdog -- --help
131
+ rm -f target/llvm-cov-target/profiles/*.profraw
132
+ rm -f target/llvm-cov-target/profiles/.last_snapshot
133
+ rm -rf target/llvm-cov-target/reports
134
+ BIN_PATH=$(find target/llvm-cov-target -type f -path '*/release/pgdog' | head -n 1)
135
+ if [ -z "$BIN_PATH" ]; then
136
+ echo "Instrumented PgDog binary not found" >&2
137
+ exit 1
138
+ fi
139
+ echo "Using instrumented binary at $BIN_PATH"
140
+ echo "PGDOG_BIN=$(realpath "$BIN_PATH")" >> "$GITHUB_ENV"
106
141
- name : Load balancer
107
142
run : bash integration/load_balancer/run.sh
108
143
- name : pgbench
109
144
run : bash integration/pgbench/run.sh
145
+ - name : Verify coverage (pgbench)
146
+ run : bash integration/verify_profiles.sh pgbench
110
147
- name : Go
111
148
run : bash integration/go/run.sh
149
+ - name : Verify coverage (go)
150
+ run : bash integration/verify_profiles.sh go
112
151
- name : JavaScript
113
152
run : bash integration/js/pg_tests/run.sh
153
+ - name : Verify coverage (javascript)
154
+ run : bash integration/verify_profiles.sh javascript
114
155
- name : Toxi
115
156
run : bash integration/toxi/run.sh
157
+ - name : Verify coverage (toxi)
158
+ run : bash integration/verify_profiles.sh toxi
116
159
- name : Python
117
160
run : bash integration/python/run.sh
161
+ - name : Verify coverage (python)
162
+ run : bash integration/verify_profiles.sh python
118
163
- name : Ruby
119
164
run : bash integration/ruby/run.sh
165
+ - name : Verify coverage (ruby)
166
+ run : bash integration/verify_profiles.sh ruby
120
167
- name : Java
121
168
run : bash integration/java/run.sh
169
+ - name : Verify coverage (java)
170
+ run : bash integration/verify_profiles.sh java
122
171
- name : More complex stuff
123
172
run : bash integration/complex/run.sh
173
+ - name : Verify coverage (complex)
174
+ run : bash integration/verify_profiles.sh complex
124
175
- name : Rust
125
176
run : bash integration/rust/run.sh
177
+ - name : Verify coverage (rust)
178
+ run : bash integration/verify_profiles.sh rust
126
179
- name : Dry run
127
180
run : bash integration/dry_run/run.sh
181
+ - name : Verify coverage (dry_run)
182
+ run : bash integration/verify_profiles.sh dry_run
128
183
# - name: Plugins
129
184
# run: bash integration/plugins/run.sh
185
+ - name : Ensure PgDog stopped
186
+ run : |
187
+ if pgrep -x pgdog > /dev/null; then
188
+ killall -TERM pgdog
189
+ sleep 5
190
+ fi
191
+ - name : Generate integration coverage report
192
+ run : cargo llvm-cov report --release --package pgdog --lcov --output-path integration.lcov
193
+ # Requires CODECOV_TOKEN secret for upload
194
+ - uses : codecov/codecov-action@v4
195
+ env :
196
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
197
+ with :
198
+ files : integration.lcov
199
+ flags : integration
200
+ fail_ci_if_error : true
0 commit comments