forked from Cosmian/kms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
107 lines (91 loc) · 2.92 KB
/
Makefile.toml
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
106
107
[config]
default_to_workspace = false
[tasks.ci-format]
category = "dev"
description = "Run Rustfmt on base code"
script = "cargo format"
[tasks.ci-clippy-all]
category = "dev"
description = "Run Clippy on base code"
script = "cargo clippy-all"
[tasks.ci-build]
category = "dev"
description = "Build all"
script = '''
#!/bin/bash
set -ex
cargo check --all-targets --no-default-features
cargo check --all-targets --no-default-features --features insecure
cargo check --all-targets --no-default-features --features timeout
cargo build --all-targets --all-features
'''
[tasks.ci-cli]
category = "dev"
description = "Build CLI"
script = '''
#!/bin/bash
set -ex
rustup target add x86_64-pc-windows-gnu
cargo build --bin ckms --target x86_64-pc-windows-gnu
cargo build --bin ckms
'''
[tasks.ci-rust-tests]
category = "dev"
description = "Run Rust tests"
script = '''
#!/bin/bash
set -ex
cargo test --workspace --features insecure --no-default-features -- --nocapture
cargo test --bins -- --nocapture
'''
[tasks.ci]
dependencies = [
"ci-format",
"ci-clippy-all",
"ci-build",
"ci-cli",
"ci-rust-tests",
]
#
# Local tests
#
[tasks.rust-tests]
env = { TEST_DB = "kms", TEST_USER = "kms", TEST_PASSWORD = "kms", TEST_HOST_AUTH_METHOD = "trust", TEST_HOST = "localhost" }
script.pre = '''
#!/bin/bash
set -ex
# delete any previous temporary files
rm -fr /tmp/sqlite-data /tmp/tmp.json
sudo docker stop postgre || true
sudo docker stop mariadb || true
sudo docker stop mysql || true
sudo docker run -d --rm --network=host --name postgre -e POSTGRES_DB=$TEST_DB -e POSTGRES_USER=$TEST_USER -e POSTGRES_PASSWORD=$TEST_PASSWORD postgres:latest
sudo docker run -d --rm --network=host --name mariadb -e MYSQL_DATABASE=$TEST_DB -e MYSQL_ROOT_PASSWORD=$TEST_PASSWORD mariadb:latest
'''
script.main = '''
#!/bin/bash
set -ex
export KMS_POSTGRES_URL="postgres://$TEST_USER:$TEST_PASSWORD@$TEST_HOST/$TEST_DB"
export KMS_MYSQL_URL="mysql://root:$TEST_PASSWORD@$TEST_HOST/$TEST_DB"
export KMS_ENCLAVE_DIR_PATH="data/public"
export KMS_SQLITE_PATH="data/shared"
export KMS_CERTBOT_SSL_PATH="data/private"
cargo build --bin ckms
cargo test --workspace --features insecure --no-default-features -- --nocapture
cargo test --bins -- --nocapture
#############################################
# Run tests again, against a MySQL database #
#############################################
# delete any previous temporary files
rm -fr /tmp/sqlite-data tmp.json
sudo docker stop mariadb || true
sudo docker stop postgre || true
sudo docker run -d --rm --network=host --name postgre -e POSTGRES_DB=$TEST_DB -e POSTGRES_USER=$TEST_USER -e POSTGRES_PASSWORD=$TEST_PASSWORD postgres:latest
sudo docker run -d --rm --network=host --name mysql -e MYSQL_DATABASE=$TEST_DB -e MYSQL_ROOT_PASSWORD=$TEST_PASSWORD mysql:latest
cargo test --workspace --features insecure --no-default-features -- --nocapture
'''
script.post = '''
#!/bin/bash
sudo docker stop postgre || true
sudo docker stop mysql || true
'''