Skip to content

Commit 1d315da

Browse files
committed
<optimize> github workflow
1 parent a9a317e commit 1d315da

15 files changed

+244
-204
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/gradle.yml

Lines changed: 0 additions & 109 deletions
This file was deleted.

.github/workflows/kommand publish.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: Kommand Publish
9+
10+
on:
11+
push:
12+
tags:
13+
- "*"
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
publish:
21+
runs-on: macos-12
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Cargo
26+
uses: actions-rust-lang/[email protected]
27+
with:
28+
toolchain: 1.69.0
29+
target: ${{ matrix.cargo_target }}
30+
31+
- name: Set up just
32+
run: cargo install just --version 1.15.0
33+
34+
- name: Set up JDK 17
35+
uses: actions/[email protected]
36+
with:
37+
java-version: '17'
38+
distribution: 'microsoft'
39+
architecture: ${{ matrix.jdk_arch }}
40+
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@v3
43+
44+
- name: Set up cross-compiler
45+
run: just prepare
46+
47+
- name: Build kommand-core
48+
run: just all
49+
working-directory: kommand-core
50+
51+
- name: Test memory leak
52+
run: just leaks
53+
54+
- name: Import GPG key
55+
run: |
56+
mkdir -p $HOME/.gradle
57+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode > $HOME/.gradle/secret.gpg
58+
gpg --batch --import $HOME/.gradle/secret.gpg
59+
60+
- name: Publish to sonatype
61+
run: |
62+
./gradlew publishToSonatype \
63+
-PossrhUsername="${{ secrets.SONATYPE_USERNAME }}" \
64+
-PossrhPassword="${{ secrets.SONATYPE_PASSWORD }}" \
65+
-Psigning.keyId="${{ secrets.GPG_KEY_ID }}" \
66+
-Psigning.password="${{ secrets.GPG_PASSPHRASE }}" \
67+
-Psigning.secretKeyRingFile="$HOME/.gradle/secret.gpg"
68+
69+
- name: Close sonatype
70+
run: |
71+
./gradlew findSonatypeStagingRepository closeSonatypeStagingRepository \
72+
-PossrhUsername="${{ secrets.SONATYPE_USERNAME }}" \
73+
-PossrhPassword="${{ secrets.SONATYPE_PASSWORD }}" \
74+
-Psigning.keyId="${{ secrets.GPG_KEY_ID }}" \
75+
-Psigning.password="${{ secrets.GPG_PASSPHRASE }}" \
76+
-Psigning.secretKeyRingFile="$HOME/.gradle/secret.gpg"
77+
78+
- name: Release sonatype
79+
run: |
80+
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository \
81+
-PossrhUsername="${{ secrets.SONATYPE_USERNAME }}" \
82+
-PossrhPassword="${{ secrets.SONATYPE_PASSWORD }}" \
83+
-Psigning.keyId="${{ secrets.GPG_KEY_ID }}" \
84+
-Psigning.password="${{ secrets.GPG_PASSPHRASE }}" \
85+
-Psigning.secretKeyRingFile="$HOME/.gradle/secret.gpg"
86+
87+
- name: Clean up GPG key
88+
if: always()
89+
run: |
90+
rm -f $HOME/.gradle/secret.gpg
91+
gpg --batch --yes --delete-secret-keys ${{ secrets.GPG_KEY_ID }}
92+
gpg --batch --yes --delete-keys ${{ secrets.GPG_KEY_ID }}

.github/workflows/kommand test.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: Kommand Test
9+
10+
on:
11+
push:
12+
branches: [ "main" ]
13+
pull_request:
14+
branches: [ "main" ]
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
kommand-test:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
platform:
26+
- macos
27+
- linux
28+
- windows
29+
arch:
30+
- x64
31+
- aarch64
32+
exclude:
33+
- platform: windows
34+
arch: aarch64
35+
include:
36+
- platform: macos
37+
arch: x64
38+
os: macos-12
39+
cargo_target: x86_64-apple-darwin
40+
task: macosX64Test
41+
jdk_arch: x64
42+
- platform: macos
43+
arch: aarch64
44+
os: macos-14
45+
cargo_target: aarch64-apple-darwin
46+
task: macosArm64Test
47+
jdk_arch: aarch64
48+
- platform: linux
49+
arch: x64
50+
os: ubuntu-22.04
51+
cargo_target: x86_64-unknown-linux-gnu
52+
task: linuxX64Test
53+
jdk_arch: x64
54+
- platform: linux
55+
arch: aarch64
56+
os: ubuntu-22.04
57+
cargo_target: aarch64-unknown-linux-gnu
58+
task: linuxArm64TestDocker
59+
jdk_arch: x64
60+
- platform: windows
61+
arch: x64
62+
os: windows-latest
63+
cargo_target: x86_64-pc-windows-gnu
64+
task: mingwX64Test
65+
jdk_arch: x64
66+
67+
name: ${{ matrix.os }} - ${{ matrix.cargo_target }} - ${{ matrix.task }}
68+
69+
runs-on: ${{ matrix.os }}
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Set up Cargo
74+
uses: actions-rust-lang/[email protected]
75+
with:
76+
toolchain: 1.69.0
77+
target: ${{ matrix.cargo_target }}
78+
79+
- name: Set up just
80+
run: cargo install just --version 1.15.0
81+
82+
- name: Set up JDK 17
83+
uses: actions/[email protected]
84+
with:
85+
java-version: '17'
86+
distribution: 'microsoft'
87+
architecture: ${{ matrix.jdk_arch }}
88+
89+
- name: Set up Gradle
90+
uses: gradle/actions/setup-gradle@v3
91+
92+
- if: ${{ matrix.platform == 'linux' && matrix.arch == 'aarch64' }}
93+
name: Set up cross-gcc
94+
run: sudo apt-get install -y gcc-aarch64-linux-gnu
95+
96+
- if: ${{ matrix.platform == 'linux' && matrix.arch == 'aarch64' }}
97+
name: Set up QEMU
98+
uses: docker/setup-qemu-action@v3
99+
100+
- name: Build kommand-core
101+
run: just ${{ matrix.cargo_target }}
102+
working-directory: ./kommand-core
103+
104+
- name: Running Test
105+
run: just ${{ matrix.task }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
Kotlin Native library for create sub-process and redirect their I/O.
1313

14-
# v2.0.0
14+
# v2.1.1
1515

1616
Rust is an excellent language that takes into account both performance and engineering.
1717

build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
group = "com.kgit2"
10-
version = "2.1.0"
10+
version = "2.1.1"
1111

1212
repositories {
1313
mavenCentral()
@@ -82,6 +82,8 @@ kotlin {
8282
}
8383
}
8484

85+
val testString: String by project
86+
8587
tasks {
8688
withType(Wrapper::class) {
8789
distributionType = Wrapper.DistributionType.ALL
@@ -93,6 +95,12 @@ tasks {
9395
showStandardStreams = true
9496
}
9597
}
98+
99+
val testArg by creating {
100+
doLast {
101+
println(testString)
102+
}
103+
}
96104
}
97105

98106
val ossrhUrl: String = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
kotlin.code.style=official
22

33
org.gradle.jvmargs=-Xmx4096m
4-
#org.gradle.caching=true
54
kotlin.mpp.enableCInteropCommonization=true

0 commit comments

Comments
 (0)