Skip to content

Commit

Permalink
Merge 880f152 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 20, 2022
2 parents 70f0a44 + 880f152 commit 3ee3dbb
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: Gradle Pipe
################################################################################
# 2022-10-20 22:29 | DO NOT EDIT. GENERATED BY ATOMATR
################################################################################

name: Gradle (by Atomatr)

on:
push:
Expand Down Expand Up @@ -72,6 +76,37 @@ jobs:
pip install git+https://github.com/rtmigo/tempground_py
python test_as_git_module.py dev
test-as-maven-package:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@master

- name: Setup JDK 8
uses: actions/setup-java@master
with:
java-version: '8'
distribution: 'temurin'
cache: gradle

- name: Set up Mavence
run: |
wget -O /tmp/mavence.jar https://github.com/rtmigo/mavence/releases/latest/download/mavence.jar
java -jar /tmp/mavence.jar --version
- name: Set up Python
uses: actions/setup-python@master
with:
python-version: '3.10'

- name: Build sample project that uses the library
run: |
pip install git+https://github.com/rtmigo/tempground_py
python test_as_maven_package.py
get-version-unique:
needs: [release-flag]
runs-on: ubuntu-latest
Expand All @@ -91,12 +126,12 @@ jobs:
git fetch --all --tags
VERSION=$(./gradlew properties | grep version | awk '{print $2}')
echo "Version $VERSION"
[[ -z $(git tag -l $VERSION) ]] # fail if stdout not empty, i.e. if tag exists
#echo "::set-output name=result::$VERSION"
[[ -z $(git tag -l $VERSION) ]]
echo "result=$VERSION" >>$GITHUB_OUTPUT
to-staging:
needs: [ unit-test, test-dev-as-module-from-git ]
needs: [ unit-test, test-dev-as-module-from-git, test-as-maven-package ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand Down Expand Up @@ -133,33 +168,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

assert-can-publish-to-central:
needs: [release-flag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Check script exists
run: ls ./publish_to_maven_central.py
- name: Set up Python
uses: actions/setup-python@master
with:
python-version: '3.10'
- name: Set up Python dependencies
run: |
pip install git+https://github.com/rtmigo/rtmaven_py
- name: Check variables
run: |
export GPG_TTY=$(tty)
rtmaven check
env:
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
MAVEN_GPG_PASSWORD: ${{ secrets.MAVEN_GPG_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}


to-maven-central:
needs: [ to-github-release, assert-can-publish-to-central ]
needs: [ to-github-release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand All @@ -173,17 +183,20 @@ jobs:
uses: actions/setup-python@master
with:
python-version: '3.10'
- name: Set up Python dependencies
run: |
pip install git+https://github.com/rtmigo/rtmaven_py
pip install tempground

- name: Set up Mavence
run: |
wget -O /tmp/mavence.jar https://github.com/rtmigo/mavence/releases/latest/download/mavence.jar
java -jar /tmp/mavence.jar --version
- name: Publish to Maven Central
run: |
export GPG_TTY=$(tty)
python ./publish_to_maven_central.py
java -jar /tmp/mavence.jar central
env:
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
MAVEN_GPG_PASSWORD: ${{ secrets.MAVEN_GPG_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

48 changes: 46 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,57 @@ plugins {
id("org.jetbrains.dokka") version "1.7.20"
id("java-library")
java
id("maven-publish")
}


lateinit var central: Publication

publishing {
publications {
central = create<MavenPublication>("cenTrAl") {
from(components["java"])
pom {
val repo = "precise_kt"
name.set("precise")
description.set("Kotlin/JVM compensated summation of Double sequences to calculate sum, mean, standard deviation")
url.set("https://github.com/rtmigo/$repo")
developers {
developer {
name.set("Artsiom iG")
email.set("ortemeo@gmail.com")
}
}

scm {
connection.set("scm:git://github.com/rtmigo/$repo.git")
url.set("https://github.com/rtmigo/$repo")
}
licenses {
license {
name.set("MIT")
url.set("https://github.com/rtmigo/$repo/blob/HEAD/LICENSE")
}
}
}
}
}
}

//signing {
// useInMemoryPgpKeys(signingKey, signingPassword)
// sign(central)
//}




group = "io.github.rtmigo"
version = "0.1.0-dev23"
version = "0.1.0-dev24"

java {
withSourcesJar() // для Maven Central
withJavadocJar()
}

repositories {
Expand All @@ -22,7 +66,7 @@ dependencies {
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
testImplementation("io.kotest:kotest-assertions-core:5.5.0")
testImplementation("io.kotest:kotest-assertions-core:5.5.1")
}

kotlin {
Expand Down
70 changes: 70 additions & 0 deletions test_as_maven_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import json
import subprocess
#from pathlib import Path

#import time
#from rtmaven import prepare, stage, promote, Package, eprint, eprint_header
from tempground import TempGround


def test_package(maven_url: str, ver: str):
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__", ver)
.replace("__TEMP_REPO__", 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:
print(app.files_content())
result = app.run(["gradle", "run", "-q"])
print(result)

assert result.returncode == 0
assert result.stdout == "3.0\n", result.stdout

print("Everything is OK!")


def build_test_release():
js = json.loads(subprocess.check_output(
["java", "-jar", "/tmp/mavence.jar", "local"]))
test_package(js["mavenRepo"], js["version"])
# 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()
4 changes: 2 additions & 2 deletions update_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from atomatr import update_gradle_ci
from pathlib import Path

# !!! с 2022 в worflows написанный вручную файл (не из atomatr)

# работает без предварительных действий, если atomatr установлен как pip -e

def update():
raise NotImplementedError
update_gradle_ci(Path(__file__).parent, maven_central=True)


Expand Down

0 comments on commit 3ee3dbb

Please sign in to comment.