From a360f368f7467fe1261c463e1c8b62ae86591e20 Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 16:28:19 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[Feat]:=20Github=20KMP=20Action=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/ios-set-up/action.yml | 18 ++++++ .github/actions/job-set-up/action.yml | 12 ++++ .github/workflows/android-pull-request-ci.yml | 59 ------------------- .github/workflows/build.yml | 39 ++++++++++++ .github/workflows/pull-request-ci.yml | 35 +++++++++++ 5 files changed, 104 insertions(+), 59 deletions(-) create mode 100644 .github/actions/ios-set-up/action.yml create mode 100644 .github/actions/job-set-up/action.yml delete mode 100644 .github/workflows/android-pull-request-ci.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/pull-request-ci.yml diff --git a/.github/actions/ios-set-up/action.yml b/.github/actions/ios-set-up/action.yml new file mode 100644 index 000000000..2ff73b9d5 --- /dev/null +++ b/.github/actions/ios-set-up/action.yml @@ -0,0 +1,18 @@ +name: iOS set up +description: Sets up Kotlin Native and Cocoapods +runs: + using: "composite" + steps: + - shell: bash + run: ./gradlew :shared:generateDummyFramework + + - name: Set up cocoapods + uses: maxim-lobanov/setup-cocoapods@v1 + with: + version: latest + + - shell: bash + name: Install Dependencies + run: | + cd iosApp + pod install --verbose \ No newline at end of file diff --git a/.github/actions/job-set-up/action.yml b/.github/actions/job-set-up/action.yml new file mode 100644 index 000000000..ad2848522 --- /dev/null +++ b/.github/actions/job-set-up/action.yml @@ -0,0 +1,12 @@ +name: Job set up +description: Sets up the Java and Gradle +runs: + using: "composite" + steps: + - uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 \ No newline at end of file diff --git a/.github/workflows/android-pull-request-ci.yml b/.github/workflows/android-pull-request-ci.yml deleted file mode 100644 index dccf54559..000000000 --- a/.github/workflows/android-pull-request-ci.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Android Pull Request CI - -on: - pull_request: - branches: [ main ] - -jobs: - verify: - runs-on: ubuntu-latest - - permissions: - checks: write - - # needed unless run with comment_mode: off - pull-requests: write - - # only needed for private repository - contents: read - - # only needed for private repository - issues: read - - # required by download step to access artifacts API - actions: read - - steps: - - name: Checkout the code - uses: actions/checkout@v3 - - - name: set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'corretto' - java-version: '17' - - - name: set up Android SDK - uses: android-actions/setup-android@v2 - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Run detekt - run: ./gradlew detekt - - - name: Upload Event File - uses: actions/upload-artifact@v4 - with: - name: Event File - path: ${{ github.event_path }} - - - name: Run unit tests - run: ./gradlew testDebugUnitTest --stacktrace - - - name: Upload Test Results - if: always() - uses: actions/upload-artifact@v4 - with: - name: Test Results - path: "**/test-results/**/*.xml" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..722a538d0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build + +on: + workflow_call: + inputs: + shouldRunAndroid: + required: true + type: string + shouldRunIos: + required: true + type: string + +jobs: + Android: + if: ${{ inputs.shouldRunAndroid == 'true' }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Job set up + uses: ./.github/actions/job-set-up + + - run: ./gradlew :androidApp:assemble + + iOS: + if: ${{ inputs.shouldRunIos == 'true' }} + runs-on: macos-12 + + steps: + - uses: actions/checkout@v3 + + - name: Job set up + uses: ./.github/actions/job-set-up + + - name: iOS set up + uses: ./.github/actions/ios-set-up + + - run: xcodebuild build -workspace iosApp/iosApp.xcworkspace -configuration Debug -scheme iosApp -sdk iphoneos -destination name='iPhone 14' -verbose diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml new file mode 100644 index 000000000..cc6baaa54 --- /dev/null +++ b/.github/workflows/pull-request-ci.yml @@ -0,0 +1,35 @@ +name: Android Pull Request CI + +on: + push: + branches: + - develop + pull_request: + branches: + - develop + workflow_dispatch: + inputs: + shouldRunAndroid: + description: 'Run Android build' + required: true + default: 'false' + type: choice + options: + - 'true' + - 'false' + shouldRunIos: + description: 'Run iOS build' + required: true + default: 'false' + type: choice + options: + - 'true' + - 'false' + +jobs: + build: + uses: ./.github/workflows/build.yml + with: + shouldRunKmp: 'true' + shouldRunAndroid: ${{ contains(github.event.pull_request.labels.*.name, 'android') }} + shouldRunIos: ${{ contains(github.event.pull_request.labels.*.name, 'ios') }} From 2a3d368c13eaceb0ac568f6aa4477b65e5514a40 Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 16:37:05 +0900 Subject: [PATCH 02/10] =?UTF-8?q?[Feat]:=20Github=20KMP=20Action=20Common?= =?UTF-8?q?=20=EB=9D=BC=EB=B2=A8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 4 ++-- .github/workflows/pull-request-ci.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 722a538d0..c79a0506a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: jobs: Android: - if: ${{ inputs.shouldRunAndroid == 'true' }} + if: ${{ inputs.shouldRunKmp == 'true' || inputs.shouldRunAndroid == 'true' }} runs-on: ubuntu-latest steps: @@ -24,7 +24,7 @@ jobs: - run: ./gradlew :androidApp:assemble iOS: - if: ${{ inputs.shouldRunIos == 'true' }} + if: ${{ inputs.shouldRunKmp == 'true' || inputs.shouldRunIos == 'true' }} runs-on: macos-12 steps: diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml index cc6baaa54..674a8e0e0 100644 --- a/.github/workflows/pull-request-ci.yml +++ b/.github/workflows/pull-request-ci.yml @@ -30,6 +30,6 @@ jobs: build: uses: ./.github/workflows/build.yml with: - shouldRunKmp: 'true' - shouldRunAndroid: ${{ contains(github.event.pull_request.labels.*.name, 'android') }} - shouldRunIos: ${{ contains(github.event.pull_request.labels.*.name, 'ios') }} + shouldRunKmp: ${{ contains(github.event.pull_request.labels.*.name, 'Common') }} + shouldRunAndroid: ${{ contains(github.event.pull_request.labels.*.name, 'Android') }} + shouldRunIos: ${{ contains(github.event.pull_request.labels.*.name, 'iOS') }} From 179ffe665de4a2d55e92304b342fd731bf27de7d Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 16:56:38 +0900 Subject: [PATCH 03/10] =?UTF-8?q?[Fix]:=20=ED=83=80=EA=B2=9F=20=EB=B8=8C?= =?UTF-8?q?=EB=9E=9C=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull-request-ci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml index 674a8e0e0..368e78bbc 100644 --- a/.github/workflows/pull-request-ci.yml +++ b/.github/workflows/pull-request-ci.yml @@ -1,12 +1,9 @@ -name: Android Pull Request CI +name: Pull Request CI on: - push: - branches: - - develop pull_request: branches: - - develop + - main-kmp workflow_dispatch: inputs: shouldRunAndroid: From 37f495ea13c6424f9c093d7beae2dc35cd40d1b0 Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 16:58:18 +0900 Subject: [PATCH 04/10] =?UTF-8?q?[Fix]:=20input=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c79a0506a..ac6633ab9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,9 @@ name: Build on: workflow_call: inputs: + shouldRunKmp: + required: true + type: string shouldRunAndroid: required: true type: string From 4260fe2573f6ad744005ae48e282d96543f97dbb Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 17:00:01 +0900 Subject: [PATCH 05/10] =?UTF-8?q?[Fix]:=20Screen=20Shot=20Test=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/compare-screenshot-comment.yml | 300 +++++++++--------- .github/workflows/compare-screenshot.yml | 160 +++++----- 2 files changed, 230 insertions(+), 230 deletions(-) diff --git a/.github/workflows/compare-screenshot-comment.yml b/.github/workflows/compare-screenshot-comment.yml index 7d48f4339..c18adbc85 100644 --- a/.github/workflows/compare-screenshot-comment.yml +++ b/.github/workflows/compare-screenshot-comment.yml @@ -1,150 +1,150 @@ -name: Screenshot compare comment - -on: - workflow_run: - workflows: - - CompareScreenshot - types: - - completed - -permissions: { } - -jobs: - Comment-CompareScreenshot: - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - - timeout-minutes: 2 - - permissions: - actions: read # for downloading artifacts - contents: write # for pushing screenshot-diff to companion branch - pull-requests: write # for creating a comment on pull requests - - runs-on: ubuntu-latest - - steps: - - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 - with: - name: pr - run_id: ${{ github.event.workflow_run.id }} - - id: get-pull-request-number - name: Get pull request number - shell: bash - run: | - echo "pull_request_number=$(cat NR)" >> "$GITHUB_OUTPUT" - - name: main checkout - id: checkout-main - uses: actions/checkout@v3 - with: - ref: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event.pull_request.base.ref || github.event.repository.default_branch }} - - id: switch-companion-branch - env: - BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} - run: | - # orphan means it will create no history branch - git branch -D "$BRANCH_NAME" || true - git checkout --orphan "$BRANCH_NAME" - git rm -rf . - - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 - with: - run_id: ${{ github.event.workflow_run.id }} - name: screenshot-diff - path: screenshot-diff - - id: check-if-there-are-valid-files - name: Check if there are valid files - shell: bash - run: | - # Find all the files ending with _compare.png - mapfile -t files_to_add < <(find . -type f -name "*_compare.png") - - # Check for invalid file names and add only valid ones - exist_valid_files="false" - for file in "${files_to_add[@]}"; do - if [[ $file =~ ^[a-zA-Z0-9_./-]+$ ]]; then - exist_valid_files="true" - break - fi - done - echo "exist_valid_files=$exist_valid_files" >> "$GITHUB_OUTPUT" - - id: push-screenshot-diff - shell: bash - if: steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'true' - env: - BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} - run: | - # Find all the files ending with _compare.png - files_to_add=$(find . -type f -name "*_compare.png") - - # Check for invalid file names and add only valid ones - for file in $files_to_add; do - if [[ "$file" =~ ^[a-zA-Z0-9_./-]+$ ]]; then - git add "$file" - fi - done - git config --global user.name ScreenshotBot - git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com - git commit -m "Add screenshot diff" - git push origin HEAD:"$BRANCH_NAME" -f - - id: generate-diff-reports - name: Generate diff reports - if: steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'true' - env: - BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} - shell: bash - run: | - # Find all the files ending with _compare.png in roborazzi folder - files=$(find . -type f -name "*_compare.png" | grep "roborazzi/" | grep -E "^[a-zA-Z0-9_./-]+$") - delimiter="$(openssl rand -hex 8)" - { - echo "reports<<${delimiter}" - - # Create markdown table header - echo "Snapshot diff report vs base branch: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event.pull_request.base.ref || github.event.repository.default_branch }}" - echo "| File name | Image |" - echo "|-------|-------|" - } >> "$GITHUB_OUTPUT" - - # Iterate over the files and create table rows - for file in $files; do - # Get the file name and insert newlines every 20 characters - fileName=$(basename "$file" | sed -r 's/(.{20})/\1
/g') - echo "| [$fileName](https://github.com/${{ github.repository }}/blob/$BRANCH_NAME/$file) | ![](https://github.com/${{ github.repository }}/blob/$BRANCH_NAME/$file?raw=true) |" >> "$GITHUB_OUTPUT" - done - echo "${delimiter}" >> "$GITHUB_OUTPUT" - - name: Find Comment - uses: peter-evans/find-comment@v3 - id: fc - if: steps.generate-diff-reports.outputs.reports != '' - with: - issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }} - comment-author: 'github-actions[bot]' - body-includes: Snapshot diff report - - - name: Add or update comment on PR - uses: peter-evans/create-or-update-comment@v4 - if: steps.generate-diff-reports.outputs.reports != '' - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }} - body: ${{ steps.generate-diff-reports.outputs.reports }} - edit-mode: replace - - - name: Cleanup outdated companion branches - run: | - # Find outdated companion branches with last commit date - git branch -r --format="%(refname:lstrip=3)" | grep companion_ | while read -r branch; do - last_commit_date_timestamp=$(git log -1 --format=%ct "origin/$branch") - now_timestamp=$(date +%s) - # Delete branch if it's older than 1 month - # if [ $((now_timestamp - last_commit_date_timestamp)) -gt 2592000 ]; then - # For testing purpose, delete branch if it's older than 1 second - echo "branch: $branch now_timestamp: $now_timestamp last_commit_date_timestamp: $last_commit_date_timestamp" - if [ $((now_timestamp - last_commit_date_timestamp)) -gt 1 ]; then - # Comment out for demonstration purpose - echo "Deleting $branch" - - # git push origin --delete "$branch" - fi - done +#name: Screenshot compare comment +# +#on: +# workflow_run: +# workflows: +# - CompareScreenshot +# types: +# - completed +# +#permissions: { } +# +#jobs: +# Comment-CompareScreenshot: +# if: > +# github.event.workflow_run.event == 'pull_request' && +# github.event.workflow_run.conclusion == 'success' +# +# timeout-minutes: 2 +# +# permissions: +# actions: read # for downloading artifacts +# contents: write # for pushing screenshot-diff to companion branch +# pull-requests: write # for creating a comment on pull requests +# +# runs-on: ubuntu-latest +# +# steps: +# - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 +# with: +# name: pr +# run_id: ${{ github.event.workflow_run.id }} +# - id: get-pull-request-number +# name: Get pull request number +# shell: bash +# run: | +# echo "pull_request_number=$(cat NR)" >> "$GITHUB_OUTPUT" +# - name: main checkout +# id: checkout-main +# uses: actions/checkout@v3 +# with: +# ref: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event.pull_request.base.ref || github.event.repository.default_branch }} +# - id: switch-companion-branch +# env: +# BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} +# run: | +# # orphan means it will create no history branch +# git branch -D "$BRANCH_NAME" || true +# git checkout --orphan "$BRANCH_NAME" +# git rm -rf . +# - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 +# with: +# run_id: ${{ github.event.workflow_run.id }} +# name: screenshot-diff +# path: screenshot-diff +# - id: check-if-there-are-valid-files +# name: Check if there are valid files +# shell: bash +# run: | +# # Find all the files ending with _compare.png +# mapfile -t files_to_add < <(find . -type f -name "*_compare.png") +# +# # Check for invalid file names and add only valid ones +# exist_valid_files="false" +# for file in "${files_to_add[@]}"; do +# if [[ $file =~ ^[a-zA-Z0-9_./-]+$ ]]; then +# exist_valid_files="true" +# break +# fi +# done +# echo "exist_valid_files=$exist_valid_files" >> "$GITHUB_OUTPUT" +# - id: push-screenshot-diff +# shell: bash +# if: steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'true' +# env: +# BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} +# run: | +# # Find all the files ending with _compare.png +# files_to_add=$(find . -type f -name "*_compare.png") +# +# # Check for invalid file names and add only valid ones +# for file in $files_to_add; do +# if [[ "$file" =~ ^[a-zA-Z0-9_./-]+$ ]]; then +# git add "$file" +# fi +# done +# git config --global user.name ScreenshotBot +# git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com +# git commit -m "Add screenshot diff" +# git push origin HEAD:"$BRANCH_NAME" -f +# - id: generate-diff-reports +# name: Generate diff reports +# if: steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'true' +# env: +# BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} +# shell: bash +# run: | +# # Find all the files ending with _compare.png in roborazzi folder +# files=$(find . -type f -name "*_compare.png" | grep "roborazzi/" | grep -E "^[a-zA-Z0-9_./-]+$") +# delimiter="$(openssl rand -hex 8)" +# { +# echo "reports<<${delimiter}" +# +# # Create markdown table header +# echo "Snapshot diff report vs base branch: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event.pull_request.base.ref || github.event.repository.default_branch }}" +# echo "| File name | Image |" +# echo "|-------|-------|" +# } >> "$GITHUB_OUTPUT" +# +# # Iterate over the files and create table rows +# for file in $files; do +# # Get the file name and insert newlines every 20 characters +# fileName=$(basename "$file" | sed -r 's/(.{20})/\1
/g') +# echo "| [$fileName](https://github.com/${{ github.repository }}/blob/$BRANCH_NAME/$file) | ![](https://github.com/${{ github.repository }}/blob/$BRANCH_NAME/$file?raw=true) |" >> "$GITHUB_OUTPUT" +# done +# echo "${delimiter}" >> "$GITHUB_OUTPUT" +# - name: Find Comment +# uses: peter-evans/find-comment@v3 +# id: fc +# if: steps.generate-diff-reports.outputs.reports != '' +# with: +# issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }} +# comment-author: 'github-actions[bot]' +# body-includes: Snapshot diff report +# +# - name: Add or update comment on PR +# uses: peter-evans/create-or-update-comment@v4 +# if: steps.generate-diff-reports.outputs.reports != '' +# with: +# comment-id: ${{ steps.fc.outputs.comment-id }} +# issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }} +# body: ${{ steps.generate-diff-reports.outputs.reports }} +# edit-mode: replace +# +# - name: Cleanup outdated companion branches +# run: | +# # Find outdated companion branches with last commit date +# git branch -r --format="%(refname:lstrip=3)" | grep companion_ | while read -r branch; do +# last_commit_date_timestamp=$(git log -1 --format=%ct "origin/$branch") +# now_timestamp=$(date +%s) +# # Delete branch if it's older than 1 month +# # if [ $((now_timestamp - last_commit_date_timestamp)) -gt 2592000 ]; then +# # For testing purpose, delete branch if it's older than 1 second +# echo "branch: $branch now_timestamp: $now_timestamp last_commit_date_timestamp: $last_commit_date_timestamp" +# if [ $((now_timestamp - last_commit_date_timestamp)) -gt 1 ]; then +# # Comment out for demonstration purpose +# echo "Deleting $branch" +# +# # git push origin --delete "$branch" +# fi +# done diff --git a/.github/workflows/compare-screenshot.yml b/.github/workflows/compare-screenshot.yml index da1b778f0..d292bd073 100644 --- a/.github/workflows/compare-screenshot.yml +++ b/.github/workflows/compare-screenshot.yml @@ -1,80 +1,80 @@ -name: CompareScreenshot - -on: - push: - branches: - - main - pull_request: - -permissions: { } - -jobs: - compare-screenshot-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - - permissions: - contents: read # for clone - actions: write # for upload-artifact - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Setup Gradle - uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff # v3.3.2 - with: - gradle-version: wrapper - - - - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 - continue-on-error: true - with: - name: screenshot - workflow: store-screenshot.yml - branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }} - - - name: compare screenshot test - id: compare-screenshot-test - run: | - ./gradlew compareRoborazziDebug --stacktrace - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: screenshot-diff - path: | - **/build/outputs/roborazzi - retention-days: 30 - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: screenshot-diff-reports - path: | - **/build/reports - retention-days: 30 - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: screenshot-diff-test-results - path: | - **/build/test-results - retention-days: 30 - - - name: Save PR number - if: ${{ github.event_name == 'pull_request' }} - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > ./pr/NR - - uses: actions/upload-artifact@v4 - with: - name: pr - path: pr/ +#name: CompareScreenshot +# +#on: +# push: +# branches: +# - main +# pull_request: +# +#permissions: { } +# +#jobs: +# compare-screenshot-test: +# runs-on: ubuntu-latest +# timeout-minutes: 20 +# +# permissions: +# contents: read # for clone +# actions: write # for upload-artifact +# +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# +# - name: Set up JDK 17 +# uses: actions/setup-java@v3 +# with: +# distribution: temurin +# java-version: 17 +# +# - name: Setup Gradle +# uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff # v3.3.2 +# with: +# gradle-version: wrapper +# +# +# - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 +# continue-on-error: true +# with: +# name: screenshot +# workflow: store-screenshot.yml +# branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }} +# +# - name: compare screenshot test +# id: compare-screenshot-test +# run: | +# ./gradlew compareRoborazziDebug --stacktrace +# +# - uses: actions/upload-artifact@v4 +# if: ${{ always() }} +# with: +# name: screenshot-diff +# path: | +# **/build/outputs/roborazzi +# retention-days: 30 +# +# - uses: actions/upload-artifact@v4 +# if: ${{ always() }} +# with: +# name: screenshot-diff-reports +# path: | +# **/build/reports +# retention-days: 30 +# +# - uses: actions/upload-artifact@v4 +# if: ${{ always() }} +# with: +# name: screenshot-diff-test-results +# path: | +# **/build/test-results +# retention-days: 30 +# +# - name: Save PR number +# if: ${{ github.event_name == 'pull_request' }} +# run: | +# mkdir -p ./pr +# echo ${{ github.event.number }} > ./pr/NR +# - uses: actions/upload-artifact@v4 +# with: +# name: pr +# path: pr/ From 23dff070f3b59d12753f3237a4c8bc3a6a2ca3aa Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 17:02:45 +0900 Subject: [PATCH 06/10] [Fix]: Update Java Version 17 --- .github/actions/job-set-up/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/job-set-up/action.yml b/.github/actions/job-set-up/action.yml index ad2848522..6ac3b8db7 100644 --- a/.github/actions/job-set-up/action.yml +++ b/.github/actions/job-set-up/action.yml @@ -5,8 +5,8 @@ runs: steps: - uses: actions/setup-java@v3 with: - distribution: "adopt" - java-version: "11" + distribution: "temurin" + java-version: "17" - name: Setup Gradle uses: gradle/gradle-build-action@v2 \ No newline at end of file From 140b1e75dc594726118497072334276646daa655 Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 17:03:38 +0900 Subject: [PATCH 07/10] =?UTF-8?q?[Fix]:=20Screen=20Shot=20Test=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/store-screenshot.yml | 128 ++++++++++++------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/.github/workflows/store-screenshot.yml b/.github/workflows/store-screenshot.yml index 62b5d5a78..b1c2eb251 100644 --- a/.github/workflows/store-screenshot.yml +++ b/.github/workflows/store-screenshot.yml @@ -1,64 +1,64 @@ -name: StoreScreenshot - -on: - push: - branches: - - main - pull_request: - -permissions: {} - -jobs: - store-screenshot-test: - runs-on: ubuntu-latest - timeout-minutes: 20 - - permissions: - contents: read # for clone - actions: write # for upload-artifact - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - # Better than caching and/or extensions of actions/setup-java - - name: Setup Gradle - uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff # v3.3.2 - with: - gradle-version: wrapper - - - name: record screenshot - id: record-test - run: | - # Use --rerun-tasks to disable cache for test task - ./gradlew recordRoborazziDebug --stacktrace --rerun-tasks - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: screenshot - path: | - **/build/outputs/roborazzi - retention-days: 30 - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: screenshot-reports - path: | - **/build/reports - retention-days: 30 - - - uses: actions/upload-artifact@v4 - if: ${{ always() }} - with: - name: screenshot-test-results - path: | - **/build/test-results - retention-days: 30 +#name: StoreScreenshot +# +#on: +# push: +# branches: +# - main +# pull_request: +# +#permissions: {} +# +#jobs: +# store-screenshot-test: +# runs-on: ubuntu-latest +# timeout-minutes: 20 +# +# permissions: +# contents: read # for clone +# actions: write # for upload-artifact +# +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# +# - name: Set up JDK 17 +# uses: actions/setup-java@v3 +# with: +# distribution: temurin +# java-version: 17 +# +# # Better than caching and/or extensions of actions/setup-java +# - name: Setup Gradle +# uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff # v3.3.2 +# with: +# gradle-version: wrapper +# +# - name: record screenshot +# id: record-test +# run: | +# # Use --rerun-tasks to disable cache for test task +# ./gradlew recordRoborazziDebug --stacktrace --rerun-tasks +# +# - uses: actions/upload-artifact@v4 +# if: ${{ always() }} +# with: +# name: screenshot +# path: | +# **/build/outputs/roborazzi +# retention-days: 30 +# +# - uses: actions/upload-artifact@v4 +# if: ${{ always() }} +# with: +# name: screenshot-reports +# path: | +# **/build/reports +# retention-days: 30 +# +# - uses: actions/upload-artifact@v4 +# if: ${{ always() }} +# with: +# name: screenshot-test-results +# path: | +# **/build/test-results +# retention-days: 30 From b15d6a8d1e7e965ab8b6833079ba310c99ac95ea Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 17:16:31 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[Fix]:=20android=20build=20=EB=A5=BC=20?= =?UTF-8?q?=20assembleDebug=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac6633ab9..6851a3767 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: - name: Job set up uses: ./.github/actions/job-set-up - - run: ./gradlew :androidApp:assemble + - run: ./gradlew :app:assembleDebug --stacktrace iOS: if: ${{ inputs.shouldRunKmp == 'true' || inputs.shouldRunIos == 'true' }} From dd9c4d2363d60ccb8a8ff060e3beb9208f5cf2b0 Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 17:19:09 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[Fix]:=20ScreenShot=20Test=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/compare-screenshot-comment.yml | 150 ------------------ .github/workflows/compare-screenshot.yml | 80 ---------- .github/workflows/store-screenshot.yml | 64 -------- 3 files changed, 294 deletions(-) delete mode 100644 .github/workflows/compare-screenshot-comment.yml delete mode 100644 .github/workflows/compare-screenshot.yml delete mode 100644 .github/workflows/store-screenshot.yml diff --git a/.github/workflows/compare-screenshot-comment.yml b/.github/workflows/compare-screenshot-comment.yml deleted file mode 100644 index c18adbc85..000000000 --- a/.github/workflows/compare-screenshot-comment.yml +++ /dev/null @@ -1,150 +0,0 @@ -#name: Screenshot compare comment -# -#on: -# workflow_run: -# workflows: -# - CompareScreenshot -# types: -# - completed -# -#permissions: { } -# -#jobs: -# Comment-CompareScreenshot: -# if: > -# github.event.workflow_run.event == 'pull_request' && -# github.event.workflow_run.conclusion == 'success' -# -# timeout-minutes: 2 -# -# permissions: -# actions: read # for downloading artifacts -# contents: write # for pushing screenshot-diff to companion branch -# pull-requests: write # for creating a comment on pull requests -# -# runs-on: ubuntu-latest -# -# steps: -# - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 -# with: -# name: pr -# run_id: ${{ github.event.workflow_run.id }} -# - id: get-pull-request-number -# name: Get pull request number -# shell: bash -# run: | -# echo "pull_request_number=$(cat NR)" >> "$GITHUB_OUTPUT" -# - name: main checkout -# id: checkout-main -# uses: actions/checkout@v3 -# with: -# ref: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event.pull_request.base.ref || github.event.repository.default_branch }} -# - id: switch-companion-branch -# env: -# BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} -# run: | -# # orphan means it will create no history branch -# git branch -D "$BRANCH_NAME" || true -# git checkout --orphan "$BRANCH_NAME" -# git rm -rf . -# - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 -# with: -# run_id: ${{ github.event.workflow_run.id }} -# name: screenshot-diff -# path: screenshot-diff -# - id: check-if-there-are-valid-files -# name: Check if there are valid files -# shell: bash -# run: | -# # Find all the files ending with _compare.png -# mapfile -t files_to_add < <(find . -type f -name "*_compare.png") -# -# # Check for invalid file names and add only valid ones -# exist_valid_files="false" -# for file in "${files_to_add[@]}"; do -# if [[ $file =~ ^[a-zA-Z0-9_./-]+$ ]]; then -# exist_valid_files="true" -# break -# fi -# done -# echo "exist_valid_files=$exist_valid_files" >> "$GITHUB_OUTPUT" -# - id: push-screenshot-diff -# shell: bash -# if: steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'true' -# env: -# BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} -# run: | -# # Find all the files ending with _compare.png -# files_to_add=$(find . -type f -name "*_compare.png") -# -# # Check for invalid file names and add only valid ones -# for file in $files_to_add; do -# if [[ "$file" =~ ^[a-zA-Z0-9_./-]+$ ]]; then -# git add "$file" -# fi -# done -# git config --global user.name ScreenshotBot -# git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com -# git commit -m "Add screenshot diff" -# git push origin HEAD:"$BRANCH_NAME" -f -# - id: generate-diff-reports -# name: Generate diff reports -# if: steps.check-if-there-are-valid-files.outputs.exist_valid_files == 'true' -# env: -# BRANCH_NAME: companion_${{ github.event.workflow_run.head_branch }} -# shell: bash -# run: | -# # Find all the files ending with _compare.png in roborazzi folder -# files=$(find . -type f -name "*_compare.png" | grep "roborazzi/" | grep -E "^[a-zA-Z0-9_./-]+$") -# delimiter="$(openssl rand -hex 8)" -# { -# echo "reports<<${delimiter}" -# -# # Create markdown table header -# echo "Snapshot diff report vs base branch: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.event.pull_request.base.ref || github.event.repository.default_branch }}" -# echo "| File name | Image |" -# echo "|-------|-------|" -# } >> "$GITHUB_OUTPUT" -# -# # Iterate over the files and create table rows -# for file in $files; do -# # Get the file name and insert newlines every 20 characters -# fileName=$(basename "$file" | sed -r 's/(.{20})/\1
/g') -# echo "| [$fileName](https://github.com/${{ github.repository }}/blob/$BRANCH_NAME/$file) | ![](https://github.com/${{ github.repository }}/blob/$BRANCH_NAME/$file?raw=true) |" >> "$GITHUB_OUTPUT" -# done -# echo "${delimiter}" >> "$GITHUB_OUTPUT" -# - name: Find Comment -# uses: peter-evans/find-comment@v3 -# id: fc -# if: steps.generate-diff-reports.outputs.reports != '' -# with: -# issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }} -# comment-author: 'github-actions[bot]' -# body-includes: Snapshot diff report -# -# - name: Add or update comment on PR -# uses: peter-evans/create-or-update-comment@v4 -# if: steps.generate-diff-reports.outputs.reports != '' -# with: -# comment-id: ${{ steps.fc.outputs.comment-id }} -# issue-number: ${{ steps.get-pull-request-number.outputs.pull_request_number }} -# body: ${{ steps.generate-diff-reports.outputs.reports }} -# edit-mode: replace -# -# - name: Cleanup outdated companion branches -# run: | -# # Find outdated companion branches with last commit date -# git branch -r --format="%(refname:lstrip=3)" | grep companion_ | while read -r branch; do -# last_commit_date_timestamp=$(git log -1 --format=%ct "origin/$branch") -# now_timestamp=$(date +%s) -# # Delete branch if it's older than 1 month -# # if [ $((now_timestamp - last_commit_date_timestamp)) -gt 2592000 ]; then -# # For testing purpose, delete branch if it's older than 1 second -# echo "branch: $branch now_timestamp: $now_timestamp last_commit_date_timestamp: $last_commit_date_timestamp" -# if [ $((now_timestamp - last_commit_date_timestamp)) -gt 1 ]; then -# # Comment out for demonstration purpose -# echo "Deleting $branch" -# -# # git push origin --delete "$branch" -# fi -# done diff --git a/.github/workflows/compare-screenshot.yml b/.github/workflows/compare-screenshot.yml deleted file mode 100644 index d292bd073..000000000 --- a/.github/workflows/compare-screenshot.yml +++ /dev/null @@ -1,80 +0,0 @@ -#name: CompareScreenshot -# -#on: -# push: -# branches: -# - main -# pull_request: -# -#permissions: { } -# -#jobs: -# compare-screenshot-test: -# runs-on: ubuntu-latest -# timeout-minutes: 20 -# -# permissions: -# contents: read # for clone -# actions: write # for upload-artifact -# -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# -# - name: Set up JDK 17 -# uses: actions/setup-java@v3 -# with: -# distribution: temurin -# java-version: 17 -# -# - name: Setup Gradle -# uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff # v3.3.2 -# with: -# gradle-version: wrapper -# -# -# - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 -# continue-on-error: true -# with: -# name: screenshot -# workflow: store-screenshot.yml -# branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }} -# -# - name: compare screenshot test -# id: compare-screenshot-test -# run: | -# ./gradlew compareRoborazziDebug --stacktrace -# -# - uses: actions/upload-artifact@v4 -# if: ${{ always() }} -# with: -# name: screenshot-diff -# path: | -# **/build/outputs/roborazzi -# retention-days: 30 -# -# - uses: actions/upload-artifact@v4 -# if: ${{ always() }} -# with: -# name: screenshot-diff-reports -# path: | -# **/build/reports -# retention-days: 30 -# -# - uses: actions/upload-artifact@v4 -# if: ${{ always() }} -# with: -# name: screenshot-diff-test-results -# path: | -# **/build/test-results -# retention-days: 30 -# -# - name: Save PR number -# if: ${{ github.event_name == 'pull_request' }} -# run: | -# mkdir -p ./pr -# echo ${{ github.event.number }} > ./pr/NR -# - uses: actions/upload-artifact@v4 -# with: -# name: pr -# path: pr/ diff --git a/.github/workflows/store-screenshot.yml b/.github/workflows/store-screenshot.yml deleted file mode 100644 index b1c2eb251..000000000 --- a/.github/workflows/store-screenshot.yml +++ /dev/null @@ -1,64 +0,0 @@ -#name: StoreScreenshot -# -#on: -# push: -# branches: -# - main -# pull_request: -# -#permissions: {} -# -#jobs: -# store-screenshot-test: -# runs-on: ubuntu-latest -# timeout-minutes: 20 -# -# permissions: -# contents: read # for clone -# actions: write # for upload-artifact -# -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# -# - name: Set up JDK 17 -# uses: actions/setup-java@v3 -# with: -# distribution: temurin -# java-version: 17 -# -# # Better than caching and/or extensions of actions/setup-java -# - name: Setup Gradle -# uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff # v3.3.2 -# with: -# gradle-version: wrapper -# -# - name: record screenshot -# id: record-test -# run: | -# # Use --rerun-tasks to disable cache for test task -# ./gradlew recordRoborazziDebug --stacktrace --rerun-tasks -# -# - uses: actions/upload-artifact@v4 -# if: ${{ always() }} -# with: -# name: screenshot -# path: | -# **/build/outputs/roborazzi -# retention-days: 30 -# -# - uses: actions/upload-artifact@v4 -# if: ${{ always() }} -# with: -# name: screenshot-reports -# path: | -# **/build/reports -# retention-days: 30 -# -# - uses: actions/upload-artifact@v4 -# if: ${{ always() }} -# with: -# name: screenshot-test-results -# path: | -# **/build/test-results -# retention-days: 30 From f91c9f5f71d23e0469062f712b9c6d3316ab8299 Mon Sep 17 00:00:00 2001 From: Kez Date: Sun, 9 Mar 2025 17:22:34 +0900 Subject: [PATCH 10/10] =?UTF-8?q?[Fix]:=20runs-on=20macos-latest=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6851a3767..980dc1922 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,10 +28,10 @@ jobs: iOS: if: ${{ inputs.shouldRunKmp == 'true' || inputs.shouldRunIos == 'true' }} - runs-on: macos-12 + runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Job set up uses: ./.github/actions/job-set-up