Skip to content

Commit 97b10eb

Browse files
authored
GHA: test site build (#60)
* test the site still builds on PRs, and cache NPM, and minor Gradle cleanups * fix cache npm key
1 parent 679bbb1 commit 97b10eb

File tree

5 files changed

+57
-27
lines changed

5 files changed

+57
-27
lines changed

.github/workflows/deploy-site.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ jobs:
3131
with:
3232
gradle-home-cache-cleanup: true
3333

34+
- name: Cache NPM
35+
uses: actions/cache@v3
36+
env:
37+
cache-name: cache-npm
38+
with:
39+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
40+
path: |
41+
./site/node_modules
42+
restore-keys: |
43+
${{ runner.os }}-build-${{ env.cache-name }}-
44+
${{ runner.os }}-build-
45+
${{ runner.os }}-
46+
3447
- name: docusaurus build
3548
run: ./gradlew docusaurusBuild
3649

.github/workflows/gradle_task.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,40 @@ jobs:
3535
name: "./gradlew ${{ inputs.gradle-task}} @ ${{ inputs.runs-on }}"
3636
timeout-minutes: 60
3737
steps:
38-
- name: Checkout the repo
39-
uses: actions/checkout@v3
40-
41-
- name: Setup JDK
42-
uses: actions/setup-java@v3
43-
with:
44-
distribution: temurin
45-
java-version: 11
46-
47-
- uses: gradle/gradle-build-action@v2
48-
with:
49-
gradle-home-cache-cleanup: true
50-
51-
- name: Run ${{ inputs.gradle-task }}
52-
run: >-
53-
./gradlew ${{ inputs.gradle-task }}
54-
55-
- name: Upload build reports
56-
if: failure()
57-
uses: actions/upload-artifact@v3
58-
with:
59-
name: build-report-${{ runner.os }}-${{ github.action }}
60-
path: "**/build/reports/"
61-
if-no-files-found: ignore
38+
- name: Checkout the repo
39+
uses: actions/checkout@v3
40+
41+
- name: Setup JDK
42+
uses: actions/setup-java@v3
43+
with:
44+
distribution: temurin
45+
java-version: 11
46+
47+
- uses: gradle/gradle-build-action@v2
48+
with:
49+
gradle-home-cache-cleanup: true
50+
51+
- name: Cache NPM
52+
uses: actions/cache@v3
53+
env:
54+
cache-name: cache-npm
55+
with:
56+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
57+
path: |
58+
./site/node_modules
59+
restore-keys: |
60+
${{ runner.os }}-build-${{ env.cache-name }}-
61+
${{ runner.os }}-build-
62+
${{ runner.os }}-
63+
64+
- name: Run ${{ inputs.gradle-task }}
65+
run: >-
66+
./gradlew ${{ inputs.gradle-task }}
67+
68+
- name: Upload build reports
69+
if: failure()
70+
uses: actions/upload-artifact@v3
71+
with:
72+
name: build-report-${{ runner.os }}-${{ github.action }}
73+
path: "**/build/reports/"
74+
if-no-files-found: ignore

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ jobs:
2929
runs-on: ${{ matrix.os }}
3030
gradle-task: >-
3131
check -Pkxstsgen_enableTsCompileTests=true --stacktrace
32+
33+
build-site:
34+
uses: ./.github/workflows/gradle_task.yml
35+
with:
36+
runs-on: ubuntu-latest
37+
gradle-task: docusaurusBuild

buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package buildsrc.convention
22

33
import buildsrc.config.relocateKotlinJsStore
44
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
5-
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation
65
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
76

87

@@ -23,8 +22,6 @@ extensions.configure<KotlinMultiplatformExtension> {
2322
languageVersion = "1.7"
2423
apiVersion = "1.7"
2524
}
26-
if (this is KotlinJvmCompilation) {
27-
}
2825
}
2926
}
3027

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ include(
1212
)
1313

1414
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
15+
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
1516

1617
dependencyResolutionManagement {
1718
@Suppress("UnstableApiUsage") // Central declaration of repositories is an incubating feature

0 commit comments

Comments
 (0)