From d1e143f70bec341ad58ee9be251897e6e0fde8de Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Thu, 27 Feb 2025 14:38:58 -0800 Subject: [PATCH 1/2] ci(action): add caching for react-native on ci --- .github/workflows/callable-e2e-test-detox.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/callable-e2e-test-detox.yml b/.github/workflows/callable-e2e-test-detox.yml index ffea13efb6a..b5537c971b0 100644 --- a/.github/workflows/callable-e2e-test-detox.yml +++ b/.github/workflows/callable-e2e-test-detox.yml @@ -37,13 +37,29 @@ jobs: GH_TOKEN_STAGING_READ: ${{ secrets.GH_TOKEN_STAGING_READ }} - name: Load Verdaccio with AmplifyJs uses: ./amplify-js/.github/actions/load-verdaccio-with-amplify-js + - name: Get AmplifyJS native modules package bump + working-directory: ./amplify-js/ + run: | + npx lerna version --conventional-commits --no-git-tag-version --no-push --json --yes | \ + jq -c '[ .[] | select(.name | IN("@aws-amplify/react-native", "@aws-amplify/rtn-push-notification", "@aws-amplify/rtn-web-browser")) | {name, newVersion} ]' \ + > ${{ github.workspace }}/amplify_native_pkg_versions.json + - name: Cache All Dependencies + id: cache_paths + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + path: | + ${{ inputs.working_directory }}/ios/Pods + ${{ inputs.working_directory }}/ios/build + key: ${{ inputs.test_name }}-detox-cache-${{ hashFiles(format('{0}/yarn.lock', inputs.working_directory), format('{0}/ios/Podfile.lock', inputs.working_directory), format('{0}/amplify_native_pkg_versions.json', github.workspace)) }} - name: Yarn Install working-directory: ${{ inputs.working_directory }} run: | + rm -rf yarn.lock echo "Current NPM registry: " $(yarn config get registry) - $GITHUB_WORKSPACE/amplify-js/scripts/retry-yarn-script.sh -s 'install --frozen-lockfile --non-interactive' -n 3 + $GITHUB_WORKSPACE/amplify-js/scripts/retry-yarn-script.sh -s 'install --non-interactive' -n 3 shell: bash - name: Install CocoaPods + if: steps.cache_paths.outputs.cache-hit != 'true' run: | cd ios && pod install working-directory: ${{ inputs.working_directory }} @@ -67,6 +83,7 @@ jobs: working-directory: ${{ inputs.working_directory }} shell: bash - name: Detox Build + if: steps.cache_paths.outputs.cache-hit != 'true' run: | detox build -c ios.sim.debug env: From 13c17345d0e29dc84ff82c91b31f49aec1ff01ab Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Thu, 27 Feb 2025 15:09:27 -0800 Subject: [PATCH 2/2] fix gh actions test --- .github/workflows/callable-e2e-test-detox.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/callable-e2e-test-detox.yml b/.github/workflows/callable-e2e-test-detox.yml index b5537c971b0..b564268439a 100644 --- a/.github/workflows/callable-e2e-test-detox.yml +++ b/.github/workflows/callable-e2e-test-detox.yml @@ -38,11 +38,13 @@ jobs: - name: Load Verdaccio with AmplifyJs uses: ./amplify-js/.github/actions/load-verdaccio-with-amplify-js - name: Get AmplifyJS native modules package bump + env: + GH_WORKSPACE: ${{ github.workspace }} working-directory: ./amplify-js/ run: | npx lerna version --conventional-commits --no-git-tag-version --no-push --json --yes | \ jq -c '[ .[] | select(.name | IN("@aws-amplify/react-native", "@aws-amplify/rtn-push-notification", "@aws-amplify/rtn-web-browser")) | {name, newVersion} ]' \ - > ${{ github.workspace }}/amplify_native_pkg_versions.json + > $GH_WORKSPACE/amplify_native_pkg_versions.json - name: Cache All Dependencies id: cache_paths uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1