Skip to content

Commit

Permalink
testing detox node_modules caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Kumar committed Feb 21, 2025
1 parent 23125c6 commit caa53b8
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 46 deletions.
39 changes: 20 additions & 19 deletions .github/integ-config/detox-integ-all.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
- test_name: 'integ_rn_ios_storage'
working_directory: amplify-js-samples-staging/samples/react-native/storage/StorageApp
timeout_minutes: 120
- test_name: 'integ_rn_ios_storage_multipart_progress'
working_directory: amplify-js-samples-staging/samples/react-native/storage/MultiPartUploadWithProgress
timeout_minutes: 120
- test_name: 'integ_rn_ios_device_tracking'
working_directory: amplify-js-samples-staging/samples/react-native/auth/deviceTracking
timeout_minutes: 120
- test_name: 'integ_rn_ios_datastore_sqlite_adapter'
working_directory: amplify-js-samples-staging/samples/react-native/datastore/SQLiteAdapter
timeout_minutes: 120
- test_name: 'integ_rn_ios_api_gen2_rn_72_detox_cli'
working_directory: amplify-js-samples-staging/samples/react-native/api/gen2/ApiGraphQLGen2
timeout_minutes: 120
- test_name: 'integ_rn_ios_api_v6_rn_72_detox_cli'
working_directory: amplify-js-samples-staging/samples/react-native/api/v6/ApiGRAPHQL
timeout_minutes: 120
- test_name: 'integ_rn_ios_oidc_signout'
working_directory: amplify-js-samples-staging/samples/react-native/auth/HosteduiApp
timeout_minutes: 120
host_signout_page: true
# - test_name: 'integ_rn_ios_storage_multipart_progress'
# working_directory: amplify-js-samples-staging/samples/react-native/storage/MultiPartUploadWithProgress
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_device_tracking'
# working_directory: amplify-js-samples-staging/samples/react-native/auth/deviceTracking
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_datastore_sqlite_adapter'
# working_directory: amplify-js-samples-staging/samples/react-native/datastore/SQLiteAdapter
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_api_gen2_rn_72_detox_cli'
# working_directory: amplify-js-samples-staging/samples/react-native/api/gen2/ApiGraphQLGen2
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_api_v6_rn_72_detox_cli'
# working_directory: amplify-js-samples-staging/samples/react-native/api/v6/ApiGRAPHQL
# timeout_minutes: 120
# - test_name: 'integ_rn_ios_oidc_signout'
# working_directory: amplify-js-samples-staging/samples/react-native/auth/HosteduiApp
# timeout_minutes: 120
# host_signout_page: true

40 changes: 36 additions & 4 deletions .github/workflows/callable-e2e-test-detox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
timeout-minutes: ${{ inputs.timeout_minutes }}

steps:
- name: Start iOS simulator (background)
run: |
xcrun simctl boot "iPhone 15" &
shell: bash
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
Expand All @@ -37,21 +41,38 @@ 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: Cache node_modules
id: modules-cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ./node_modules
key: ${{ inputs.test_name }}-detox-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ inputs.test_name }}-detox-modules-
- name: Yarn Install
if: steps.modules-cache.outputs.cache-hit != 'true'
working-directory: ${{ inputs.working_directory }}
run: |
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
shell: bash

# - name: Cache Pods
# id: pods-cache
# uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# with:
# path: ios/Pods
# key: ${{ inputs.test_name }}-pods-${{ hashFiles('ios/Podfile.lock') }}
# restore-keys: |
# ${{ inputs.test_name }}-pods-
- name: Install CocoaPods
# if: steps.pods-cache.outputs.cache-hit != 'true'
run: |
cd ios && pod install
working-directory: ${{ inputs.working_directory }}
shell: bash
- name: Start iOS simulator (background)
run: |
xcrun simctl boot "iPhone 15" &
shell: bash

- name: Start Metro Packager (background)
run: |
yarn start &
Expand All @@ -66,14 +87,25 @@ jobs:
yarn global add detox-cli
working-directory: ${{ inputs.working_directory }}
shell: bash

# - name: Cache Detox build
# id: detox-build-cache
# uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# with:
# path: ios/build
# key: ${{ inputs.test_name }}-detox-build-${{ hashFiles('yarn.lock', 'ios/Podfile.lock', 'node_modules/.yarn-integrity', 'ios/Pods/Manifest.lock') }}
# restore-keys: |
# ${{ inputs.test_name }}-detox-build-
- name: Detox Build
# if: steps.detox-build-cache.outputs.cache-hit != 'true' || steps.modules-cache.outputs.cache-hit != 'true' || steps.pods-cache.outputs.cache-hit != 'true'
run: |
detox build -c ios.sim.debug
env:
JEST_JUNIT_OUTPUT_DIR: reports/junit
JEST_JUNIT_OUTPUT_NAME: detox-test-results.xml
working-directory: ${{ inputs.working_directory }}
shell: bash

- name: Start the http-server and host the oidc signout page locally (background).
if: ${{ inputs.host_signout_page }}
run: yarn host:signout
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/callable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ jobs:
integ-config-headless: ${{ steps.load_config.outputs.INTEG_CONFIG_HEADLESS }}
detox-integ-config: ${{ steps.load_config.outputs.DETOX_INTEG_CONFIG }}

e2e-test-runner:
name: E2E test runnner
needs: e2e-prep
secrets: inherit
strategy:
matrix:
integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-config) }}
fail-fast: false
uses: ./.github/workflows/callable-e2e-test.yml
with:
test_name: ${{ matrix.integ-config.test_name }}
framework: ${{ matrix.integ-config.framework }}
category: ${{ matrix.integ-config.category }}
spec: ${{ matrix.integ-config.spec || '' }}
amplifyjs_dir: ${{ matrix.integ-config.amplifyjs_dir || false }}
sample_name: ${{ toJSON(matrix.integ-config.sample_name) || '[""]' }}
browser: ${{ toJSON(matrix.integ-config.browser) || '[""]' }}
backend: ${{ matrix.integ-config.backend }}
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
retry_count: ${{ matrix.integ-config.retry_count || 3 }}
yarn_script: ${{ matrix.integ-config.yarn_script || '' }}
yarn_script_args: ${{ matrix.integ-config.yarn_script_args || '15' }}
env: ${{ matrix.integ-config.env && toJSON(matrix.integ-config.env) || '{}' }}
# e2e-test-runner:
# name: E2E test runnner
# needs: e2e-prep
# secrets: inherit
# strategy:
# matrix:
# integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-config) }}
# fail-fast: false
# uses: ./.github/workflows/callable-e2e-test.yml
# with:
# test_name: ${{ matrix.integ-config.test_name }}
# framework: ${{ matrix.integ-config.framework }}
# category: ${{ matrix.integ-config.category }}
# spec: ${{ matrix.integ-config.spec || '' }}
# amplifyjs_dir: ${{ matrix.integ-config.amplifyjs_dir || false }}
# sample_name: ${{ toJSON(matrix.integ-config.sample_name) || '[""]' }}
# browser: ${{ toJSON(matrix.integ-config.browser) || '[""]' }}
# backend: ${{ matrix.integ-config.backend }}
# timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
# retry_count: ${{ matrix.integ-config.retry_count || 3 }}
# yarn_script: ${{ matrix.integ-config.yarn_script || '' }}
# yarn_script_args: ${{ matrix.integ-config.yarn_script_args || 15 }}
# env: ${{ matrix.integ-config.env && toJSON(matrix.integ-config.env) || '{}' }}

# e2e-test-runner-headless:
# name: E2E test runnner_headless
Expand Down

0 comments on commit caa53b8

Please sign in to comment.