From eb7b8954c90f5034349c259278469e2bed5d1f05 Mon Sep 17 00:00:00 2001 From: soywiz Date: Wed, 7 Aug 2024 09:01:43 +0200 Subject: [PATCH] Update template --- .github/workflows/CODECOV.yml | 36 --------------------------------- .github/workflows/DEPLOY.yml | 8 ++++---- .github/workflows/TEST.yml | 38 +++++++++++++++++++++-------------- build.gradle.kts | 8 ++++---- 4 files changed, 31 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/CODECOV.yml diff --git a/.github/workflows/CODECOV.yml b/.github/workflows/CODECOV.yml deleted file mode 100644 index 08a5cc7..0000000 --- a/.github/workflows/CODECOV.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: CODECOV -# https://docs.github.com/en/actions/learn-github-actions/expressions - -on: - push: - branches: [ main, 'release/**' ] - pull_request: - branches: [ main, 'release/**' ] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - CI: true - - JAVA_VERSION: 17 - JAVA_DISTRIBUTION: zulu - -jobs: - test: - timeout-minutes: 30 - runs-on: ubuntu-latest - steps: - - { uses: actions/checkout@v4 } - - { name: Use Node.js 20.x, uses: actions/setup-node@v4, with: { node-version: 20.x } } - - { name: Setup Deno, uses: denoland/setup-deno@v1, with: { deno-version: "1.44.4" } } - - { name: Replace gradle wrapper, run: "sed 's/-all/-bin/g' gradle/wrapper/gradle-wrapper.properties > gradle/wrapper/gradle-wrapper.properties.bak; cp gradle/wrapper/gradle-wrapper.properties.bak gradle/wrapper/gradle-wrapper.properties" } - - { name: Set up JDK, uses: actions/setup-java@v4, with: { distribution: "${{ env.JAVA_DISTRIBUTION }}", java-version: "${{ env.JAVA_VERSION }}" } } - - { name: Prepare Gradle, uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 } # https://github.com/gradle/actions/releases/tag/v3.5.0 - - { name: Start gradle, run: ./gradlew } - - { name: Code coverage, run: ./gradlew koverXmlReport } - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/DEPLOY.yml b/.github/workflows/DEPLOY.yml index ca56ca9..945d704 100644 --- a/.github/workflows/DEPLOY.yml +++ b/.github/workflows/DEPLOY.yml @@ -46,10 +46,10 @@ jobs: - { os: ubuntu-latest, publishTask: "publishAndroidDebugPublicationToMavenLocal publishAndroidReleasePublicationToMavenLocal" } - { os: ubuntu-latest, publishTask: "publishKotlinMultiplatformPublicationToMavenLocal publishJvmPublicationToMavenLocal" } - { os: ubuntu-latest, publishTask: "publishJsPublicationToMavenLocal publishWasmJsPublicationToMavenLocal" } - - { os: macos-latest, publishTask: "publishMacosX64PublicationToMavenLocal publishMacosArm64PublicationToMavenLocal" } - - { os: macos-latest, publishTask: "publishTvosArm64PublicationToMavenLocal publishTvosSimulatorArm64PublicationToMavenLocal publishTvosX64PublicationToMavenLocal" } - - { os: macos-latest, publishTask: "publishIosArm64PublicationToMavenLocal publishIosSimulatorArm64PublicationToMavenLocal publishIosX64PublicationToMavenLocal" } - - { os: macos-latest, publishTask: "publishWatchosArm64PublicationToMavenLocal publishWatchosArm32PublicationToMavenLocal publishWatchosDeviceArm64PublicationToMavenLocal publishWatchosSimulatorArm64PublicationToMavenLocal" } + - { os: macos-13, publishTask: "publishMacosX64PublicationToMavenLocal publishMacosArm64PublicationToMavenLocal" } + - { os: macos-13, publishTask: "publishTvosArm64PublicationToMavenLocal publishTvosSimulatorArm64PublicationToMavenLocal publishTvosX64PublicationToMavenLocal" } + - { os: macos-13, publishTask: "publishIosArm64PublicationToMavenLocal publishIosSimulatorArm64PublicationToMavenLocal publishIosX64PublicationToMavenLocal" } + - { os: macos-13, publishTask: "publishWatchosArm64PublicationToMavenLocal publishWatchosArm32PublicationToMavenLocal publishWatchosDeviceArm64PublicationToMavenLocal publishWatchosSimulatorArm64PublicationToMavenLocal" } timeout-minutes: 300 runs-on: ${{ matrix.os }} ##needs: [start] diff --git a/.github/workflows/TEST.yml b/.github/workflows/TEST.yml index 56feda5..fe29ffa 100644 --- a/.github/workflows/TEST.yml +++ b/.github/workflows/TEST.yml @@ -4,8 +4,20 @@ name: TEST on: push: branches: [ main, 'release/**' ] + paths: + - '**' + - '!**.gitignore' + - '!**.md' + - '!**.github/workflows/*' + - '**.github/workflows/TEST.yml' pull_request: branches: [ main, 'release/**' ] + paths: + - '**' + - '!**.gitignore' + - '!**.md' + - '!**.github/workflows/*' + - '**.github/workflows/TEST.yml' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -23,16 +35,10 @@ jobs: fail-fast: true # Once working, comment this matrix: include: - - { outputKey: testWindows, os: windows-latest, testTask: mingwX64Test, enableKotlinNative: true } - - { outputKey: testLinux, os: ubuntu-latest, testTask: linuxX64Test, buildTasks: publishLinuxArm64PublicationToMavenLocal, enableKotlinNative: true } - - { outputKey: testMacos, os: macos-latest, testTask: macosX64Test, buildTasks: publishMacosArm64PublicationToMavenLocal, enableKotlinNative: true } - - { outputKey: testIos, os: macos-latest, testTask: iosX64Test, enableKotlinNative: true } - #- { outputKey: testJs, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsNodeTest jsBrowserTest" } - - { outputKey: testJs, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsBrowserTest jsDenoTest" } - - { outputKey: testAndroid, os: ubuntu-latest, enableAndroid: true } - - { outputKey: testJvmMacos, os: macos-latest, testTask: jvmTest apiCheck } - - { outputKey: testJvmLinux, os: ubuntu-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm, enableKotlinNative: true, enableSandbox: true, e2e: true } - - { outputKey: testJvmWindows, os: windows-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm } + - { outputKey: testMacosIos, os: macos-13, testTask: jvmTest macosX64Test iosX64Test, buildTasks: publishMacosArm64PublicationToMavenLocal } + - { outputKey: testJsAndroid, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsBrowserTest jsDenoTest", enableAndroid: true } + - { outputKey: testLinux, os: ubuntu-latest, testTask: apiCheck jvmTest linuxX64Test, precompileTask: compileTestKotlinJvm, e2e: true } + - { outputKey: testWindows, os: windows-latest, testTask: jvmTest mingwX64Test jsDenoTest, precompileTask: compileTestKotlinJvm, enableCodecov: true } #if: ${{ needs.changes.outputs[matrix.outputKey] == 'true' }} timeout-minutes: 30 runs-on: ${{ matrix.os }} @@ -44,15 +50,17 @@ jobs: - { name: Set up JDK, uses: actions/setup-java@v4, with: { distribution: "${{ env.JAVA_DISTRIBUTION }}", java-version: "${{ env.JAVA_VERSION }}" } } - { name: Prepare Gradle, uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 } # https://github.com/gradle/actions/releases/tag/v3.5.0 - { name: Start gradle, run: ./gradlew } - - { if: "${{ matrix.precompileTask }}", name: "Building ${{ matrix.precompileTask }} classes", run: "./gradlew --no-configuration-cache --stacktrace ${{ matrix.precompileTask }}" } - - { if: "${{ matrix.testTask }}", name: "Run ${{ matrix.testTask }} tests", run: "./gradlew --no-configuration-cache ${{ matrix.testTask }}" } - - { if: "${{ matrix.buildTasks }}", name: "Run ${{ matrix.buildTasks }}", run: "./gradlew --no-configuration-cache ${{ matrix.buildTasks }}" } + - { if: "${{ matrix.precompileTask }}", name: "Building ${{ matrix.precompileTask }} classes", run: "./gradlew --no-configuration-cache --stacktrace --build-cache ${{ matrix.precompileTask }}" } + - { if: "${{ matrix.enableCodecov }}", name: "Upload coverage reports to Codecov", uses: "codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673", with: { token: "${{ secrets.CODECOV_TOKEN }}" } } # https://github.com/codecov/codecov-action/releases/tag/v4.5.0 + - { if: "${{ matrix.testTask }}", name: "Run ${{ matrix.testTask }} tests", run: "./gradlew --no-configuration-cache --build-cache ${{ matrix.testTask }}" } + - { if: "${{ matrix.buildTasks }}", name: "Run ${{ matrix.buildTasks }}", run: "./gradlew --no-configuration-cache --build-cache ${{ matrix.buildTasks }}" } - name: Enable KVM if: "${{ matrix.enableAndroid }}" run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - { name: "Run Android Tests", if: "${{ matrix.enableAndroid }}", uses: reactivecircus/android-emulator-runner@v2, with: { "api-level": 21, "script": "./gradlew --no-configuration-cache connectedCheck lintDebug" } } + - { name: "Run Android Tests", if: "${{ matrix.enableAndroid }}", uses: reactivecircus/android-emulator-runner@v2, with: { "api-level": 21, "script": "./gradlew --no-configuration-cache --build-cache connectedCheck lintDebug" } } - { name: Archive Test Results, if: failure(), uses: actions/upload-artifact@v4, with: { name: "test-results-${{ matrix.outputKey }}", retention-days: 21, path: "**/build/reports", if-no-files-found: ignore } } - - { if: "${{ matrix.e2e }}", name: Publish to maven local, run: ./gradlew --no-configuration-cache publishJvmLocal publishKotlinMultiplatformPublicationToMavenLocal } + - { if: "${{ matrix.e2e }}", name: Publish to maven local, run: ./gradlew --no-configuration-cache --build-cache publishJvmLocal publishKotlinMultiplatformPublicationToMavenLocal } + - { name: Code coverage, run: ./gradlew --build-cache koverXmlReport } diff --git a/build.gradle.kts b/build.gradle.kts index 2a1b898..f0d6f84 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,10 +34,10 @@ var REAL_VERSION = System.getenv("FORCED_VERSION") //val REAL_VERSION = System.getenv("FORCED_VERSION") ?: "999.0.0.999" -//val JVM_TARGET = JvmTarget.JVM_1_8 -//val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_1_8 -val JVM_TARGET = JvmTarget.JVM_11 -val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_11 +val JVM_TARGET = JvmTarget.JVM_1_8 +val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_1_8 +//val JVM_TARGET = JvmTarget.JVM_11 +//val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_11 val GROUP = "com.soywiz" kotlin {