-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_to_maven_central.py
65 lines (50 loc) · 2.03 KB
/
publish_to_maven_central.py
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
from pathlib import Path
import time
from rtmaven import prepare, stage, promote, Package, eprint, eprint_header
from tempground import TempGround
def test_package(package: Package):
with TempGround(
files={
# minimalistic build script to use the library
"build.gradle.kts": """
plugins {
id("application")
kotlin("jvm") version "1.6.20"
}
repositories {
maven { url = uri("__TEMP_REPO__") }
mavenCentral()
}
application { mainClass.set("MainKt") }
dependencies {
implementation("io.github.rtmigo:precise:__VERSION__")
}
""".replace("__VERSION__", str(package.notation.version))
.replace("__TEMP_REPO__", package.maven_url),
# kotlin code that imports and uses the library
"src/main/kotlin/Main.kt": """
import io.github.rtmigo.precise.*
fun main() {
println(listOf(1.0, 2.0).preciseSumOf {it})
}
"""}
) as app:
eprint(app.files_content())
result = app.run(["gradle", "run", "-q"])
eprint(result)
assert result.returncode == 0
assert result.stdout == "3.0\n", result.stdout
eprint("Everything is OK!")
def build_test_release():
package = stage(prepare(
description="Kotlin/JVM compensated summation of Double sequences "
"to calculate sum, mean, standard deviation",
github_url="https://github.com/rtmigo/precise_kt@master",
developer="Artsiom iG <ortemeo@gmail.com>",
license="MIT"))
eprint_header("Testing")
eprint()
test_package(package)
promote(package)
if __name__ == "__main__":
build_test_release()