forked from sanpii/libpq.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
84 lines (74 loc) · 2.58 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
image: "rust:latest"
stages:
- lint
- test
lint:fmt:
stage: lint
before_script:
- rustup component add rustfmt
script:
- cargo fmt --all -- --check
.pg: &pg
stage: test
before_script:
- echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list
- curl https://www.postgresql.org/media/keys/ACCC4CF8.asc > /etc/apt/trusted.gpg.d/ACCC4CF8.asc
- apt update
- apt install bc sudo postgresql-$PG postgresql-server-dev-$PG clang valgrind -y
- sudo -u postgres pg_ctlcluster "$PG" main start
- sudo -u postgres psql --command "create role root WITH LOGIN ENCRYPTED PASSWORD '1234';";
- sudo -u postgres psql --command "create database root with owner root;";
- export PQ_DSN='host=localhost password=1234'
lint:clippy:
<<: *pg
variables:
MODE: debug
PG: "16"
stage: lint
script:
- rustup component add clippy
- cargo clippy --all-features -- --deny warnings
test:
<<: *pg
parallel:
matrix:
- MODE: ['debug', 'release']
PG: ['9.5', '9.6', '10', '11', '12', '13', '14', '15', '16']
script: |
feature=''
if (( $(echo "$PG >= 11" | bc -l) ))
then
feature="v${PG/./_}"
fi
if [[ $MODE == "release" ]]
then
cargo test --workspace --features "$feature" --release
else
cargo test --workspace --features "$feature"
fi
valgrind:
<<: *pg
variables:
PG: "14"
script:
- cargo test --no-run --features "v$PG"
- valgrind --leak-check=full --error-exitcode=1 $(find target/debug/deps -executable -type f -name 'libpq-*')
jemallocator:
<<: *pg
variables:
PG: "16"
script: |
cargo add tikv-jemallocator
sed -i '2 s/^/#[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;\n/' src/lib.rs
cargo test --no-run --features "v$PG"
valgrind --leak-check=full --error-exitcode=1 $(find target/debug/deps -executable -type f -name 'libpq-*')
arm:
variables:
PKG_CONFIG_PATH: "/usr/lib/arm-linux-gnueabihf/pkgconfig"
PKG_CONFIG_ALLOW_CROSS: "true"
before_script:
- rustup target add arm-unknown-linux-gnueabihf
- apt-get update
- apt-get install -y curl git build-essential
- apt-get install -y libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf clang
script: cargo build --features v15 --target arm-unknown-linux-gnueabihf