-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (105 loc) · 3.02 KB
/
build_and_test.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Build and test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test_core:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./core
steps:
- uses: actions/checkout@v4
- name: Build
run: |
cargo build
- name: Run tests
run: |
cargo test -- --skip smoke_memory
test_memory_consumption:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./core
steps:
- uses: actions/checkout@v4
- name: Build and run the test
run: |
export MERITRANK_NO_ASSERT=1
export MEM_KB=`/usr/bin/time -f "%M" cargo test smoke_memory --release --quiet 2>&1 1>/dev/null`
echo "Memory consumption is $MEM_KB KB"
if [ $MEM_KB -gt 550000 ]; then
exit 1
fi
test_service:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./service
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build
- name: Run tests
run: |
export MERITRANK_NUM_WALK=50
cargo test
test_psql_connector:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./psql-connector
steps:
- uses: actions/checkout@v4
- name: Setup PostgreSQL 16
run: |
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-16 postgresql-server-dev-16
- name: Prepare env
run: |
sudo su - root -c "echo \"export MERITRANK_SERVICE_URL=tcp://127.0.0.1:10444\" >> /etc/environment"
- name: Build the connector
run: |
cargo install --locked cargo-pgrx --version 0.12.8
cargo pgrx init --pg16 pg_config
cargo build
- name: Build and run the service
working-directory: ./service
run: |
cargo build --release
export MERITRANK_SERVICE_URL=tcp://127.0.0.1:10444
export MERITRANK_NUM_WALK=500
cargo run --release >/dev/null 2>&1 &
- name: Do the tests
run: |
export RUST_TEST_THREADS=1
cargo pgrx test --runas postgres --pgdata /var/lib/postgresql/pgrx
test_docker_service:
needs: [ test_core, test_memory_consumption, test_service, test_psql_connector ]
if: success()
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./service
steps:
- uses: actions/checkout@v4
- name: Build docker image
run: |
docker build -f ./Dockerfile ..
test_docker_psql_connector:
needs: [ test_core, test_memory_consumption, test_service, test_psql_connector ]
if: success()
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./psql-connector
steps:
- uses: actions/checkout@v4
- name: Build docker image
run: |
docker build -f ./Dockerfile ..