Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
SalomonBrys committed Nov 21, 2023
1 parent a6ebf71 commit aa0905d
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 204 deletions.
22 changes: 22 additions & 0 deletions .github/actions/check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Check Plugin"
runs:
using: "composite"
steps:
- name: Check
run: ./gradlew --stacktrace --scan check
shell: bash
- name: Publish To Maven Local
run: ./gradlew --stacktrace --scan publishToMavenLocal
shell: bash
- name: Check plugin with JVM JUnit4
working-directory: tests-projects/tests-jvm-junit4
run: ../../gradlew --stacktrace --scan check
shell: bash
- name: Check plugin with JVM JUnit5
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace --scan check
shell: bash
- name: Check plugin with Android
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace --scan check
shell: bash
109 changes: 19 additions & 90 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,116 +6,45 @@ on:

jobs:
create-staging-repository:
name: Create staging repository
runs-on: ubuntu-latest
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
uses: nexus-actions/[email protected]
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
uses: kosi-libs/kodein-internal-github-actions/create-nexus-staging-repository.yml@main
secrets: inherit

build-upload:
needs: create-staging-repository
runs-on: ${{ matrix.os }}
runs-on: macOS-latest
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.PGP_SIGNING_KEY }}
GPG_PRIVATE_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Check out
uses: actions/checkout@v2
- name: Cached Konan
uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
# Host only for MacOS / Windows
- name: Check (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew --stacktrace hostOnlyTest
shell: bash
# Linux / JVM / JS
- name: Check (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace check
shell: bash
- name: Publish To Maven Local (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishToMavenLocal
shell: bash
- name: Check plugin with JVM JUnit4 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit4
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with JVM JUnit5 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
- name: Upload (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew --stacktrace hostOnlyPublish -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository_id }}
shell: bash
- name: Upload (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository_id }}
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
- name: Check
uses: ./.github/actions/check
- name: Upload
run: ./gradlew --stacktrace --scan publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository-id }}
shell: bash

drop-or-release:
drop-or-release-staging-repository:
needs: [create-staging-repository, build-upload]
runs-on: ubuntu-latest
if: ${{ always() && needs.create-staging-repository.result == 'success' }}
steps:
- name: Discard
if: ${{ needs.build-upload.result != 'success' }}
uses: nexus-actions/drop-nexus-staging-repo@v1
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
- name: Release
if: ${{ needs.build-upload.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@v1
with:
base_url: https://s01.oss.sonatype.org/service/local/
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
uses: kosi-libs/kodein-internal-github-actions/create-nexus-staging-repository.yml@main
secrets: inherit
with:
repository-id: ${{ needs.create-staging-repository.outputs.repository-id }}
build-upload-result: ${{ needs.build-upload.result }}

gradle-plugin:
runs-on: ubuntu-latest
needs: [build-upload, drop-or-release]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up JDK 17
uses: actions/setup-java@v1
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
with:
java-version: 17
with-konan: false
- name: Publish
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
run: ./gradlew publishPlugins
run: ./gradlew --scan publishPlugins
72 changes: 10 additions & 62 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,69 +13,17 @@ on:
- './github/**'
- '!./github/workflow/snapshot.yml'

env:
SONATYPE_USERNAME: ${{ secrets.sonatype_username }}
SONATYPE_PASSWORD: ${{ secrets.sonatype_password }}

jobs:
build-upload:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: macOS-latest
env:
SONATYPE_USERNAME: ${{ secrets.sonatype_username }}
SONATYPE_PASSWORD: ${{ secrets.sonatype_password }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Cached Konan
uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
# Host only for MacOS / Windows
- name: Check (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew --stacktrace hostOnlyTest
shell: bash
# Linux / JVM / JS
- name: Check (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace check
shell: bash
- name: Publish To Maven Local (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishToMavenLocal
shell: bash
- name: Check plugin with JVM JUnit4 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit4
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with JVM JUnit5 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
- name: Upload (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew --stacktrace hostOnlyPublish -PgitRef=${{ github.ref }} -Psnapshot=true
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
- name: Check
uses: ./.github/actions/check
- name: Upload
run: ./gradlew --stacktrace --scan publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true
shell: bash
- name: Upload (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true
shell: bash
47 changes: 4 additions & 43 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,9 @@ on:
jobs:

check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: macOS-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Cached Konan
uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Setup
uses: kosi-libs/kodein-internal-github-actions/setup@main
- name: Check
run: ./gradlew --stacktrace check
shell: bash
- name: Publish To Maven Local (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew --stacktrace publishToMavenLocal
shell: bash
- name: Check plugin with JVM JUnit4 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit4
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with JVM JUnit5 (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
uses: ./.github/actions/check
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ org.gradle.parallel = true
# KSP
ksp.incremental.intermodule = true

# Kodein
# Kosi
org.kodein.no-default-junit = true
org.kodein.native.enableCrossCompilation=true
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
maven(url = "https://raw.githubusercontent.com/kosi-libs/kodein-internal-gradle-plugin/mvn-repo")
}
dependencies {
classpath("org.kodein.internal.gradle:kodein-internal-gradle-settings:8.3.2")
classpath("org.kodein.internal.gradle:kodein-internal-gradle-settings:8.3.4")
}
}

Expand Down
23 changes: 16 additions & 7 deletions tests-projects/tests-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,37 @@ android {

defaultConfig {
minSdk = 21
targetSdk = 32
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

kotlin {
androidTarget()
ios()
applyDefaultHierarchyTemplate()

androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}

iosSimulatorArm64()
iosX64()

sourceSets {
val commonMain by getting {
commonMain {
kotlin.srcDir("$rootDir/../../tests/tests-junit4/src/commonMain/kotlin")
dependencies {
implementation(libs.datetime)
}
}
val commonTest by getting {
commonTest {
kotlin.srcDir("$rootDir/../../tests/tests-junit4/src/commonTest/kotlin")
dependencies {
implementation(libs.coroutines.test)
Expand Down

0 comments on commit aa0905d

Please sign in to comment.