From a2fbe992bd003b9e51206d73eb41f12425bcc985 Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 08:49:50 +0800 Subject: [PATCH 1/8] ci: add github actions --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..6f5e5203 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,72 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +env: + JAVA_VERSION: 22 + JAVA_DISTRO: 'temurin' + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0 + + - name: Set up JDK + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRO }} + + - name: Build ${{ matrix.os }} + run: ./gradlew assemble + + - name: Compile Linux Test + if: startsWith(matrix.os, 'ubuntu') + run: | + ./gradlew linkDebugTestLinuxX64 linkDebugTestMingwX64 compileTestDevelopmentExecutableKotlinJs compileTestDevelopmentExecutableKotlinWasmJs + + - name: Run Linux Test + if: startsWith(matrix.os, 'ubuntu') + run: | + ./gradlew check --continue -x jsBrowserTest -x wasmJsBrowserTest + + - name: Run Linux Browser Tests + if: startsWith(matrix.os, 'ubuntu') + run: ./gradlew jsBrowserTest -x wasmJsBrowserTest + + - name: Run MacOS Test + if: startsWith(matrix.os, 'macos') + run: ./gradlew checkApple --continue + + # publish: + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # runs-on: ubuntu-latest + # needs: build + # steps: + # - name: Checkout code + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + # - name: Set up JDK + # uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + # with: + # java-version: ${{ env.JAVA_VERSION }} + # distribution: ${{ env.JAVA_DISTRO }} + + \ No newline at end of file From b9c06f299fe8ca58dafb24f40851a31a13d0cee1 Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:03:10 +0800 Subject: [PATCH 2/8] ci: add steps to upload test results for Linux and MacOS --- .github/workflows/build.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f5e5203..8ffbdd37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,24 @@ jobs: if: startsWith(matrix.os, 'macos') run: ./gradlew checkApple --continue + - name: Upload Linux test results + if: always() && startsWith(matrix.os, 'ubuntu') + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: test-results-linux-publish + path: | + build/test-results + build/reports + + - name: Upload MacOS test results + if: always() && startsWith(matrix.os, 'macos') + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: test-results-macos-publish + path: | + build/test-results + build/reports + # publish: # if: github.event_name == 'push' && github.ref == 'refs/heads/main' # runs-on: ubuntu-latest From 909e078b9ff6da71bb5db9ef32059eafbcbe9bdd Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:05:52 +0800 Subject: [PATCH 3/8] chore: remove commented-out publish steps for Linux and MacOS --- .github/workflows/build.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ffbdd37..dd8583ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,18 +73,12 @@ jobs: build/test-results build/reports - # publish: - # if: github.event_name == 'push' && github.ref == 'refs/heads/main' - # runs-on: ubuntu-latest - # needs: build - # steps: - # - name: Checkout code - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - # - name: Set up JDK - # uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 - # with: - # java-version: ${{ env.JAVA_VERSION }} - # distribution: ${{ env.JAVA_DISTRO }} - - \ No newline at end of file + # - name: Publish Linux + # if: startsWith(matrix.os, 'ubuntu') && github.event_name == 'push' && github.ref == 'refs/heads/main' + # run: | + # ./gradlew publishLinux + + # - name: Publish MacOS + # if: startsWith(matrix.os, 'macos') && github.event_name == 'push' && github.ref == 'refs/heads/main' + # run: | + # ./gradlew publishMacos \ No newline at end of file From 4757eff4b4a7db49e34c9f7ae6d29777c1a72137 Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:16:43 +0800 Subject: [PATCH 4/8] ci: add GitHub Actions workflow for code checks --- .github/workflows/check.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 00000000..cd629305 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,31 @@ +name: Check + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +env: + JAVA_VERSION: 22 + JAVA_DISTRO: 'temurin' + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0 + + - name: Set up JDK + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRO }} + + - name: Check code + run: ./gradlew detekt \ No newline at end of file From cf476325566ac1dd3429df9d76feb2248156004e Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:18:52 +0800 Subject: [PATCH 5/8] chore: update paths-ignore in workflows to exclude .gitignore and .md files --- .github/workflows/build.yml | 6 ++++++ .github/workflows/check.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd8583ba..82b6c69b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,13 @@ on: push: branches: - main + paths-ignore: + - '**/.gitignore' + - '**.md' pull_request: + paths-ignore: + - '**/.gitignore' + - '**.md' workflow_dispatch: env: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cd629305..c97e64e5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,7 +4,13 @@ on: push: branches: - main + paths-ignore: + - '**/.gitignore' + - '**.md' pull_request: + paths-ignore: + - '**/.gitignore' + - '**.md' workflow_dispatch: env: From fcfc5853fbd9415b7b99336f2dc55dd0f3782e83 Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:30:37 +0800 Subject: [PATCH 6/8] chore(deps): add gradle/setup-gradle v4.4.0 in workflows --- .github/workflows/build.yml | 3 +++ .github/workflows/check.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82b6c69b..45e89936 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,9 @@ jobs: with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRO }} + + - name: Set up gradle + uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0 - name: Build ${{ matrix.os }} run: ./gradlew assemble diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c97e64e5..74ea43d4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -32,6 +32,9 @@ jobs: with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRO }} + + - name: Set up gradle + uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0 - name: Check code run: ./gradlew detekt \ No newline at end of file From a703fc275b78099e7ede12113ec734bf3751e642 Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:34:35 +0800 Subject: [PATCH 7/8] ci: add fail-fast strategy to build job --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45e89936..1202b5e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ concurrency: jobs: build: strategy: + fail-fast: false matrix: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} From 9d78bc2c4d85b3832a407d94dae144210791f6ec Mon Sep 17 00:00:00 2001 From: arthur <16458204+ArthurKun021@users.noreply.github.com> Date: Wed, 21 May 2025 09:36:06 +0800 Subject: [PATCH 8/8] chore: consolidate test result uploads for Linux and MacOS --- .github/workflows/build.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1202b5e0..ae313fc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,20 +65,11 @@ jobs: if: startsWith(matrix.os, 'macos') run: ./gradlew checkApple --continue - - name: Upload Linux test results - if: always() && startsWith(matrix.os, 'ubuntu') + - name: Upload test results + if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: test-results-linux-publish - path: | - build/test-results - build/reports - - - name: Upload MacOS test results - if: always() && startsWith(matrix.os, 'macos') - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: test-results-macos-publish + name: test-results-${{ matrix.os }}-publish path: | build/test-results build/reports