From 08954f4b00083793a812ad88afd5f5febdd55821 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Sun, 1 Jan 2023 15:27:52 +0100 Subject: [PATCH 1/2] test the site still builds on PRs, and cache NPM, and minor Gradle cleanups --- .github/workflows/deploy-site.yml | 6 +++ .github/workflows/gradle_task.yml | 54 ++++++++++--------- .github/workflows/tests.yml | 6 +++ .../buildsrc/convention/kotlin-mpp.gradle.kts | 3 -- settings.gradle.kts | 1 + 5 files changed, 43 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 0c442580..03bc1543 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -31,6 +31,12 @@ jobs: with: gradle-home-cache-cleanup: true + - name: Cache NPM + uses: actions/cache@v3 + with: + path: | + ./site/node_modules + - name: docusaurus build run: ./gradlew docusaurusBuild diff --git a/.github/workflows/gradle_task.yml b/.github/workflows/gradle_task.yml index 64e72100..ab8504ce 100644 --- a/.github/workflows/gradle_task.yml +++ b/.github/workflows/gradle_task.yml @@ -35,27 +35,33 @@ jobs: name: "./gradlew ${{ inputs.gradle-task}} @ ${{ inputs.runs-on }}" timeout-minutes: 60 steps: - - name: Checkout the repo - uses: actions/checkout@v3 - - - name: Setup JDK - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 11 - - - uses: gradle/gradle-build-action@v2 - with: - gradle-home-cache-cleanup: true - - - name: Run ${{ inputs.gradle-task }} - run: >- - ./gradlew ${{ inputs.gradle-task }} - - - name: Upload build reports - if: failure() - uses: actions/upload-artifact@v3 - with: - name: build-report-${{ runner.os }}-${{ github.action }} - path: "**/build/reports/" - if-no-files-found: ignore + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + + - uses: gradle/gradle-build-action@v2 + with: + gradle-home-cache-cleanup: true + + - name: Cache NPM + uses: actions/cache@v3 + with: + path: | + ./site/node_modules + + - name: Run ${{ inputs.gradle-task }} + run: >- + ./gradlew ${{ inputs.gradle-task }} + + - name: Upload build reports + if: failure() + uses: actions/upload-artifact@v3 + with: + name: build-report-${{ runner.os }}-${{ github.action }} + path: "**/build/reports/" + if-no-files-found: ignore diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 804abbd2..6013ecde 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,3 +29,9 @@ jobs: runs-on: ${{ matrix.os }} gradle-task: >- check -Pkxstsgen_enableTsCompileTests=true --stacktrace + + build-site: + uses: ./.github/workflows/gradle_task.yml + with: + runs-on: ubuntu-latest + gradle-task: docusaurusBuild diff --git a/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts b/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts index c6bb6531..34c3864b 100644 --- a/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts +++ b/buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts @@ -2,7 +2,6 @@ package buildsrc.convention import buildsrc.config.relocateKotlinJsStore import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget @@ -23,8 +22,6 @@ extensions.configure { languageVersion = "1.7" apiVersion = "1.7" } - if (this is KotlinJvmCompilation) { - } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 2c1b20ed..149b0312 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,6 +12,7 @@ include( ) enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") +enableFeaturePreview("STABLE_CONFIGURATION_CACHE") dependencyResolutionManagement { @Suppress("UnstableApiUsage") // Central declaration of repositories is an incubating feature From 688eb8b0082f849710320b007147ba5ff35b0421 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Sun, 1 Jan 2023 15:33:16 +0100 Subject: [PATCH 2/2] fix cache npm key --- .github/workflows/deploy-site.yml | 7 +++++++ .github/workflows/gradle_task.yml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 03bc1543..ba18c8b4 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -33,9 +33,16 @@ jobs: - name: Cache NPM uses: actions/cache@v3 + env: + cache-name: cache-npm with: + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} path: | ./site/node_modules + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - name: docusaurus build run: ./gradlew docusaurusBuild diff --git a/.github/workflows/gradle_task.yml b/.github/workflows/gradle_task.yml index ab8504ce..e799f7e8 100644 --- a/.github/workflows/gradle_task.yml +++ b/.github/workflows/gradle_task.yml @@ -50,9 +50,16 @@ jobs: - name: Cache NPM uses: actions/cache@v3 + env: + cache-name: cache-npm with: + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} path: | ./site/node_modules + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - name: Run ${{ inputs.gradle-task }} run: >-