Simplify Gradle; bump TeaVM to 0.15.0-dev-5. #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CI for rell-playground. | |
| # | |
| # Three jobs: | |
| # - bridge: compiles the Kotlin/JVM bridge through TeaVM, producing the JS module the SPA | |
| # worker imports. Resolves rell3 artifacts from the upstream GitLab Maven repo | |
| # configured in settings.gradle.kts — no sibling checkout / mavenLocal publish. | |
| # - build: Node/Vite build of the SPA, consuming the bridge JS output. Also runs the | |
| # Vitest survival kit against the bridge. | |
| # - deploy: publishes web/dist/ to GitHub Pages on master. | |
| name: CI | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # One in-flight run per ref; a newer push cancels the older one. | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GRADLE_OPTS: "-Xmx4g -Dorg.gradle.caching=true -Dorg.gradle.parallel=true" | |
| # TeaVM's generateJavaScript runs in a JVM the plugin forks itself (outOfProcess = true), and | |
| # the only knob the plugin exposes on that fork is heap (processMemory → -Xmx). Its dependency | |
| # analysis is deeply recursive and intermittently overflows the JVM's default ~512K-1M thread | |
| # stack — surfacing as `BuildException: java.lang.StackOverflowError`. The recursion depth | |
| # varies run-to-run (hash ordering), so the *same* commit passes one run and fails the next. | |
| # org.gradle.jvmargs can't fix it (that tunes the Gradle daemon, not the fork); the fork is a | |
| # child process that inherits the environment, so JAVA_TOOL_OPTIONS is the only way to enlarge | |
| # its stack from outside the plugin. Set at workflow level so the daemon carries it from its | |
| # first start and every forked TeaVM build inherits it. | |
| JAVA_TOOL_OPTIONS: "-Xss64m" | |
| jobs: | |
| bridge: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Java 21 — TeaVM's tooling requires 21 (its ASM cannot read class files compiled with | |
| # Java 25's bytecode). | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build bridge JS (TeaVM) | |
| uses: ./.github/actions/gradle | |
| with: | |
| arguments: ":bridge:build" | |
| - name: Upload bridge JS | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bridge-js | |
| path: web/public/teavm/ | |
| retention-days: 7 | |
| build: | |
| needs: bridge | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download bridge JS | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bridge-js | |
| path: web/public/teavm/ | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| # node-gradle plugin downloads its pinned Node version into web/build/nodejs, so no | |
| # actions/setup-node step is needed. We just need a JDK to drive Gradle. | |
| - name: Run survival kit (Vitest) | |
| uses: ./.github/actions/gradle | |
| with: | |
| arguments: ":web:vitestRun" | |
| - name: Build SPA | |
| uses: ./.github/actions/gradle | |
| with: | |
| arguments: ":web:assemble" | |
| - name: Upload SPA dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spa-dist | |
| path: web/dist/ | |
| retention-days: 7 | |
| deploy: | |
| needs: build | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Download SPA dist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: spa-dist | |
| path: dist | |
| - uses: actions/configure-pages@v5 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: { path: dist } | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |