From 44ec610cf5508047d1832e4d9d8a35b066b9ba77 Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 5 Dec 2024 15:09:11 +0100 Subject: [PATCH 01/21] chore: upload mapping file to s3 --- .github/actions/deploy-to-s3/action.yml | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 1847a65456c..660c32e6731 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -64,3 +64,32 @@ runs: GITHUB_TOKEN: ${{ inputs.github-token }} run: | gh pr comment "${{ github.event.pull_request.number }}" --body "Built [wire-android-${{ inputs.build-flavour }}-${{ inputs.build-variant }}-pr-${{ github.event.pull_request.number }}.apk](${{ steps.upload.outputs.file-url }}) is available for download" + - name: Generate version file + if: github.event.pull_request.number != '' + shell: bash + run: ./gradlew generateVersionFile + - name: Rename mapping file + if: github.event.pull_request.number != '' + shell: bash + id: mapping + run: | + version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') + version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') + mapping_full_path="app/build/outputs/mapping${{ inputs.build-flavour }}/${{ inputs.build-variant }}/mapping.txt" + new_mapping_file_name="mapping-$version_name-$version_code.txt" + mv "$mapping_full_path" "$new_mapping_file_name" + # Set the new mapping file name as an environment variable + echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV + - name: Upload mapping file to S3 from branch + if: github.event.pull_request.number != '' + id: upload-from-branch + uses: hkusu/s3-upload-action@v2.1.0 + with: + aws-access-key-id: ${{ inputs.aws-access-key-id }} + aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + aws-region: 'eu-central-1' + aws-bucket: ${{ inputs.aws-bucket }} + destination-dir: "megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/" + file-path: ${{ env.new_mapping_file_name }} + output-file-url: 'true' + public: true From f3d62b212d5a8ffeb15cabb8cf7184f26a15c722 Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 5 Dec 2024 16:01:03 +0100 Subject: [PATCH 02/21] chore: upload mapping file to s3 --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 660c32e6731..54977e4e15a 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -82,7 +82,7 @@ runs: echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV - name: Upload mapping file to S3 from branch if: github.event.pull_request.number != '' - id: upload-from-branch + id: upload-mapping-from-branch uses: hkusu/s3-upload-action@v2.1.0 with: aws-access-key-id: ${{ inputs.aws-access-key-id }} From 6cff69b29a90f1bc7ff86c55133ab243d29ef48e Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 5 Dec 2024 16:55:01 +0100 Subject: [PATCH 03/21] chore: upload mapping file to s3 --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 54977e4e15a..99445efadeb 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -75,7 +75,7 @@ runs: run: | version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') - mapping_full_path="app/build/outputs/mapping${{ inputs.build-flavour }}/${{ inputs.build-variant }}/mapping.txt" + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/mapping.txt" new_mapping_file_name="mapping-$version_name-$version_code.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable From e0ec0146daf40c685469c8ea405ec1b1dfc9eaa8 Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 5 Dec 2024 18:15:38 +0100 Subject: [PATCH 04/21] chore: fix path --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 99445efadeb..95516844221 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -75,7 +75,7 @@ runs: run: | version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') - mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/mapping.txt" + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${{ inputs.build-variant^ }}/mapping.txt" new_mapping_file_name="mapping-$version_name-$version_code.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable From 4e15baf07d83e935c792587b62bbb62d10a87861 Mon Sep 17 00:00:00 2001 From: ohassine Date: Mon, 9 Dec 2024 09:28:40 +0100 Subject: [PATCH 05/21] chore: capitalized variant --- .github/actions/deploy-to-s3/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 95516844221..c4bb68c5455 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -75,7 +75,8 @@ runs: run: | version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') - mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${{ inputs.build-variant^ }}/mapping.txt" + capitalized_variant=$(echo "$build_variant" | awk '{print toupper($0)}') + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${{ capitalized_variant }}/mapping.txt" new_mapping_file_name="mapping-$version_name-$version_code.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable From fbf7359bbe38d54e731e42cb597848074524f955 Mon Sep 17 00:00:00 2001 From: ohassine Date: Mon, 9 Dec 2024 10:39:45 +0100 Subject: [PATCH 06/21] chore: capitalized variant --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index c4bb68c5455..66b439d1164 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -76,7 +76,7 @@ runs: version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') capitalized_variant=$(echo "$build_variant" | awk '{print toupper($0)}') - mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${{ capitalized_variant }}/mapping.txt" + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" new_mapping_file_name="mapping-$version_name-$version_code.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable From ffb4e5f4d505bfd6642e2b6f707807b8f6ba751c Mon Sep 17 00:00:00 2001 From: ohassine Date: Mon, 9 Dec 2024 12:05:50 +0100 Subject: [PATCH 07/21] chore: fix path --- .github/actions/deploy-to-s3/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 66b439d1164..43761236656 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -75,8 +75,9 @@ runs: run: | version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') - capitalized_variant=$(echo "$build_variant" | awk '{print toupper($0)}') - mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" + capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper($0)}') + echo "Capitalized Variant: $capitalized_variant" + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}$capitalized_variant/mapping.txt" new_mapping_file_name="mapping-$version_name-$version_code.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable From 998b69008ff82978a731165a4b592f6f88a346fb Mon Sep 17 00:00:00 2001 From: ohassine Date: Mon, 9 Dec 2024 12:52:24 +0100 Subject: [PATCH 08/21] chore: fix path --- .github/actions/deploy-to-s3/action.yml | 2 +- .github/workflows/build-develop-app.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 43761236656..761f24ed50a 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -75,7 +75,7 @@ runs: run: | version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') - capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper($0)}') + capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') echo "Capitalized Variant: $capitalized_variant" mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}$capitalized_variant/mapping.txt" new_mapping_file_name="mapping-$version_name-$version_code.txt" diff --git a/.github/workflows/build-develop-app.yml b/.github/workflows/build-develop-app.yml index 1baea7d9d07..55f446cf72b 100644 --- a/.github/workflows/build-develop-app.yml +++ b/.github/workflows/build-develop-app.yml @@ -16,15 +16,15 @@ concurrency: cancel-in-progress: true jobs: - code-analysis: - uses: ./.github/workflows/code-analysis.yml - ui-tests: - uses: ./.github/workflows/gradle-run-ui-tests.yml - unit-tests: - uses: ./.github/workflows/gradle-run-unit-tests.yml - secrets: inherit +# code-analysis: +# uses: ./.github/workflows/code-analysis.yml +# ui-tests: +# uses: ./.github/workflows/gradle-run-ui-tests.yml +# unit-tests: +# uses: ./.github/workflows/gradle-run-unit-tests.yml +# secrets: inherit build-app: - needs: [ code-analysis, ui-tests, unit-tests ] +# needs: [ code-analysis, ui-tests, unit-tests ] runs-on: ubuntu-latest steps: - name: Checkout From 7c3a686d45eab211cb7f37b457d68c9bbbcc17c5 Mon Sep 17 00:00:00 2001 From: ohassine Date: Mon, 9 Dec 2024 13:36:09 +0100 Subject: [PATCH 09/21] chore: skip debug mapping file --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 761f24ed50a..e7c9b86f983 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -69,7 +69,7 @@ runs: shell: bash run: ./gradlew generateVersionFile - name: Rename mapping file - if: github.event.pull_request.number != '' + if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' shell: bash id: mapping run: | From 76d2ed862f9f7cbcab263adb86c44dbde4a0d176 Mon Sep 17 00:00:00 2001 From: ohassine Date: Mon, 9 Dec 2024 14:48:57 +0100 Subject: [PATCH 10/21] chore: skip debug mapping file --- .github/actions/deploy-to-s3/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index e7c9b86f983..2e2060d65bf 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -78,12 +78,12 @@ runs: capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') echo "Capitalized Variant: $capitalized_variant" mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}$capitalized_variant/mapping.txt" - new_mapping_file_name="mapping-$version_name-$version_code.txt" + new_mapping_file_name="mapping-$capitalized_variant-$version_name-$version_code.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV - name: Upload mapping file to S3 from branch - if: github.event.pull_request.number != '' + if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' id: upload-mapping-from-branch uses: hkusu/s3-upload-action@v2.1.0 with: From dc5daa6d3e2c9aab3b0a60527b1cd62f629ab3e8 Mon Sep 17 00:00:00 2001 From: ohassine Date: Wed, 11 Dec 2024 16:22:31 +0100 Subject: [PATCH 11/21] chore: Extract version and version code from APK filename --- .github/actions/deploy-to-s3/action.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 2e2060d65bf..5b7fcf11c0f 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -64,21 +64,32 @@ runs: GITHUB_TOKEN: ${{ inputs.github-token }} run: | gh pr comment "${{ github.event.pull_request.number }}" --body "Built [wire-android-${{ inputs.build-flavour }}-${{ inputs.build-variant }}-pr-${{ github.event.pull_request.number }}.apk](${{ steps.upload.outputs.file-url }}) is available for download" - - name: Generate version file - if: github.event.pull_request.number != '' + - name: Extract version and version code from APK filename shell: bash - run: ./gradlew generateVersionFile + run: | + # Filename of the APK + filename=${{ steps.path.outputs.apk_full_path }} + + # Extract version (v4.11.0) and version code (50753) + version=$(echo "$filename" | sed -E 's/.*-v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') + version_code=$(echo "$filename" | sed -E 's/.*-([0-9]+)-dev-debug\.apk/\1/') + + # Print the extracted version and version code + echo "Extracted version: v$version" + echo "Extracted version code: $version_code" + + # set them as environment variables for later use + echo "VERSION=v$version" >> $GITHUB_ENV + echo "VERSION_CODE=$version_code" >> $GITHUB_ENV - name: Rename mapping file if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' shell: bash id: mapping run: | - version_code=$(cat app/version.txt | grep 'VersionCode' | sed 's/VersionCode: //') - version_name=$(cat app/version.txt | grep 'VersionName' | sed 's/VersionName: //') capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') echo "Capitalized Variant: $capitalized_variant" mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}$capitalized_variant/mapping.txt" - new_mapping_file_name="mapping-$capitalized_variant-$version_name-$version_code.txt" + new_mapping_file_name="mapping-$capitalized_variant-${{ env.VERSION }}-${{ env.VERSION_CODE }}.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV From bad77abd11750581959dd06def0cb9b8c6ee18a8 Mon Sep 17 00:00:00 2001 From: ohassine Date: Wed, 11 Dec 2024 16:55:38 +0100 Subject: [PATCH 12/21] chore: Extract version and version code from APK filename --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 5b7fcf11c0f..be0a70f80cd 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -72,7 +72,7 @@ runs: # Extract version (v4.11.0) and version code (50753) version=$(echo "$filename" | sed -E 's/.*-v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') - version_code=$(echo "$filename" | sed -E 's/.*-([0-9]+)-dev-debug\.apk/\1/') + version_code=$(echo "$filename" | sed -E 's/.*-([0-9]+)-${{ inputs.build-flavour }}-${{ inputs.build-variant }}\.apk/\1/') # Print the extracted version and version code echo "Extracted version: v$version" From e1c7055efe66a216df57ce9b8b9fb008ca7ff602 Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 12 Dec 2024 13:59:30 +0100 Subject: [PATCH 13/21] chore: fix path --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index be0a70f80cd..dfeec772041 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -88,7 +88,7 @@ runs: run: | capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') echo "Capitalized Variant: $capitalized_variant" - mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}$capitalized_variant/mapping.txt" + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" new_mapping_file_name="mapping-$capitalized_variant-${{ env.VERSION }}-${{ env.VERSION_CODE }}.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable From e54dd05ba52b12bd284e0d941deb27d7d993133d Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 12 Dec 2024 15:02:10 +0100 Subject: [PATCH 14/21] chore: fix path --- .github/actions/deploy-to-s3/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index dfeec772041..9353b6cb6a2 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -70,7 +70,7 @@ runs: # Filename of the APK filename=${{ steps.path.outputs.apk_full_path }} - # Extract version (v4.11.0) and version code (50753) + # Extract version name and version code version=$(echo "$filename" | sed -E 's/.*-v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') version_code=$(echo "$filename" | sed -E 's/.*-([0-9]+)-${{ inputs.build-flavour }}-${{ inputs.build-variant }}\.apk/\1/') @@ -82,7 +82,7 @@ runs: echo "VERSION=v$version" >> $GITHUB_ENV echo "VERSION_CODE=$version_code" >> $GITHUB_ENV - name: Rename mapping file - if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' + if: ${{ inputs.build-variant }} != 'debug' shell: bash id: mapping run: | @@ -94,7 +94,7 @@ runs: # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV - name: Upload mapping file to S3 from branch - if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' + if: ${{ inputs.build-variant }} != 'debug' id: upload-mapping-from-branch uses: hkusu/s3-upload-action@v2.1.0 with: From e23094147c10d97e60bbbcfdb08d670728c5d2d1 Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 12 Dec 2024 15:33:04 +0100 Subject: [PATCH 15/21] chore: debugging --- .github/actions/deploy-to-s3/action.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 9353b6cb6a2..ccc04f06cb2 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -81,8 +81,22 @@ runs: # set them as environment variables for later use echo "VERSION=v$version" >> $GITHUB_ENV echo "VERSION_CODE=$version_code" >> $GITHUB_ENV + - name: Debug GitHub event + shell: bash + run: | + echo "Event name: ${{ github.event_name }}" + echo "Pull Request number: ${{ github.event.pull_request.number }}" + - name: Debug build variant input + shell: bash + run: | + echo "Build variant: '${{ inputs.build-variant }}'" + - name: Test condition + if: ${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} + shell: bash + run: | + echo "This should run only if it's a pull request and the variant is not 'debug'." - name: Rename mapping file - if: ${{ inputs.build-variant }} != 'debug' + if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' shell: bash id: mapping run: | @@ -94,7 +108,7 @@ runs: # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV - name: Upload mapping file to S3 from branch - if: ${{ inputs.build-variant }} != 'debug' + if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' id: upload-mapping-from-branch uses: hkusu/s3-upload-action@v2.1.0 with: From 6fbdc04af089bba727c23cec175d22574e05ab16 Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 12 Dec 2024 16:04:04 +0100 Subject: [PATCH 16/21] chore: debugging --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index ccc04f06cb2..80a9eb7e482 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -96,7 +96,7 @@ runs: run: | echo "This should run only if it's a pull request and the variant is not 'debug'." - name: Rename mapping file - if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' + if: ${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} shell: bash id: mapping run: | From 70ccfc0e56a07f5e0c2addb34a3ecfb622d13a1b Mon Sep 17 00:00:00 2001 From: ohassine Date: Thu, 12 Dec 2024 17:19:04 +0100 Subject: [PATCH 17/21] chore: cleanup --- .github/actions/deploy-to-s3/action.yml | 31 ++++++++++++------------- .github/workflows/build-develop-app.yml | 16 ++++++------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index 80a9eb7e482..b883efc98ac 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -81,22 +81,8 @@ runs: # set them as environment variables for later use echo "VERSION=v$version" >> $GITHUB_ENV echo "VERSION_CODE=$version_code" >> $GITHUB_ENV - - name: Debug GitHub event - shell: bash - run: | - echo "Event name: ${{ github.event_name }}" - echo "Pull Request number: ${{ github.event.pull_request.number }}" - - name: Debug build variant input - shell: bash - run: | - echo "Build variant: '${{ inputs.build-variant }}'" - - name: Test condition - if: ${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} - shell: bash - run: | - echo "This should run only if it's a pull request and the variant is not 'debug'." - name: Rename mapping file - if: ${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} + if: ${{ inputs.build-variant != 'debug' }} shell: bash id: mapping run: | @@ -108,7 +94,7 @@ runs: # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV - name: Upload mapping file to S3 from branch - if: github.event.pull_request.number != '' && ${{ inputs.build-variant }} != 'debug' + if: ${{ github.event.pull_request.number == '' && inputs.build-variant != 'debug' }} id: upload-mapping-from-branch uses: hkusu/s3-upload-action@v2.1.0 with: @@ -120,3 +106,16 @@ runs: file-path: ${{ env.new_mapping_file_name }} output-file-url: 'true' public: true + - name: Upload mapping file to S3 from PR + if: ${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} + id: upload-mapping-from-PR + uses: hkusu/s3-upload-action@v2.1.0 + with: + aws-access-key-id: ${{ inputs.aws-access-key-id }} + aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + aws-region: 'eu-central-1' + aws-bucket: ${{ inputs.aws-bucket }} + destination-dir: "megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/PR-${{ github.event.pull_request.number }}/" + file-path: ${{ env.new_mapping_file_name }} + output-file-url: 'true' + public: true diff --git a/.github/workflows/build-develop-app.yml b/.github/workflows/build-develop-app.yml index 55f446cf72b..1baea7d9d07 100644 --- a/.github/workflows/build-develop-app.yml +++ b/.github/workflows/build-develop-app.yml @@ -16,15 +16,15 @@ concurrency: cancel-in-progress: true jobs: -# code-analysis: -# uses: ./.github/workflows/code-analysis.yml -# ui-tests: -# uses: ./.github/workflows/gradle-run-ui-tests.yml -# unit-tests: -# uses: ./.github/workflows/gradle-run-unit-tests.yml -# secrets: inherit + code-analysis: + uses: ./.github/workflows/code-analysis.yml + ui-tests: + uses: ./.github/workflows/gradle-run-ui-tests.yml + unit-tests: + uses: ./.github/workflows/gradle-run-unit-tests.yml + secrets: inherit build-app: -# needs: [ code-analysis, ui-tests, unit-tests ] + needs: [ code-analysis, ui-tests, unit-tests ] runs-on: ubuntu-latest steps: - name: Checkout From 1051a1af743791fb7267a905bdfdcc6bf2e730bb Mon Sep 17 00:00:00 2001 From: ohassine Date: Fri, 13 Dec 2024 08:52:28 +0100 Subject: [PATCH 18/21] chore: add build flavor --- .github/actions/deploy-to-s3/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index b883efc98ac..dd8e9bc5117 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -89,7 +89,7 @@ runs: capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') echo "Capitalized Variant: $capitalized_variant" mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" - new_mapping_file_name="mapping-$capitalized_variant-${{ env.VERSION }}-${{ env.VERSION_CODE }}.txt" + new_mapping_file_name="mapping-${{ inputs.build-flavour }}-${{ inputs.build-variant }}-${{ env.VERSION }}-${{ env.VERSION_CODE }}.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV From 5ea9241bb5674d4819247aefd70f166428a95cc6 Mon Sep 17 00:00:00 2001 From: ohassine Date: Fri, 13 Dec 2024 09:50:18 +0100 Subject: [PATCH 19/21] chore: cleanup --- .github/actions/deploy-to-s3/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-s3/action.yml b/.github/actions/deploy-to-s3/action.yml index dd8e9bc5117..bae01b71677 100644 --- a/.github/actions/deploy-to-s3/action.yml +++ b/.github/actions/deploy-to-s3/action.yml @@ -67,7 +67,6 @@ runs: - name: Extract version and version code from APK filename shell: bash run: | - # Filename of the APK filename=${{ steps.path.outputs.apk_full_path }} # Extract version name and version code @@ -89,7 +88,7 @@ runs: capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') echo "Capitalized Variant: $capitalized_variant" mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" - new_mapping_file_name="mapping-${{ inputs.build-flavour }}-${{ inputs.build-variant }}-${{ env.VERSION }}-${{ env.VERSION_CODE }}.txt" + new_mapping_file_name="mapping-${{ env.VERSION }}-${{ env.VERSION_CODE }}-${{ inputs.build-flavour }}-${{ inputs.build-variant }}.txt" mv "$mapping_full_path" "$new_mapping_file_name" # Set the new mapping file name as an environment variable echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV From b2db03228dd437bc00dc2435bdb8884ba3e4c6b5 Mon Sep 17 00:00:00 2001 From: ohassine Date: Fri, 13 Dec 2024 12:11:01 +0100 Subject: [PATCH 20/21] chore: kalium reference --- kalium | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kalium b/kalium index 26b7d4b4dcf..5baff8ebe16 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 26b7d4b4dcf2b50b64a3979e6211094a7a5d63d4 +Subproject commit 5baff8ebe160a176b3871d2a059708a894a5f8c2 From 45cb2f7d1448a54ed5ba3421da30d24ce1afbf1f Mon Sep 17 00:00:00 2001 From: ohassine Date: Fri, 13 Dec 2024 17:04:12 +0100 Subject: [PATCH 21/21] chore: kalium reference --- kalium | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kalium b/kalium index 5baff8ebe16..5396afa48e4 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 5baff8ebe160a176b3871d2a059708a894a5f8c2 +Subproject commit 5396afa48e4e3f639cbef60a73329a1294fcb665