From e93ae6e84c3f8696a9f63a91e5a2f984b2730096 Mon Sep 17 00:00:00 2001 From: Salomon BRYS Date: Tue, 21 Nov 2023 16:29:02 +0100 Subject: [PATCH] CI --- .github/actions/check.yml | 22 +++++++ .github/workflows/release.yml | 107 ++++++--------------------------- .github/workflows/snapshot.yml | 72 +++------------------- .github/workflows/test.yml | 47 ++------------- gradle.properties | 3 +- 5 files changed, 56 insertions(+), 195 deletions(-) create mode 100644 .github/actions/check.yml diff --git a/.github/actions/check.yml b/.github/actions/check.yml new file mode 100644 index 0000000..43f8a5a --- /dev/null +++ b/.github/actions/check.yml @@ -0,0 +1,22 @@ +name: "Check Plugin" +runs: + using: "composite" + steps: + - name: Check + run: ./gradlew --stacktrace check + shell: bash + - name: Publish To Maven Local + run: ./gradlew --stacktrace publishToMavenLocal + shell: bash + - name: Check plugin with JVM JUnit4 + working-directory: tests-projects/tests-jvm-junit4 + run: ../../gradlew --stacktrace check + shell: bash + - name: Check plugin with JVM JUnit5 + working-directory: tests-projects/tests-jvm-junit5 + run: ../../gradlew --stacktrace check + shell: bash + - name: Check plugin with Android + working-directory: tests-projects/tests-android + run: ../../gradlew --stacktrace check + shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc00fde..aaa2d3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,114 +6,43 @@ 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/create-nexus-staging-repo@v1.1 - 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/workflows/create-nexus-staging-repository.yml + 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 + - name: Check + uses: ./.github/actions/check.yml + - name: Upload + run: ./gradlew --stacktrace 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/workflows/create-nexus-staging-repository.yml + 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 with: - java-version: 17 + with-konan: false - name: Publish env: GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 2b93882..88e81dc 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -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 - shell: bash - - name: Upload (ubuntu) - if: matrix.os == 'ubuntu-latest' + - name: Setup + uses: kosi-libs/kodein-internal-github-actions/setup + - name: Check + uses: ./.github/actions/check.yml + - name: Upload run: ./gradlew --stacktrace publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fdc6209..64b7ead 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 - 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.yml diff --git a/gradle.properties b/gradle.properties index df6661c..9ac7ee7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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