From 4dbf6191a8b1d8e462a82708a81cc81521d46ce5 Mon Sep 17 00:00:00 2001 From: ogaclejapan Date: Sun, 8 Sep 2024 09:40:41 +0900 Subject: [PATCH] Update workflow for build job --- .github/ci-gradle.properties | 6 +++ .github/workflows/check-pr.yml | 83 ++++++++++++++++++++++++---------- gradle.properties | 2 +- 3 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 .github/ci-gradle.properties diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.properties new file mode 100644 index 0000000..ea093bd --- /dev/null +++ b/.github/ci-gradle.properties @@ -0,0 +1,6 @@ +# Linux +# - CPU: 4 cores +# - Memory: 16 GB +# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories +# +org.gradle.jvmargs=-Xmx12g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8 diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 6117f2a..02bdbf1 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -2,9 +2,11 @@ name: Check PR on: pull_request: - branches: [ "main" ] + branches: ["main"] paths-ignore: - "docs/**" + - "art/**" + - "*.md" concurrency: group: pull_request-${{ github.ref }} @@ -19,25 +21,60 @@ jobs: contents: write steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - cache-read-only: ${{ github.ref != 'refs/heads/main' }} - - - name: Apply Spotless rules - run: ./gradlew spotlessApply - - - name: Commit newly formatted files - uses: stefanzweifel/git-auto-commit-action@v5 - with: - file_pattern: "**/*.kt **/*.gradle.kts **/*.yml" + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + + - name: Setup java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 17 + + - name: Apply spotless rules + run: ./gradlew spotlessApply + + - name: Commit newly formatted files + uses: stefanzweifel/git-auto-commit-action@v5 + with: + file_pattern: "**/*.kt **/*.gradle.kts **/*.yml" + + build: + strategy: + matrix: + os: [ macos-latest, ubuntu-latest ] + job: [ test ] + + runs-on: ${{ matrix.os }} + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Copy CI gradle.properties + if: matrix.os == 'ubuntu-latest' && matrix.job == 'test' + run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + + - name: Setup java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 17 + + - name: Setup gradle + uses: gradle/actions/setup-gradle@v3 + + # macos-latest + - name: Run tests on macos + if: matrix.os == 'macos-latest' && matrix.job == 'test' + run: ./gradlew iosX64Test + + # ubuntu-latest + - name: Run tests on linux + if: matrix.os == 'ubuntu-latest' && matrix.job == 'test' + run: | + ./gradlew testDebugUnitTest desktopTest wasmJsTest diff --git a/gradle.properties b/gradle.properties index 54f8b28..1cb3436 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ kotlin.code.style=official #Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8 org.gradle.caching=true org.gradle.parallel=true #Android