From 9cf3c227cd75028f83f1d5f1239a5a40f3769a54 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 10:40:28 -0500 Subject: [PATCH 01/39] test: add/fix android e2e test github action --- .github/workflows/e2e-android.yml | 103 ++++++++ dev/Tiltfile | 2 +- dev/vendir.lock.yml | 6 +- dev/vendir.yml | 5 +- dev/vendor/galoy-quickstart/dev/BUCK | 5 + dev/vendor/galoy-quickstart/dev/Tiltfile | 154 +++++++++--- .../apollo-federation/supergraph.graphql | 221 ++++++++++++------ .../galoy-quickstart/dev/config/lnd/lnd.conf | 1 - .../config/notifications/notifications.yml | 2 + .../dev/core-bundle/serve-env.json | 3 +- .../dev/docker-compose.deps.yml | 80 ++++--- .../dev/helpers/gql/api-key-create.gql | 16 ++ .../galoy-quickstart/docker-compose.yml | 39 ++-- .../graphql/gql/acknowledge-notification.gql | 10 + ...notifications-without-bulletin-enabled.gql | 20 ++ .../gql/list-stateful-notifications.gql | 20 ++ ...ul-notifications-with-bulletin-enabled.gql | 19 ++ .../graphql/gql/support-chat-reset.gql | 5 + ...cations-without-bulletin-enabled-count.gql | 6 + .../user-disable-notification-category.gql | 12 - .../gql/user-disable-notification-channel.gql | 12 - .../gql/user-enable-notification-category.gql | 12 - .../gql/user-enable-notification-channel.gql | 12 - .../graphql/schemas/admin/schema.graphql | 102 +++++++- .../graphql/schemas/public/schema.graphql | 11 + 25 files changed, 654 insertions(+), 224 deletions(-) create mode 100644 .github/workflows/e2e-android.yml create mode 100644 dev/vendor/galoy-quickstart/dev/helpers/gql/api-key-create.gql create mode 100644 dev/vendor/galoy-quickstart/graphql/gql/acknowledge-notification.gql create mode 100644 dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications-without-bulletin-enabled.gql create mode 100644 dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications.gql create mode 100644 dev/vendor/galoy-quickstart/graphql/gql/list-unacknowledged-stateful-notifications-with-bulletin-enabled.gql create mode 100644 dev/vendor/galoy-quickstart/graphql/gql/support-chat-reset.gql create mode 100644 dev/vendor/galoy-quickstart/graphql/gql/unacknowledged-stateful-notifications-without-bulletin-enabled-count.gql delete mode 100644 dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-category.gql delete mode 100644 dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-channel.gql delete mode 100644 dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-category.gql delete mode 100644 dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-channel.gql diff --git a/.github/workflows/e2e-android.yml b/.github/workflows/e2e-android.yml new file mode 100644 index 0000000000..800a355c29 --- /dev/null +++ b/.github/workflows/e2e-android.yml @@ -0,0 +1,103 @@ +name: Android E2E Tests + +on: + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + e2e-test: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v14 + + - name: Run the Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v8 + + - name: Install dependencies + run: nix develop -c yarn install + + - name: Build E2E tests + run: nix develop -c yarn e2e:build android.emu.debug + + - name: Start Metro, Tilt, Emulator, and run tests + id: run-tests + run: | + # Create directory for PID files + mkdir -p /tmp/pids + + # Start Metro in background + nix develop -c yarn start & + echo $! > /tmp/pids/metro.pid + + # Start Tilt in background + cd dev && TILT_CI=true nix develop -c tilt up & + echo $! > /tmp/pids/tilt.pid + + # Wait for galoy UI resource to be ready (timeout after 5 minutes) + nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m + + # Start emulator in background + emulator -avd Pixel_API_34 -gpu swiftshader -wipe-data -no-boot-anim -no-window & + echo $! > /tmp/pids/emulator.pid + + # Wait for device to be ready + adb wait-for-device + + # Start screen recording + adb shell screenrecord --bit-rate 4000000 /sdcard/screenRecord.mp4 & + echo $! > /tmp/pids/screenrecord.pid + + # Trigger dev setup and run tests + cd dev && nix develop -c tilt trigger dev-setup + + # Run the E2E tests + nix develop -c yarn e2e:test android.emu.debug -d --take-screenshots all --record-videos all --record-logs all --artifacts-location android-recordings + TEST_EXIT_CODE=$? + + # Pull the screen recording + adb pull /sdcard/screenRecord.mp4 android-recordings/ + + exit $TEST_EXIT_CODE + + - name: Cleanup Processes + if: always() + run: | + # Function to kill process by PID file + kill_process() { + local pidfile=$1 + if [ -f "$pidfile" ]; then + PID=$(cat "$pidfile") + if ps -p $PID > /dev/null; then + echo "Killing process $(basename "$pidfile" .pid) (PID: $PID)" + kill $PID || kill -9 $PID + fi + rm "$pidfile" + fi + } + + # Kill all processes + for pidfile in /tmp/pids/*.pid; do + [ -f "$pidfile" ] && kill_process "$pidfile" + done + + # Additional cleanup commands just to be thorough + pkill -f "node.*metro" || true + pkill -f "tilt" || true + pkill -f "emulator" || true + adb shell pkill -f "screenrecord" || true + + - name: Upload test artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-artifacts + path: | + android-recordings/ + android-recordings/screenRecord.mp4 diff --git a/dev/Tiltfile b/dev/Tiltfile index c321c109cf..5a370207d7 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -18,7 +18,7 @@ local_resource( ) docker_compose('vendor/galoy-quickstart/docker-compose.yml') -galoy_services = ["apollo-router", "galoy", "trigger", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats"] +galoy_services = ["apollo-router", "galoy", "trigger", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats", "notifications", "notifications-pg"] auth_services = ["oathkeeper", "kratos", "kratos-pg", "hydra", "hydra-pg", "hydra-migrate"] bitcoin_services = ["bitcoind", "bitcoind-signer", "lnd1", "lnd-outside-1", "bria", "bria-pg", "fulcrum"] diff --git a/dev/vendir.lock.yml b/dev/vendir.lock.yml index 07b391dd92..69b639b288 100644 --- a/dev/vendir.lock.yml +++ b/dev/vendir.lock.yml @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@e06d6381813012d3abcf129d9eb10e8e7fae7c9cfd9a6857b726a9cbba238f93' - sha: 14743a8178f215f429608615db872ceb3b114bdb + commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@bd56a94ac9142ba771aa6d1e193c449c669bf2706f5de5727ffab7e50460eb4a' + sha: eddc43c797bbb3af3400c22a347b8968972b4c03 tags: - - 0.20.151 + - 0.21.15 path: galoy-quickstart path: vendor kind: LockConfig diff --git a/dev/vendir.yml b/dev/vendir.yml index e9a5071973..6ca86e15a8 100644 --- a/dev/vendir.yml +++ b/dev/vendir.yml @@ -6,8 +6,9 @@ directories: contents: - path: galoy-quickstart git: - url: https://github.com/GaloyMoney/galoy.git - ref: '0.20.151' + url: https://github.com/GaloyMoney/blink.git + ref: "0.21.15" + depth: 1 includePaths: - quickstart/bin/* - quickstart/dev/**/* diff --git a/dev/vendor/galoy-quickstart/dev/BUCK b/dev/vendor/galoy-quickstart/dev/BUCK index 614d6433fe..d9a3465fc8 100644 --- a/dev/vendor/galoy-quickstart/dev/BUCK +++ b/dev/vendor/galoy-quickstart/dev/BUCK @@ -111,3 +111,8 @@ sh_binary( name = "fund-user", main = "bin/fund-user.sh", ) + +sh_binary( + name = "setup-voucher-escrow", + main = "bin/setup-voucher-escrow.sh", +) diff --git a/dev/vendor/galoy-quickstart/dev/Tiltfile b/dev/vendor/galoy-quickstart/dev/Tiltfile index cc63778eb9..2e5fe9fd42 100644 --- a/dev/vendor/galoy-quickstart/dev/Tiltfile +++ b/dev/vendor/galoy-quickstart/dev/Tiltfile @@ -8,6 +8,7 @@ DASHBOARD_TEST_LABEL = "dashboard" PAY_TEST_LABEL = "pay" ADMIN_PANEL_TEST_LABEL = "admin-panel" MAP_TEST_LABEL = "map" +VOUCHER_TEST_LABEL = "voucher" MIGRATE_MONGO_TEST_LABEL = "mongodb-migrate" TEST_RESOURCES = { @@ -17,6 +18,7 @@ TEST_RESOURCES = { PAY_TEST_LABEL: "test-pay", ADMIN_PANEL_TEST_LABEL: "test-admin-panel", MAP_TEST_LABEL: "test-map", + VOUCHER_TEST_LABEL: "test-voucher", MIGRATE_MONGO_TEST_LABEL: "test-mongodb-migrate", } @@ -56,12 +58,16 @@ def merge_env_file(file_path_str, env_vars={}): file_blob = read_file(env_file_path, "") lines = str(file_blob).split('\n') for raw_line in lines: - if raw_line.startswith('#') or raw_line.strip() == '': + line_without_comments = raw_line.strip() + if '#' in raw_line: + line_without_comments = raw_line.split('#')[0].strip() + + if line_without_comments == '': continue - line = raw_line - if raw_line.startswith('export '): - line = raw_line[len('export '):].strip() + line = line_without_comments + if line_without_comments.startswith('export '): + line = line_without_comments[len('export '):].strip() key_value = line.split('=', 1) if len(key_value) == 2: @@ -116,7 +122,8 @@ pay_env = { "NEXT_PUBLIC_CORE_GQL_URL": "http://localhost:4455/graphql", "NEXT_PUBLIC_CORE_GQL_WEB_SOCKET_URL": "ws://localhost:4455/graphqlws", "NEXT_PUBLIC_PAY_DOMAIN": "localhost:3002", - "NEXTAUTH_URL":"http://localhost:3002" + "NEXTAUTH_URL":"http://localhost:3002", + "NEXTAUTH_SECRET":"secret" } local_resource( "pay", @@ -195,7 +202,7 @@ local_resource( readiness_probe = probe( period_secs = 5, http_get = http_get_action( - path = "/", + path = "/api/health", port = 3005, ), ), @@ -210,6 +217,60 @@ local_resource( ], ) +voucher_target = "//apps/voucher:dev" +if is_ci: + voucher_target = '//apps/voucher:voucher' +voucher_env = { + "PORT": "3006", + "NEXTAUTH_URL":"http://localhost:3006", + "NEXTAUTH_SECRET":"secret" +} +local_resource( + "voucher", + labels = ["apps"], + cmd = "buck2 build {}".format(voucher_target), + serve_cmd = ". .envs/voucher.env && buck2 run {}".format(voucher_target), + env = voucher_env, + serve_env = voucher_env, + readiness_probe = probe( + period_secs = 5, + http_get = http_get_action( + path = "/", + port = 3006, + ), + ), + deps = _buck2_dep_inputs(voucher_target), + allow_parallel = True, + resource_deps = [ + "api", + "apollo-router", + "hydra-voucher", + "setup-voucher" + ], + links = [ + link("http://localhost:3006", "voucher"), + ], +) + +local_resource( + name='hydra-voucher', + labels = ['apps'], + cmd=[ + 'buck2', + 'run', + '//dev:setup-hydra-client', + '--', + 'voucher', + 'authorization_code,refresh_token', + 'http://localhost:3006/api/auth/callback/blink', + ], + allow_parallel = True, + resource_deps = [ + "hydra", + "api", + ] +) + local_resource( name='hydra-dashboard', labels = ['apps'], @@ -249,6 +310,26 @@ local_resource( ] ) +local_resource( + name='hydra-consent-test-client', + labels = ['auth'], + cmd=[ + 'buck2', + 'run', + '//dev:setup-hydra-client', + '--', + 'consent-test', + 'authorization_code,refresh_token', + 'http://localhost:3000', + ], + allow_parallel = True, + auto_init = run_apps, + resource_deps = [ + "hydra", + "api", + ] +) + consent_test_target = "//apps/consent:test-integration" local_resource( "test-consent", @@ -282,7 +363,6 @@ local_resource( auto_init = is_ci and PAY_TEST_LABEL in cfg.get("test", []), cmd = "buck2 test {}".format(pay_test_target), resource_deps = [ - "api", "pay", "add-test-users-with-usernames", "fund-user", @@ -300,6 +380,21 @@ local_resource( ], ) +voucher_test_target = "//apps/voucher:test-integration" +local_resource( + "test-voucher", + labels = ["test"], + auto_init = is_ci and VOUCHER_TEST_LABEL in cfg.get("test", []), + cmd = "buck2 test {}".format(voucher_test_target), + resource_deps = [ + "voucher", + "consent", + "init-test-user", + "fund-user", + ], +) + + map_test_target = "//apps/map:test-integration" local_resource( "test-map", @@ -372,36 +467,17 @@ local_resource( allow_parallel = True, auto_init = run_apps, resource_deps = [ - "hydra-consent", "apollo-router", "hydra", + "kratos", "api", + "hydra-consent-test-client", ], links = [ link("http://localhost:3000", "consent"), ], ) -local_resource( - name='hydra-consent', - labels = ['auth'], - cmd=[ - 'buck2', - 'run', - '//dev:setup-hydra-client', - '--', - 'consent', - 'authorization_code,refresh_token', - 'http://localhost:3000', - ], - allow_parallel = True, - auto_init = run_apps, - resource_deps = [ - "hydra", - "api", - ] -) - env_json = _buck2_dep_inputs("//dev:serve_env")[0] core_serve_env_from_json = read_json(env_json) local_env_file = ".env.local" @@ -445,6 +521,7 @@ local_resource( "oathkeeper", "svix", "notifications", + "stablesats", ] ) @@ -543,6 +620,7 @@ local_resource( serve_cmd = "buck2 run {}".format(notifications_target), serve_env = { "PG_CON": "postgres://user:password@localhost:5433/pg", + "PG_READ_CON": "postgres://user:password@localhost:5433/pg", "NOTIFICATIONS_CONFIG": "./config/notifications/notifications.yml", "OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4317", }, @@ -576,6 +654,15 @@ local_resource( ] ) +local_resource( + name="setup-voucher", + labels = ["test"], + cmd="buck2 run //dev:setup-voucher-escrow", + allow_parallel=False, + auto_init=run_apps, + resource_deps=["voucher-pg", "api-keys"] +) + api_keys_target = "//core/api-keys:api-keys" local_resource( "api-keys", @@ -596,6 +683,9 @@ local_resource( ) docker_groups = { + "apps": [ + "voucher-pg", + ], "auth": [ "api-keys-pg", "oathkeeper", @@ -621,6 +711,8 @@ docker_groups = { "bria", "bria-pg", "bitcoind", + "fulcrum", + "bitcoind-signer", ], "integration": [ "lnd-outside-1", @@ -659,6 +751,8 @@ for service in docker_groups["bitcoin"]: dc_resource(service, labels = ["bitcoin"]) for service in docker_groups["tracing"]: dc_resource(service, labels = ["tracing"]) +for service in docker_groups["apps"]: + dc_resource(service, labels = ["apps"]) for service in docker_groups["core"]: dc_resource(service, labels = ["core"]) for service in docker_groups["auth"]: @@ -674,7 +768,9 @@ local_resource( labels = ["test"], auto_init = is_ci and CORE_TEST_LABEL in cfg.get("test", []), cmd = "buck2 test {}".format(api_test_target), - resource_deps = [res for sublist in docker_groups.values() for res in sublist] + ["notifications"] + resource_deps = [ + "api", + ] ) local_resource( diff --git a/dev/vendor/galoy-quickstart/dev/config/apollo-federation/supergraph.graphql b/dev/vendor/galoy-quickstart/dev/config/apollo-federation/supergraph.graphql index e99e56a39c..71763c63bc 100644 --- a/dev/vendor/galoy-quickstart/dev/config/apollo-federation/supergraph.graphql +++ b/dev/vendor/galoy-quickstart/dev/config/apollo-federation/supergraph.graphql @@ -25,6 +25,7 @@ interface Account @join__type(graph: PUBLIC) { callbackEndpoints: [CallbackEndpoint!]! + callbackPortalUrl: String! csvTransactions(walletIds: [WalletId!]!): String! defaultWallet: PublicWallet! defaultWalletId: WalletId! @deprecated(reason: "Shifting property to 'defaultWallet.id'") @@ -104,6 +105,7 @@ enum AccountLevel @join__type(graph: PUBLIC) { ONE @join__enumValue(graph: PUBLIC) + THREE @join__enumValue(graph: PUBLIC) TWO @join__enumValue(graph: PUBLIC) ZERO @join__enumValue(graph: PUBLIC) } @@ -379,6 +381,7 @@ type ConsumerAccount implements Account @join__type(graph: PUBLIC) { callbackEndpoints: [CallbackEndpoint!]! + callbackPortalUrl: String! """ return CSV stream, base64 encoded, of the list of transactions in the wallet @@ -604,6 +607,62 @@ type GraphQLApplicationError implements Error scalar Hex32Bytes @join__type(graph: PUBLIC) +enum Icon + @join__type(graph: NOTIFICATIONS) +{ + ARROW_RIGHT @join__enumValue(graph: NOTIFICATIONS) + ARROW_LEFT @join__enumValue(graph: NOTIFICATIONS) + BACK_SPACE @join__enumValue(graph: NOTIFICATIONS) + BANK @join__enumValue(graph: NOTIFICATIONS) + BITCOIN @join__enumValue(graph: NOTIFICATIONS) + BOOK @join__enumValue(graph: NOTIFICATIONS) + BTC_BOOK @join__enumValue(graph: NOTIFICATIONS) + CARET_DOWN @join__enumValue(graph: NOTIFICATIONS) + CARET_LEFT @join__enumValue(graph: NOTIFICATIONS) + CARET_RIGHT @join__enumValue(graph: NOTIFICATIONS) + CARET_UP @join__enumValue(graph: NOTIFICATIONS) + CHECK_CIRCLE @join__enumValue(graph: NOTIFICATIONS) + CHECK @join__enumValue(graph: NOTIFICATIONS) + CLOSE @join__enumValue(graph: NOTIFICATIONS) + CLOSE_CROSS_WITH_BACKGROUND @join__enumValue(graph: NOTIFICATIONS) + COINS @join__enumValue(graph: NOTIFICATIONS) + PEOPLE @join__enumValue(graph: NOTIFICATIONS) + COPY_PASTE @join__enumValue(graph: NOTIFICATIONS) + DOLLAR @join__enumValue(graph: NOTIFICATIONS) + EYE_SLASH @join__enumValue(graph: NOTIFICATIONS) + EYE @join__enumValue(graph: NOTIFICATIONS) + FILTER @join__enumValue(graph: NOTIFICATIONS) + GLOBE @join__enumValue(graph: NOTIFICATIONS) + GRAPH @join__enumValue(graph: NOTIFICATIONS) + IMAGE @join__enumValue(graph: NOTIFICATIONS) + INFO @join__enumValue(graph: NOTIFICATIONS) + LIGHTNING @join__enumValue(graph: NOTIFICATIONS) + LINK @join__enumValue(graph: NOTIFICATIONS) + LOADING @join__enumValue(graph: NOTIFICATIONS) + MAGNIFYING_GLASS @join__enumValue(graph: NOTIFICATIONS) + MAP @join__enumValue(graph: NOTIFICATIONS) + MENU @join__enumValue(graph: NOTIFICATIONS) + PENCIL @join__enumValue(graph: NOTIFICATIONS) + NOTE @join__enumValue(graph: NOTIFICATIONS) + RANK @join__enumValue(graph: NOTIFICATIONS) + QR_CODE @join__enumValue(graph: NOTIFICATIONS) + QUESTION @join__enumValue(graph: NOTIFICATIONS) + RECEIVE @join__enumValue(graph: NOTIFICATIONS) + SEND @join__enumValue(graph: NOTIFICATIONS) + SETTINGS @join__enumValue(graph: NOTIFICATIONS) + SHARE @join__enumValue(graph: NOTIFICATIONS) + TRANSFER @join__enumValue(graph: NOTIFICATIONS) + USER @join__enumValue(graph: NOTIFICATIONS) + VIDEO @join__enumValue(graph: NOTIFICATIONS) + WARNING @join__enumValue(graph: NOTIFICATIONS) + WARNING_WITH_BACKGROUND @join__enumValue(graph: NOTIFICATIONS) + PAYMENT_SUCCESS @join__enumValue(graph: NOTIFICATIONS) + PAYMENT_PENDING @join__enumValue(graph: NOTIFICATIONS) + PAYMENT_ERROR @join__enumValue(graph: NOTIFICATIONS) + BELL @join__enumValue(graph: NOTIFICATIONS) + REFRESH @join__enumValue(graph: NOTIFICATIONS) +} + union InitiationVia @join__type(graph: PUBLIC) @join__unionMember(graph: PUBLIC, member: "InitiationViaIntraLedger") @@ -794,6 +853,7 @@ input LnInvoiceCreateInput """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -811,6 +871,7 @@ input LnInvoiceCreateOnBehalfOfRecipientInput """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -900,6 +961,7 @@ input LnNoAmountInvoiceCreateInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -915,6 +977,7 @@ input LnNoAmountInvoiceCreateOnBehalfOfRecipientInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -1025,6 +1088,7 @@ input LnUsdInvoiceBtcDenominatedCreateOnBehalfOfRecipientInput """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """ Optional memo for the lightning invoice. Acts as a note to the recipient. @@ -1043,6 +1107,7 @@ input LnUsdInvoiceCreateInput """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -1060,6 +1125,7 @@ input LnUsdInvoiceCreateOnBehalfOfRecipientInput """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """ Optional memo for the lightning invoice. Acts as a note to the recipient. @@ -1148,10 +1214,7 @@ type Mutation { apiKeyCreate(input: ApiKeyCreateInput!): ApiKeyCreatePayload! @join__field(graph: API_KEYS) apiKeyRevoke(input: ApiKeyRevokeInput!): ApiKeyRevokePayload! @join__field(graph: API_KEYS) - userDisableNotificationChannel(input: UserDisableNotificationChannelInput!): UserUpdateNotificationSettingsPayload! @join__field(graph: NOTIFICATIONS) - userEnableNotificationChannel(input: UserEnableNotificationChannelInput!): UserUpdateNotificationSettingsPayload! @join__field(graph: NOTIFICATIONS) - userDisableNotificationCategory(input: UserDisableNotificationCategoryInput!): UserUpdateNotificationSettingsPayload! @join__field(graph: NOTIFICATIONS) - userEnableNotificationCategory(input: UserEnableNotificationCategoryInput!): UserUpdateNotificationSettingsPayload! @join__field(graph: NOTIFICATIONS) + statefulNotificationAcknowledge(input: StatefulNotificationAcknowledgeInput!): StatefulNotificationAcknowledgePayload! @join__field(graph: NOTIFICATIONS) accountDelete: AccountDeletePayload! @join__field(graph: PUBLIC) accountDisableNotificationCategory(input: AccountDisableNotificationCategoryInput!): AccountUpdateNotificationSettingsPayload! @join__field(graph: PUBLIC) accountDisableNotificationChannel(input: AccountDisableNotificationChannelInput!): AccountUpdateNotificationSettingsPayload! @join__field(graph: PUBLIC) @@ -1274,6 +1337,7 @@ type Mutation onChainUsdPaymentSendAsBtcDenominated(input: OnChainUsdPaymentSendAsBtcDenominatedInput!): PaymentSendPayload! @join__field(graph: PUBLIC) quizClaim(input: QuizClaimInput!): QuizClaimPayload! @join__field(graph: PUBLIC) supportChatMessageAdd(input: SupportChatMessageAddInput!): SupportChatMessageAddPayload! @join__field(graph: PUBLIC) + supportChatReset: SuccessPayload! @join__field(graph: PUBLIC) userContactUpdateAlias(input: UserContactUpdateAliasInput!): UserContactUpdateAliasPayload! @join__field(graph: PUBLIC) @deprecated(reason: "will be moved to AccountContact") userEmailDelete: UserEmailDeletePayload! @join__field(graph: PUBLIC) userEmailRegistrationInitiate(input: UserEmailRegistrationInitiateInput!): UserEmailRegistrationInitiatePayload! @join__field(graph: PUBLIC) @@ -1308,6 +1372,12 @@ enum Network testnet @join__enumValue(graph: PUBLIC) } +union NotificationAction + @join__type(graph: NOTIFICATIONS) + @join__unionMember(graph: NOTIFICATIONS, member: "OpenDeepLinkAction") + @join__unionMember(graph: NOTIFICATIONS, member: "OpenExternalLinkAction") + = OpenDeepLinkAction | OpenExternalLinkAction + scalar NotificationCategory @join__type(graph: PUBLIC) @@ -1441,21 +1511,34 @@ type OneDayAccountLimit implements AccountLimit scalar OneTimeAuthCode @join__type(graph: PUBLIC) -"""Information about pagination in a connection.""" +type OpenDeepLinkAction + @join__type(graph: NOTIFICATIONS) +{ + deepLink: String! +} + +type OpenExternalLinkAction + @join__type(graph: NOTIFICATIONS) +{ + url: String! +} + +"""Information about pagination in a connection""" type PageInfo + @join__type(graph: NOTIFICATIONS) @join__type(graph: PUBLIC) { - """When paginating forwards, the cursor to continue.""" - endCursor: String + """When paginating backwards, are there more items?""" + hasPreviousPage: Boolean! """When paginating forwards, are there more items?""" hasNextPage: Boolean! - """When paginating backwards, are there more items?""" - hasPreviousPage: Boolean! - """When paginating backwards, the cursor to continue.""" startCursor: String + + """When paginating forwards, the cursor to continue.""" + endCursor: String } scalar PaymentHash @@ -1761,6 +1844,56 @@ A string amount (of a currency) that can be negative (e.g. in a transaction) scalar SignedDisplayMajorAmount @join__type(graph: PUBLIC) +type StatefulNotification + @join__type(graph: NOTIFICATIONS) +{ + id: ID! + title: String! + body: String! + deepLink: String + action: NotificationAction + createdAt: Timestamp! + acknowledgedAt: Timestamp + bulletinEnabled: Boolean! + icon: Icon +} + +input StatefulNotificationAcknowledgeInput + @join__type(graph: NOTIFICATIONS) +{ + notificationId: ID! +} + +type StatefulNotificationAcknowledgePayload + @join__type(graph: NOTIFICATIONS) +{ + notification: StatefulNotification! +} + +type StatefulNotificationConnection + @join__type(graph: NOTIFICATIONS) +{ + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [StatefulNotificationEdge!]! + + """A list of nodes.""" + nodes: [StatefulNotification!]! +} + +"""An edge in a connection.""" +type StatefulNotificationEdge + @join__type(graph: NOTIFICATIONS) +{ + """The item at the end of the edge""" + node: StatefulNotification! + + """A cursor for use in pagination""" + cursor: String! +} + type Subscription @join__type(graph: PUBLIC) { @@ -1815,6 +1948,7 @@ Timestamp field, serialized as Unix time (the number of seconds since the Unix e """ scalar Timestamp @join__type(graph: API_KEYS) + @join__type(graph: NOTIFICATIONS) @join__type(graph: PUBLIC) """A time-based one-time password""" @@ -2004,7 +2138,10 @@ type User { id: ID! apiKeys: [ApiKey!]! @join__field(graph: API_KEYS) - notificationSettings: UserNotificationSettings! @join__field(graph: NOTIFICATIONS) + statefulNotifications(first: Int!, after: String): StatefulNotificationConnection! @join__field(graph: NOTIFICATIONS) + statefulNotificationsWithoutBulletinEnabled(first: Int!, after: String): StatefulNotificationConnection! @join__field(graph: NOTIFICATIONS) + unacknowledgedStatefulNotificationsWithoutBulletinEnabledCount: Int! @join__field(graph: NOTIFICATIONS) + unacknowledgedStatefulNotificationsWithBulletinEnabled(first: Int!, after: String): StatefulNotificationConnection! @join__field(graph: NOTIFICATIONS) """ Get single contact details. @@ -2084,19 +2221,6 @@ type UserContactUpdateAliasPayload errors: [Error!]! } -input UserDisableNotificationCategoryInput - @join__type(graph: NOTIFICATIONS) -{ - channel: UserNotificationChannel! - category: UserNotificationCategory! -} - -input UserDisableNotificationChannelInput - @join__type(graph: NOTIFICATIONS) -{ - channel: UserNotificationChannel! -} - type UserEmailDeletePayload @join__type(graph: PUBLIC) { @@ -2132,19 +2256,6 @@ type UserEmailRegistrationValidatePayload me: User } -input UserEnableNotificationCategoryInput - @join__type(graph: NOTIFICATIONS) -{ - channel: UserNotificationChannel! - category: UserNotificationCategory! -} - -input UserEnableNotificationChannelInput - @join__type(graph: NOTIFICATIONS) -{ - channel: UserNotificationChannel! -} - input UserLoginInput @join__type(graph: PUBLIC) { @@ -2169,36 +2280,6 @@ input UserLogoutInput scalar Username @join__type(graph: PUBLIC) -enum UserNotificationCategory - @join__type(graph: NOTIFICATIONS) -{ - CIRCLES @join__enumValue(graph: NOTIFICATIONS) - PAYMENTS @join__enumValue(graph: NOTIFICATIONS) - ADMIN_NOTIFICATION @join__enumValue(graph: NOTIFICATIONS) - MARKETING @join__enumValue(graph: NOTIFICATIONS) - PRICE @join__enumValue(graph: NOTIFICATIONS) - SECURITY @join__enumValue(graph: NOTIFICATIONS) -} - -enum UserNotificationChannel - @join__type(graph: NOTIFICATIONS) -{ - PUSH @join__enumValue(graph: NOTIFICATIONS) -} - -type UserNotificationChannelSettings - @join__type(graph: NOTIFICATIONS) -{ - enabled: Boolean! - disabledCategories: [UserNotificationCategory!]! -} - -type UserNotificationSettings - @join__type(graph: NOTIFICATIONS) -{ - push: UserNotificationChannelSettings! -} - type UserPhoneDeletePayload @join__type(graph: PUBLIC) { @@ -2279,12 +2360,6 @@ type UserUpdateLanguagePayload user: User } -type UserUpdateNotificationSettingsPayload - @join__type(graph: NOTIFICATIONS) -{ - notificationSettings: UserNotificationSettings! -} - input UserUpdateUsernameInput @join__type(graph: PUBLIC) { diff --git a/dev/vendor/galoy-quickstart/dev/config/lnd/lnd.conf b/dev/vendor/galoy-quickstart/dev/config/lnd/lnd.conf index f7d9fd4b6e..b93de03fcc 100644 --- a/dev/vendor/galoy-quickstart/dev/config/lnd/lnd.conf +++ b/dev/vendor/galoy-quickstart/dev/config/lnd/lnd.conf @@ -22,7 +22,6 @@ tlscertduration=100800h [Bitcoin] -bitcoin.active=true bitcoin.defaultchanconfs=0 bitcoin.node=bitcoind bitcoin.regtest=true diff --git a/dev/vendor/galoy-quickstart/dev/config/notifications/notifications.yml b/dev/vendor/galoy-quickstart/dev/config/notifications/notifications.yml index 1f1702c732..98f8f49871 100644 --- a/dev/vendor/galoy-quickstart/dev/config/notifications/notifications.yml +++ b/dev/vendor/galoy-quickstart/dev/config/notifications/notifications.yml @@ -2,3 +2,5 @@ app: push_executor: fcm: google_application_credentials_path: "./config/notifications/fake_service_account.json" + jobs: + enabled: true diff --git a/dev/vendor/galoy-quickstart/dev/core-bundle/serve-env.json b/dev/vendor/galoy-quickstart/dev/core-bundle/serve-env.json index 5690aa6532..d023172acb 100644 --- a/dev/vendor/galoy-quickstart/dev/core-bundle/serve-env.json +++ b/dev/vendor/galoy-quickstart/dev/core-bundle/serve-env.json @@ -45,5 +45,6 @@ "SVIX_SECRET": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTE2NzIwMTQsImV4cCI6MjAwNzAzMjAxNCwibmJmIjoxNjkxNjcyMDE0LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.b9s0aWSisNdUNki4edabBEToLNSwjC9-AiJQr4J3y4E", "SVIX_ENDPOINT": "http://localhost:8071", - "EXPORTER_PORT": "3003" + "EXPORTER_PORT": "3003", + "EXPORTER_ASSETS_LIABILITIES_DELAY_SECS": "0" } diff --git a/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml b/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml index 27cd626f5d..5c734d841e 100644 --- a/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml +++ b/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml @@ -5,54 +5,54 @@ services: price: image: us.gcr.io/galoy-org/price:edge ports: - - 50051:50051 - - 9464:9464 + - 50051:50051 + - 9464:9464 volumes: - ${HOST_PROJECT_PATH:-.}/config/price.yml:/var/yaml/custom.yaml price-history: image: us.gcr.io/galoy-org/price-history:edge ports: - - 50052:50052 + - 50052:50052 command: ./scripts/run-servers-dev.sh environment: - - DB_HOST=price-history-pg - - DB_PORT=5432 - - DB_USER=galoy-price-usr - - DB_PWD=galoy-price-pwd - - DB_DB=galoy-price-history - - DB_POOL_MIN=1 - - DB_POOL_MAX=5 - - DB_DEBUG=false + - DB_HOST=price-history-pg + - DB_PORT=5432 + - DB_USER=galoy-price-usr + - DB_PWD=galoy-price-pwd + - DB_DB=galoy-price-history + - DB_POOL_MIN=1 + - DB_POOL_MAX=5 + - DB_DEBUG=false depends_on: - - price-history-pg - - price-history-migrate + - price-history-pg + - price-history-migrate price-history-migrate: image: us.gcr.io/galoy-org/price-history-migrate:edge ports: [] environment: - - DB_HOST=price-history-pg - - DB_PORT=5432 - - DB_USER=galoy-price-usr - - DB_PWD=galoy-price-pwd - - DB_DB=galoy-price-history - - DB_POOL_MIN=1 - - DB_POOL_MAX=5 - - DB_DEBUG=false + - DB_HOST=price-history-pg + - DB_PORT=5432 + - DB_USER=galoy-price-usr + - DB_PWD=galoy-price-pwd + - DB_DB=galoy-price-history + - DB_POOL_MIN=1 + - DB_POOL_MAX=5 + - DB_DEBUG=false depends_on: - - price-history-pg + - price-history-pg price-history-pg: - image: postgres:14.1 + image: postgres:15.1 environment: - - POSTGRES_USER=galoy-price-usr - - POSTGRES_PASSWORD=galoy-price-pwd - - POSTGRES_DB=galoy-price-history + - POSTGRES_USER=galoy-price-usr + - POSTGRES_PASSWORD=galoy-price-pwd + - POSTGRES_DB=galoy-price-history healthcheck: test: ["CMD-SHELL", "pg_isready"] interval: 5s timeout: 30s retries: 5 api-keys-pg: - image: postgres:14.1 + image: postgres:15.1 environment: - POSTGRES_USER=user - POSTGRES_PASSWORD=password @@ -72,6 +72,14 @@ services: interval: 5s timeout: 30s retries: 5 + voucher-pg: + image: postgres:15.1 + environment: + - POSTGRES_USER=user + - POSTGRES_PASSWORD=password + - POSTGRES_DB=voucher + ports: + - "5430:5432" oathkeeper: image: oryd/oathkeeper:v0.40.6-distroless ports: @@ -88,7 +96,7 @@ services: - apollo-router - otel-agent hydra: - image: oryd/hydra:v2.1.2 + image: oryd/hydra:v2.2.0 ports: - "4444:4444" #! Public port - "4445:4445" #! Admin port @@ -103,7 +111,7 @@ services: - hydra-pg hydra-migrate: - image: oryd/hydra:v2.1.2 + image: oryd/hydra:v2.2.0 environment: - DSN=postgres://hydra:secret@hydra-pg:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4 command: migrate -c /home/ory/hydra.yml sql -e --yes @@ -170,7 +178,7 @@ services: environment: - MONGO_INITDB_DATABASE=galoy lnd1: - image: lightninglabs/lnd:v0.17.4-beta + image: lightninglabs/lnd:v0.18.3-beta ports: - "10009:10009" volumes: @@ -190,7 +198,7 @@ services: cp /root/.lnd/admin.macaroon /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon /bin/lnd lnd2: - image: lightninglabs/lnd:v0.17.4-beta + image: lightninglabs/lnd:v0.18.3-beta ports: - "10010:10009" volumes: @@ -210,7 +218,7 @@ services: cp /root/.lnd/admin.macaroon /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon /bin/lnd lnd-outside-1: - image: lightninglabs/lnd:v0.17.4-beta + image: lightninglabs/lnd:v0.18.3-beta ports: - "10012:10009" volumes: @@ -230,7 +238,7 @@ services: /bin/lnd depends_on: [bitcoind] lnd-outside-2: - image: lightninglabs/lnd:v0.17.4-beta + image: lightninglabs/lnd:v0.18.3-beta ports: - "10013:10009" volumes: @@ -304,13 +312,13 @@ services: - SSL_KEYFILE=/tls.key command: ["Fulcrum", "/fulcrum.conf"] bitcoind: - image: lncm/bitcoind:v25.1 + image: lncm/bitcoind:v27.0 ports: - "18443:18443" volumes: - ${HOST_PROJECT_PATH:-.}/config/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf bitcoind-signer: - image: lncm/bitcoind:v25.1 + image: lncm/bitcoind:v27.0 ports: [] volumes: - ${HOST_PROJECT_PATH:-.}/config/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf @@ -331,7 +339,7 @@ services: volumes: - ${HOST_PROJECT_PATH:-.}/config/otel-agent-config.yaml:/etc/otel-agent-config.yaml svix: - image: svix/svix-server:v1.11 + image: svix/svix-server:v1.38 platform: linux/amd64 environment: WAIT_FOR: "true" diff --git a/dev/vendor/galoy-quickstart/dev/helpers/gql/api-key-create.gql b/dev/vendor/galoy-quickstart/dev/helpers/gql/api-key-create.gql new file mode 100644 index 0000000000..43ee8eb27a --- /dev/null +++ b/dev/vendor/galoy-quickstart/dev/helpers/gql/api-key-create.gql @@ -0,0 +1,16 @@ +mutation ApiKeyCreate($input: ApiKeyCreateInput!) { + apiKeyCreate(input: $input) { + apiKey { + createdAt + expired + expiresAt + id + lastUsedAt + name + readOnly + revoked + scopes + } + apiKeySecret + } +} diff --git a/dev/vendor/galoy-quickstart/docker-compose.yml b/dev/vendor/galoy-quickstart/docker-compose.yml index 3c3b2ca5e4..10cbb72e87 100644 --- a/dev/vendor/galoy-quickstart/docker-compose.yml +++ b/dev/vendor/galoy-quickstart/docker-compose.yml @@ -68,7 +68,7 @@ services: - POSTGRES_PASSWORD=secret - POSTGRES_DB=default hydra: - image: oryd/hydra:v2.1.2 + image: oryd/hydra:v2.2.0 ports: - 4444:4444 - 4445:4445 @@ -82,7 +82,7 @@ services: - hydra-migrate - hydra-pg hydra-migrate: - image: oryd/hydra:v2.1.2 + image: oryd/hydra:v2.2.0 environment: - DSN=postgres://hydra:secret@hydra-pg:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4 command: migrate -c /home/ory/hydra.yml sql -e --yes @@ -98,7 +98,7 @@ services: - POSTGRES_PASSWORD=secret - POSTGRES_DB=hydra galoy: - image: us.gcr.io/galoy-org/galoy-api@sha256:e06d6381813012d3abcf129d9eb10e8e7fae7c9cfd9a6857b726a9cbba238f93 + image: us.gcr.io/galoy-org/galoy-api@sha256:bd56a94ac9142ba771aa6d1e193c449c669bf2706f5de5727ffab7e50460eb4a environment: - HELMREVISION=dev - NETWORK=regtest @@ -134,13 +134,6 @@ services: - LND1_RPCPORT=10009 - LND1_NAME=lnd1 - LND1_TYPE=offchain,onchain - - LND2_TLS=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNZVENDQWdlZ0F3SUJBZ0lSQU9zZzdYWFR4cnVZYlhkeTY2d3RuN1F3Q2dZSUtvWkl6ajBFQXdJd09ERWYKTUIwR0ExVUVDaE1XYkc1a0lHRjFkRzluWlc1bGNtRjBaV1FnWTJWeWRERVZNQk1HQTFVRUF4TU1PRFl4T1RneApNak5tT0Roak1CNFhEVEl6TURFeE9USXdOREUxTTFvWERUTTBNRGN5TVRJd05ERTFNMW93T0RFZk1CMEdBMVVFCkNoTVdiRzVrSUdGMWRHOW5aVzVsY21GMFpXUWdZMlZ5ZERFVk1CTUdBMVVFQXhNTU9EWXhPVGd4TWpObU9EaGoKTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFM1lieUlKWU1Vcm8zZkl0UFFucysxZ2lpTXI5NQpJUXRmclFDQ2JhOWVtcjI4TENmbk1vYy9VQVFwUlg3QVlvVFRneUdiMFBuZGNUODF5ZVgvYTlPa0RLT0I4VENCCjdqQU9CZ05WSFE4QkFmOEVCQU1DQXFRd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3RXdEd1lEVlIwVEFRSC8KQkFVd0F3RUIvekFkQmdOVkhRNEVGZ1FVL1AxRHpJUkRzTEhHMU10d3NrZE5nZ0lub1Mwd2daWUdBMVVkRVFTQgpqakNCaTRJTU9EWXhPVGd4TWpObU9EaGpnZ2xzYjJOaGJHaHZjM1NDRFd4dVpDMXZkWFJ6YVdSbExUR0NEV3h1ClpDMXZkWFJ6YVdSbExUS0NEV3h1WkMxdmRYUnphV1JsTFRPQ0JHeHVaREdDQkd4dVpES0NCSFZ1YVhpQ0NuVnUKYVhod1lXTnJaWFNDQjJKMVptTnZibTZIQkg4QUFBR0hFQUFBQUFBQUFBQUFBQUFBQUFBQUFBR0hCS3dUQUJBdwpDZ1lJS29aSXpqMEVBd0lEU0FBd1JRSWhBSU5DNlJWQ3d6SzFYRnFxeVNLY0Y4QzQ5ZFlSOThjemdLNVdkcmNOCkxYYWlBaUJHYmtWeGhaeHdDaDVLQ1o1Z2M1Q2FsQ0RvaGNxVkdiaHNya0hHTFhpdHN3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - - LND2_MACAROON=AgEDbG5kAvgBAwoQX0BxfhQTxLTiqaceBnGnfBIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgMAKlr1HehfBpn2R5RPE2IuY9r/18QBeLZxYgRidpos4= - - LND2_PUBKEY=039341ef13e776dc1611502cf510110d9ac5cdc252141f5997adcfd72cef34c3a7 - - LND2_DNS=lnd2 - - LND2_RPCPORT=10010 - - LND2_NAME=lnd2 - - LND2_TYPE=offchain - SVIX_SECRET=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTE2NzIwMTQsImV4cCI6MjAwNzAzMjAxNCwibmJmIjoxNjkxNjcyMDE0LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.b9s0aWSisNdUNki4edabBEToLNSwjC9-AiJQr4J3y4E - SVIX_ENDPOINT=http://svix:8071 - EXPORTER_PORT=3003 @@ -161,7 +154,7 @@ services: aliases: - bats-tests trigger: - image: us.gcr.io/galoy-org/galoy-api-trigger@sha256:b3b05fbc26a271e98868dccae008fdca2856e658975584f1e125f56dcfd588cd + image: us.gcr.io/galoy-org/galoy-api-trigger@sha256:c8479ff0088f3cbed3205e160d130a6fe2e8f1efb7b66d68e295fbb26c7eb119 environment: - HELMREVISION=dev - NETWORK=regtest @@ -197,13 +190,6 @@ services: - LND1_RPCPORT=10009 - LND1_NAME=lnd1 - LND1_TYPE=offchain,onchain - - LND2_TLS=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNZVENDQWdlZ0F3SUJBZ0lSQU9zZzdYWFR4cnVZYlhkeTY2d3RuN1F3Q2dZSUtvWkl6ajBFQXdJd09ERWYKTUIwR0ExVUVDaE1XYkc1a0lHRjFkRzluWlc1bGNtRjBaV1FnWTJWeWRERVZNQk1HQTFVRUF4TU1PRFl4T1RneApNak5tT0Roak1CNFhEVEl6TURFeE9USXdOREUxTTFvWERUTTBNRGN5TVRJd05ERTFNMW93T0RFZk1CMEdBMVVFCkNoTVdiRzVrSUdGMWRHOW5aVzVsY21GMFpXUWdZMlZ5ZERFVk1CTUdBMVVFQXhNTU9EWXhPVGd4TWpObU9EaGoKTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFM1lieUlKWU1Vcm8zZkl0UFFucysxZ2lpTXI5NQpJUXRmclFDQ2JhOWVtcjI4TENmbk1vYy9VQVFwUlg3QVlvVFRneUdiMFBuZGNUODF5ZVgvYTlPa0RLT0I4VENCCjdqQU9CZ05WSFE4QkFmOEVCQU1DQXFRd0V3WURWUjBsQkF3d0NnWUlLd1lCQlFVSEF3RXdEd1lEVlIwVEFRSC8KQkFVd0F3RUIvekFkQmdOVkhRNEVGZ1FVL1AxRHpJUkRzTEhHMU10d3NrZE5nZ0lub1Mwd2daWUdBMVVkRVFTQgpqakNCaTRJTU9EWXhPVGd4TWpObU9EaGpnZ2xzYjJOaGJHaHZjM1NDRFd4dVpDMXZkWFJ6YVdSbExUR0NEV3h1ClpDMXZkWFJ6YVdSbExUS0NEV3h1WkMxdmRYUnphV1JsTFRPQ0JHeHVaREdDQkd4dVpES0NCSFZ1YVhpQ0NuVnUKYVhod1lXTnJaWFNDQjJKMVptTnZibTZIQkg4QUFBR0hFQUFBQUFBQUFBQUFBQUFBQUFBQUFBR0hCS3dUQUJBdwpDZ1lJS29aSXpqMEVBd0lEU0FBd1JRSWhBSU5DNlJWQ3d6SzFYRnFxeVNLY0Y4QzQ5ZFlSOThjemdLNVdkcmNOCkxYYWlBaUJHYmtWeGhaeHdDaDVLQ1o1Z2M1Q2FsQ0RvaGNxVkdiaHNya0hHTFhpdHN3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - - LND2_MACAROON=AgEDbG5kAvgBAwoQX0BxfhQTxLTiqaceBnGnfBIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgMAKlr1HehfBpn2R5RPE2IuY9r/18QBeLZxYgRidpos4= - - LND2_PUBKEY=039341ef13e776dc1611502cf510110d9ac5cdc252141f5997adcfd72cef34c3a7 - - LND2_DNS=lnd2 - - LND2_RPCPORT=10010 - - LND2_NAME=lnd2 - - LND2_TYPE=offchain - SVIX_SECRET=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTE2NzIwMTQsImV4cCI6MjAwNzAzMjAxNCwibmJmIjoxNjkxNjcyMDE0LCJpc3MiOiJzdml4LXNlcnZlciIsInN1YiI6Im9yZ18yM3JiOFlkR3FNVDBxSXpwZ0d3ZFhmSGlyTXUifQ.b9s0aWSisNdUNki4edabBEToLNSwjC9-AiJQr4J3y4E - SVIX_ENDPOINT=http://svix:8071 - EXPORTER_PORT=3003 @@ -213,9 +199,10 @@ services: - bria - mongodb notifications: - image: us.gcr.io/galoy-org/galoy-notifications@sha256:6463fd024ba6de7c5f98745aeec8c2328fee909a3ae1cd18b1fde92473f43f2a + image: us.gcr.io/galoy-org/galoy-notifications@sha256:71c53ab3d9a4282d44d0605b95f1691ebc23334e8108bd4d06021a0c627a1205 environment: - PG_CON=postgres://user:password@notifications-pg:5432/pg + - PG_READ_CON=postgres://user:password@notifications-pg:5432/pg - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318 - NOTIFICATIONS_CONFIG=/config/notifications/notifications.yml ports: @@ -254,7 +241,7 @@ services: environment: - MONGO_INITDB_DATABASE=galoy mongodb-migrate: - image: us.gcr.io/galoy-org/galoy-api-migrate@sha256:551a443b32384262dfdf55f3dec5f09a168636bf40f0315d581614a8d166944b + image: us.gcr.io/galoy-org/galoy-api-migrate@sha256:19b9cd06466116bc6d25d1c495438ac64b4fec05bde47ca9b83b7a8c1cd4633f depends_on: - mongodb environment: @@ -298,7 +285,7 @@ services: depends_on: - price-history-pg price-history-pg: - image: postgres:14.1 + image: postgres:15.1 environment: - POSTGRES_USER=galoy-price-usr - POSTGRES_PASSWORD=galoy-price-pwd @@ -311,13 +298,13 @@ services: timeout: 30s retries: 5 bitcoind: - image: lncm/bitcoind:v25.1 + image: lncm/bitcoind:v27.0 ports: - 18443:18443 volumes: - ${HOST_PROJECT_PATH:-.}/${GALOY_QUICKSTART_PATH:-vendor/galoy-quickstart}/dev/config/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf bitcoind-signer: - image: lncm/bitcoind:v25.1 + image: lncm/bitcoind:v27.0 ports: [] volumes: - ${HOST_PROJECT_PATH:-.}/${GALOY_QUICKSTART_PATH:-vendor/galoy-quickstart}/dev/config/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf @@ -330,7 +317,7 @@ services: - | bitcoind -connect=bitcoind:18444 lnd1: - image: lightninglabs/lnd:v0.17.4-beta + image: lightninglabs/lnd:v0.18.3-beta ports: - 10009:10009 volumes: @@ -353,7 +340,7 @@ services: cp /root/.lnd/admin.macaroon /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon /bin/lnd lnd-outside-1: - image: lightninglabs/lnd:v0.17.4-beta + image: lightninglabs/lnd:v0.18.3-beta ports: - 10012:10009 volumes: @@ -460,7 +447,7 @@ services: volumes: - ${HOST_PROJECT_PATH:-.}/${GALOY_QUICKSTART_PATH:-vendor/galoy-quickstart}/dev/config/otel-agent-config.yaml:/etc/otel-agent-config.yaml svix: - image: svix/svix-server:v1.11 + image: svix/svix-server:v1.38 platform: linux/amd64 environment: WAIT_FOR: "true" diff --git a/dev/vendor/galoy-quickstart/graphql/gql/acknowledge-notification.gql b/dev/vendor/galoy-quickstart/graphql/gql/acknowledge-notification.gql new file mode 100644 index 0000000000..511ceeaa4e --- /dev/null +++ b/dev/vendor/galoy-quickstart/graphql/gql/acknowledge-notification.gql @@ -0,0 +1,10 @@ +mutation acknowledgeNotification( + $input: StatefulNotificationAcknowledgeInput! +) { + statefulNotificationAcknowledge(input: $input) { + notification { + id + acknowledgedAt + } + } +} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications-without-bulletin-enabled.gql b/dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications-without-bulletin-enabled.gql new file mode 100644 index 0000000000..55145e887e --- /dev/null +++ b/dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications-without-bulletin-enabled.gql @@ -0,0 +1,20 @@ +query listStatefulNotificationsWithoutBulletinEnabled($first: Int = 2, $after: String = null) { + me { + id + statefulNotificationsWithoutBulletinEnabled(first: $first, after: $after) { + pageInfo { + endCursor + hasNextPage + } + nodes { + id + body + title + deepLink + acknowledgedAt + createdAt + bulletinEnabled + } + } + } +} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications.gql b/dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications.gql new file mode 100644 index 0000000000..3af9a7f90c --- /dev/null +++ b/dev/vendor/galoy-quickstart/graphql/gql/list-stateful-notifications.gql @@ -0,0 +1,20 @@ +query listStatefulNotifications($first: Int = 2, $after: String = null) { + me { + id + statefulNotifications(first: $first, after: $after) { + pageInfo { + endCursor + hasNextPage + } + nodes { + id + body + title + deepLink + acknowledgedAt + createdAt + bulletinEnabled + } + } + } +} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/list-unacknowledged-stateful-notifications-with-bulletin-enabled.gql b/dev/vendor/galoy-quickstart/graphql/gql/list-unacknowledged-stateful-notifications-with-bulletin-enabled.gql new file mode 100644 index 0000000000..4c56c0a8fb --- /dev/null +++ b/dev/vendor/galoy-quickstart/graphql/gql/list-unacknowledged-stateful-notifications-with-bulletin-enabled.gql @@ -0,0 +1,19 @@ +query listUnacknowledgedStatefulNotificationsWithBulletinEnabled($first: Int = 2, $after: String = null) { + me { + id + unacknowledgedStatefulNotificationsWithBulletinEnabled(first: $first, after: $after) { + pageInfo { + endCursor + hasNextPage + } + nodes { + id + body + title + deepLink + acknowledgedAt + createdAt + } + } + } +} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/support-chat-reset.gql b/dev/vendor/galoy-quickstart/graphql/gql/support-chat-reset.gql new file mode 100644 index 0000000000..9c485aa7f2 --- /dev/null +++ b/dev/vendor/galoy-quickstart/graphql/gql/support-chat-reset.gql @@ -0,0 +1,5 @@ +mutation supportChatReset { + supportChatReset { + success + } +} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/unacknowledged-stateful-notifications-without-bulletin-enabled-count.gql b/dev/vendor/galoy-quickstart/graphql/gql/unacknowledged-stateful-notifications-without-bulletin-enabled-count.gql new file mode 100644 index 0000000000..2ca88aa448 --- /dev/null +++ b/dev/vendor/galoy-quickstart/graphql/gql/unacknowledged-stateful-notifications-without-bulletin-enabled-count.gql @@ -0,0 +1,6 @@ +query unacknowledgedStatefulNotificationsWithoutBulletinEnabledCount { + me { + id + unacknowledgedStatefulNotificationsWithoutBulletinEnabledCount + } +} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-category.gql b/dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-category.gql deleted file mode 100644 index 5a7ac5c7e6..0000000000 --- a/dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-category.gql +++ /dev/null @@ -1,12 +0,0 @@ -mutation userDisableNotificationCategory( - $input: UserDisableNotificationCategoryInput! -) { - userDisableNotificationCategory(input: $input) { - notificationSettings { - push { - enabled - disabledCategories - } - } - } -} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-channel.gql b/dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-channel.gql deleted file mode 100644 index b9ad7df580..0000000000 --- a/dev/vendor/galoy-quickstart/graphql/gql/user-disable-notification-channel.gql +++ /dev/null @@ -1,12 +0,0 @@ -mutation userDisableNotificationChannel( - $input: UserDisableNotificationChannelInput! -) { - userDisableNotificationChannel(input: $input) { - notificationSettings { - push { - enabled - disabledCategories - } - } - } -} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-category.gql b/dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-category.gql deleted file mode 100644 index e613b1b742..0000000000 --- a/dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-category.gql +++ /dev/null @@ -1,12 +0,0 @@ -mutation userEnableNotificationCategory( - $input: UserEnableNotificationCategoryInput! -) { - userEnableNotificationCategory(input: $input) { - notificationSettings { - push { - enabled - disabledCategories - } - } - } -} diff --git a/dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-channel.gql b/dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-channel.gql deleted file mode 100644 index d52dfdd58f..0000000000 --- a/dev/vendor/galoy-quickstart/graphql/gql/user-enable-notification-channel.gql +++ /dev/null @@ -1,12 +0,0 @@ -mutation userEnableNotificationChannel( - $input: UserEnableNotificationChannelInput! -) { - userEnableNotificationChannel(input: $input) { - notificationSettings { - push { - enabled - disabledCategories - } - } - } -} diff --git a/dev/vendor/galoy-quickstart/graphql/schemas/admin/schema.graphql b/dev/vendor/galoy-quickstart/graphql/schemas/admin/schema.graphql index 18b6bcc4cf..bb6dc01b85 100644 --- a/dev/vendor/galoy-quickstart/graphql/schemas/admin/schema.graphql +++ b/dev/vendor/galoy-quickstart/graphql/schemas/admin/schema.graphql @@ -8,6 +8,7 @@ scalar AccountId enum AccountLevel { ONE + THREE TWO ZERO } @@ -133,12 +134,34 @@ type Coordinates { """A CCA2 country code (ex US, FR, etc)""" scalar CountryCode -enum DeepLink { +enum DeepLinkAction { + SET_DEFAULT_ACCOUNT_MODAL + SET_LN_ADDRESS_MODAL + UPGRADE_ACCOUNT_MODAL +} + +enum DeepLinkScreen { + CHAT CIRCLES + CONVERT EARN + HOME MAP PEOPLE PRICE + RECEIVE + SCAN_QR + SETTINGS + SETTINGS_2FA + SETTINGS_ACCOUNT + SETTINGS_DEFAULT_ACCOUNT + SETTINGS_DISPLAY_CURRENCY + SETTINGS_EMAIL + SETTINGS_LANGUAGE + SETTINGS_NOTIFICATIONS + SETTINGS_SECURITY + SETTINGS_THEME + SETTINGS_TX_LIMITS } """Display currency of an account""" @@ -158,6 +181,9 @@ interface Error { path: [String] } +"""Url that will be fetched on events for the account""" +scalar ExternalUrl + type GraphQLApplicationError implements Error { code: String message: String! @@ -267,16 +293,21 @@ enum LnPaymentStatus { scalar LnPubkey -input LocalizedPushContentInput { +input LocalizedNotificationContentInput { body: String! language: Language! title: String! } input MarketingNotificationTriggerInput { - deepLink: DeepLink - localizedPushContents: [LocalizedPushContentInput!]! + icon: NotificationIcon + localizedNotificationContents: [LocalizedNotificationContentInput!]! + openDeepLink: OpenDeepLinkInput + openExternalUrl: OpenExternalUrlInput phoneCountryCodesFilter: [CountryCode!] + shouldAddToBulletin: Boolean! + shouldAddToHistory: Boolean! + shouldSendPush: Boolean! userIdsFilter: [ID!] } @@ -321,11 +352,74 @@ type Mutation { userUpdatePhone(input: UserUpdatePhoneInput!): AccountDetailPayload! } +enum NotificationIcon { + ARROW_LEFT + ARROW_RIGHT + BACKSPACE + BANK + BELL + BITCOIN + BOOK + BTC_BOOK + CARET_DOWN + CARET_LEFT + CARET_RIGHT + CARET_UP + CHECK + CHECK_CIRCLE + CLOSE + CLOSE_CROSS_WITH_BACKGROUND + COINS + COPY_PASTE + DOLLAR + EYE + EYE_SLASH + FILTER + GLOBE + GRAPH + IMAGE + INFO + LIGHTNING + LINK + LOADING + MAGNIFYING_GLASS + MAP + MENU + NOTE + PAYMENT_ERROR + PAYMENT_PENDING + PAYMENT_SUCCESS + PENCIL + PEOPLE + QR_CODE + QUESTION + RANK + RECEIVE + REFRESH + SEND + SETTINGS + SHARE + TRANSFER + USER + VIDEO + WARNING + WARNING_WITH_BACKGROUND +} + """An address for an on-chain bitcoin destination""" scalar OnChainAddress scalar OnChainTxHash +input OpenDeepLinkInput { + action: DeepLinkAction + screen: DeepLinkScreen +} + +input OpenExternalUrlInput { + url: ExternalUrl! +} + """Information about pagination in a connection.""" type PageInfo { """When paginating forwards, the cursor to continue.""" diff --git a/dev/vendor/galoy-quickstart/graphql/schemas/public/schema.graphql b/dev/vendor/galoy-quickstart/graphql/schemas/public/schema.graphql index 8884e7f96d..ab5af81e59 100644 --- a/dev/vendor/galoy-quickstart/graphql/schemas/public/schema.graphql +++ b/dev/vendor/galoy-quickstart/graphql/schemas/public/schema.graphql @@ -1,5 +1,6 @@ interface Account { callbackEndpoints: [CallbackEndpoint!]! + callbackPortalUrl: String! csvTransactions(walletIds: [WalletId!]!): String! defaultWallet: PublicWallet! defaultWalletId: WalletId! @deprecated(reason: "Shifting property to 'defaultWallet.id'") @@ -67,6 +68,7 @@ input AccountEnableNotificationChannelInput { enum AccountLevel { ONE + THREE TWO ZERO } @@ -257,6 +259,7 @@ type CentAmountPayload { type ConsumerAccount implements Account { callbackEndpoints: [CallbackEndpoint!]! + callbackPortalUrl: String! """ return CSV stream, base64 encoded, of the list of transactions in the wallet @@ -579,6 +582,7 @@ input LnInvoiceCreateInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -594,6 +598,7 @@ input LnInvoiceCreateOnBehalfOfRecipientInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -662,6 +667,7 @@ type LnNoAmountInvoice implements Invoice { input LnNoAmountInvoiceCreateInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -675,6 +681,7 @@ input LnNoAmountInvoiceCreateInput { input LnNoAmountInvoiceCreateOnBehalfOfRecipientInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -755,6 +762,7 @@ input LnUsdInvoiceBtcDenominatedCreateOnBehalfOfRecipientInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """ Optional memo for the lightning invoice. Acts as a note to the recipient. @@ -771,6 +779,7 @@ input LnUsdInvoiceCreateInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """Optional memo for the lightning invoice.""" memo: Memo @@ -786,6 +795,7 @@ input LnUsdInvoiceCreateOnBehalfOfRecipientInput { """Optional invoice expiration time in minutes.""" expiresIn: Minutes + externalId: TxExternalId """ Optional memo for the lightning invoice. Acts as a note to the recipient. @@ -985,6 +995,7 @@ type Mutation { onChainUsdPaymentSendAsBtcDenominated(input: OnChainUsdPaymentSendAsBtcDenominatedInput!): PaymentSendPayload! quizClaim(input: QuizClaimInput!): QuizClaimPayload! supportChatMessageAdd(input: SupportChatMessageAddInput!): SupportChatMessageAddPayload! + supportChatReset: SuccessPayload! userContactUpdateAlias(input: UserContactUpdateAliasInput!): UserContactUpdateAliasPayload! @deprecated(reason: "will be moved to AccountContact") userEmailDelete: UserEmailDeletePayload! userEmailRegistrationInitiate(input: UserEmailRegistrationInitiateInput!): UserEmailRegistrationInitiatePayload! From b488f21e3863c1e68252170043a9be093eaab701 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 11:29:17 -0500 Subject: [PATCH 02/39] test: add/fix ios e2e test github action --- .../{e2e-android.yml => e2e-ios.yml} | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) rename .github/workflows/{e2e-android.yml => e2e-ios.yml} (64%) diff --git a/.github/workflows/e2e-android.yml b/.github/workflows/e2e-ios.yml similarity index 64% rename from .github/workflows/e2e-android.yml rename to .github/workflows/e2e-ios.yml index 800a355c29..4f13a92d39 100644 --- a/.github/workflows/e2e-android.yml +++ b/.github/workflows/e2e-ios.yml @@ -1,4 +1,4 @@ -name: Android E2E Tests +name: iOS E2E Tests on: pull_request: @@ -20,11 +20,22 @@ jobs: - name: Run the Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: List available simulators + run: xcrun simctl list devices available + + - name: Create iOS Simulator + run: | + DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-16-2) + echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV + + - name: Boot Simulator + run: xcrun simctl boot $DEVICE_ID + - name: Install dependencies run: nix develop -c yarn install - name: Build E2E tests - run: nix develop -c yarn e2e:build android.emu.debug + run: nix develop -c yarn e2e:build ios.sim.debug - name: Start Metro, Tilt, Emulator, and run tests id: run-tests @@ -37,33 +48,31 @@ jobs: echo $! > /tmp/pids/metro.pid # Start Tilt in background - cd dev && TILT_CI=true nix develop -c tilt up & + cd dev && nix develop -c tilt up & echo $! > /tmp/pids/tilt.pid # Wait for galoy UI resource to be ready (timeout after 5 minutes) nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m - # Start emulator in background - emulator -avd Pixel_API_34 -gpu swiftshader -wipe-data -no-boot-anim -no-window & - echo $! > /tmp/pids/emulator.pid - # Wait for device to be ready - adb wait-for-device + while ! xcrun simctl list devices | grep "(Booted)"; do + sleep 5 + echo "Waiting for Simulator device to come online..." + done # Start screen recording - adb shell screenrecord --bit-rate 4000000 /sdcard/screenRecord.mp4 & - echo $! > /tmp/pids/screenrecord.pid + rm -rf ios-recordings || true + xcrun simctl io booted recordVideo screenRecord.mov & + echo $! > /tmp/pids/sim_record.pid # Trigger dev setup and run tests cd dev && nix develop -c tilt trigger dev-setup + nix develop -c tilt wait --for=condition=Ready "uiresource/dev-setup" --timeout=5m # Run the E2E tests - nix develop -c yarn e2e:test android.emu.debug -d --take-screenshots all --record-videos all --record-logs all --artifacts-location android-recordings + nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ios-recordings TEST_EXIT_CODE=$? - # Pull the screen recording - adb pull /sdcard/screenRecord.mp4 android-recordings/ - exit $TEST_EXIT_CODE - name: Cleanup Processes @@ -88,10 +97,9 @@ jobs: done # Additional cleanup commands just to be thorough + cd dev && nix develop -c tilt down pkill -f "node.*metro" || true pkill -f "tilt" || true - pkill -f "emulator" || true - adb shell pkill -f "screenrecord" || true - name: Upload test artifacts if: always() @@ -99,5 +107,5 @@ jobs: with: name: test-artifacts path: | - android-recordings/ - android-recordings/screenRecord.mp4 + ios-recordings/ + ios-recordings/screenRecord.mov From 0d776b37a8fd5b1c30d06933a6681fe3692b2f90 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 11:32:18 -0500 Subject: [PATCH 03/39] fix: iOS device version --- .github/workflows/e2e-ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 4f13a92d39..e2d0dde0fd 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -25,7 +25,7 @@ jobs: - name: Create iOS Simulator run: | - DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-16-2) + DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-18-1) echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV - name: Boot Simulator From aad73767c9dd41e5d660e753913d692857d986db Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 12:24:37 -0500 Subject: [PATCH 04/39] fix: add docker --- .github/workflows/e2e-ios.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index e2d0dde0fd..02ca74b712 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -10,7 +10,7 @@ concurrency: jobs: e2e-test: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v4 @@ -23,13 +23,8 @@ jobs: - name: List available simulators run: xcrun simctl list devices available - - name: Create iOS Simulator - run: | - DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-18-1) - echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV - - - name: Boot Simulator - run: xcrun simctl boot $DEVICE_ID + - name: Set up Docker + uses: douglascamata/setup-docker-macos-action@v1-alpha - name: Install dependencies run: nix develop -c yarn install @@ -37,6 +32,14 @@ jobs: - name: Build E2E tests run: nix develop -c yarn e2e:build ios.sim.debug + - name: Create iOS Simulator + run: | + DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-17-2) + echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV + + - name: Boot Simulator + run: xcrun simctl boot $DEVICE_ID + - name: Start Metro, Tilt, Emulator, and run tests id: run-tests run: | @@ -48,7 +51,7 @@ jobs: echo $! > /tmp/pids/metro.pid # Start Tilt in background - cd dev && nix develop -c tilt up & + nix develop -c tilt up -f ./dev/Tiltfile & echo $! > /tmp/pids/tilt.pid # Wait for galoy UI resource to be ready (timeout after 5 minutes) @@ -66,7 +69,7 @@ jobs: echo $! > /tmp/pids/sim_record.pid # Trigger dev setup and run tests - cd dev && nix develop -c tilt trigger dev-setup + nix develop -c tilt trigger dev-setup nix develop -c tilt wait --for=condition=Ready "uiresource/dev-setup" --timeout=5m # Run the E2E tests @@ -97,7 +100,7 @@ jobs: done # Additional cleanup commands just to be thorough - cd dev && nix develop -c tilt down + nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true From 49e47aea0253d6dd737da68d940f542601f57f68 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 15:27:22 -0500 Subject: [PATCH 05/39] test: add cache to e2e ios --- .github/workflows/e2e-ios.yml | 36 ++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 02ca74b712..18235fa4d5 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -26,6 +26,34 @@ jobs: - name: Set up Docker uses: douglascamata/setup-docker-macos-action@v1-alpha + - name: Cache Node Modules + uses: actions/cache@v4 + id: node-cache + with: + path: | + node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Cache Pods + uses: actions/cache@v4 + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Cache iOS Build + uses: actions/cache@v4 + with: + path: | + ios/build + ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj') }}-${{ hashFiles('ios/**/*.xcconfig') }} + restore-keys: | + ${{ runner.os }}-ios-build- + - name: Install dependencies run: nix develop -c yarn install @@ -46,13 +74,15 @@ jobs: # Create directory for PID files mkdir -p /tmp/pids + # Start Tilt in background + nix develop -c tilt up -f ./dev/Tiltfile & + echo $! > /tmp/pids/tilt.pid + # Start Metro in background nix develop -c yarn start & echo $! > /tmp/pids/metro.pid - # Start Tilt in background - nix develop -c tilt up -f ./dev/Tiltfile & - echo $! > /tmp/pids/tilt.pid + sleep 5 # Wait for galoy UI resource to be ready (timeout after 5 minutes) nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m From 06d7db8df119f53dd222111dd1b4d260ef7e7fdf Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 16:35:31 -0500 Subject: [PATCH 06/39] fix: wait for tilt to start --- .github/workflows/e2e-ios.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 18235fa4d5..50c7299693 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -74,15 +74,19 @@ jobs: # Create directory for PID files mkdir -p /tmp/pids - # Start Tilt in background - nix develop -c tilt up -f ./dev/Tiltfile & - echo $! > /tmp/pids/tilt.pid - # Start Metro in background nix develop -c yarn start & echo $! > /tmp/pids/metro.pid - sleep 5 + # Start Tilt in background + nix develop -c tilt up -f ./dev/Tiltfile & + echo $! > /tmp/pids/tilt.pid + + # Wait for Tilt to be ready with retries + until nix develop -c tilt get uiresource >/dev/null 2>&1; do + echo "Waiting for Tilt to be ready..." + sleep 5 + done # Wait for galoy UI resource to be ready (timeout after 5 minutes) nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m From deecad76b791072aef7ece3e7dc4005271c207e9 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 19:32:21 -0500 Subject: [PATCH 07/39] chore: change docker installation --- .github/workflows/e2e-ios.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 50c7299693..fa44d1538a 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -20,11 +20,14 @@ jobs: - name: Run the Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: List available simulators - run: xcrun simctl list devices available - - - name: Set up Docker - uses: douglascamata/setup-docker-macos-action@v1-alpha + - name: Set up Docker in background + run: | + brew install docker docker-compose colima + colima start --cpu 4 --memory 8 --disk 60 & + while ! docker info > /dev/null 2>&1; do + echo "Waiting for Docker to be ready..." + sleep 5 + done - name: Cache Node Modules uses: actions/cache@v4 @@ -137,6 +140,7 @@ jobs: nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true + colima stop || true - name: Upload test artifacts if: always() From 958b80e588fae9f632a2e27cc331b6471e77a422 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 19:46:24 -0500 Subject: [PATCH 08/39] perf: install from lock and improbe ios build --- .detoxrc.js | 13 ++++++++++++- .github/workflows/e2e-ios.yml | 5 ++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.detoxrc.js b/.detoxrc.js index c36051b3f6..c2e7b99979 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -14,7 +14,18 @@ module.exports = { type: "ios.app", binaryPath: "ios/build/Build/Products/Debug-iphonesimulator/Blink.app", build: - "xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", + "xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build " + + "-parallelizeTargets " + + "-maximum-concurrent-compilers 8 " + + "ONLY_ACTIVE_ARCH=YES " + + "COMPILER_INDEX_STORE_ENABLE=NO " + + "BUILD_LIBRARY_FOR_DISTRIBUTION=NO " + + "CODE_SIGNING_REQUIRED=NO " + + "CODE_SIGN_IDENTITY='' " + + "ENABLE_BITCODE=NO " + + "GCC_OPTIMIZATION_LEVEL=0 " + + "SWIFT_OPTIMIZATION_LEVEL=-Onone " + + "-quiet | xcbeautify", }, "android.debug": { type: "android.apk", diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index fa44d1538a..442285a8ae 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -30,6 +30,7 @@ jobs: done - name: Cache Node Modules + if: always() uses: actions/cache@v4 id: node-cache with: @@ -40,6 +41,7 @@ jobs: ${{ runner.os }}-node- - name: Cache Pods + if: always() uses: actions/cache@v4 with: path: ios/Pods @@ -48,6 +50,7 @@ jobs: ${{ runner.os }}-pods- - name: Cache iOS Build + if: always() uses: actions/cache@v4 with: path: | @@ -58,7 +61,7 @@ jobs: ${{ runner.os }}-ios-build- - name: Install dependencies - run: nix develop -c yarn install + run: nix develop -c yarn install --frozen-lockfile --prefer-offline - name: Build E2E tests run: nix develop -c yarn e2e:build ios.sim.debug From 4538d1b4b9f6bc41ba67026fee59f1d10bdd54f8 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 20:33:49 -0500 Subject: [PATCH 09/39] perf: improve cache --- .detoxrc.js | 2 +- .github/workflows/e2e-ios.yml | 54 ++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.detoxrc.js b/.detoxrc.js index c2e7b99979..62acd4f5d7 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -16,7 +16,7 @@ module.exports = { build: "xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build " + "-parallelizeTargets " + - "-maximum-concurrent-compilers 8 " + + "-jobs 8 " + "ONLY_ACTIVE_ARCH=YES " + "COMPILER_INDEX_STORE_ENABLE=NO " + "BUILD_LIBRARY_FOR_DISTRIBUTION=NO " + diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 442285a8ae..ecbc4a8c09 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -20,38 +20,42 @@ jobs: - name: Run the Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Set up Docker in background + - name: Set up Docker and pull images in background run: | brew install docker docker-compose colima colima start --cpu 4 --memory 8 --disk 60 & + + # Wait for Docker to be ready while ! docker info > /dev/null 2>&1; do echo "Waiting for Docker to be ready..." sleep 5 done - - name: Cache Node Modules - if: always() - uses: actions/cache@v4 - id: node-cache + # Start pulling images in background + docker-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --quiet & + + - name: Restore Node Modules Cache + id: cache-node-restore + uses: actions/cache/restore@v4 with: path: | node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node- + ${{ runner.os }}-node-modules- - - name: Cache Pods - if: always() - uses: actions/cache@v4 + - name: Restore Pods Cache + id: cache-pods-restore + uses: actions/cache/restore@v4 with: path: ios/Pods key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- - - name: Cache iOS Build - if: always() - uses: actions/cache@v4 + - name: Restore iOS Build Cache + id: cache-ios-build-restore + uses: actions/cache/restore@v4 with: path: | ios/build @@ -63,9 +67,33 @@ jobs: - name: Install dependencies run: nix develop -c yarn install --frozen-lockfile --prefer-offline + - name: Save Node Modules Cache + if: always() # This will run even if previous steps fail + uses: actions/cache/save@v4 + with: + path: | + node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} + - name: Build E2E tests run: nix develop -c yarn e2e:build ios.sim.debug + - name: Save Pods Cache + if: always() + uses: actions/cache/save@v4 + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + + - name: Save iOS Build Cache + if: always() + uses: actions/cache/save@v4 + with: + path: | + ios/build + ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj') }}-${{ hashFiles('ios/**/*.xcconfig') }} + - name: Create iOS Simulator run: | DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-17-2) From 0ebff7ce5c9e152ed4677e2de8d7a20fa600803b Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 10 Dec 2024 21:43:08 -0500 Subject: [PATCH 10/39] chore: reduce tilt logs in gh action step --- .github/workflows/e2e-ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index ecbc4a8c09..3dd64035c7 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -113,7 +113,7 @@ jobs: echo $! > /tmp/pids/metro.pid # Start Tilt in background - nix develop -c tilt up -f ./dev/Tiltfile & + nix develop -c tilt up -f ./dev/Tiltfile > /tmp/logs/tilt.log 2>&1 & echo $! > /tmp/pids/tilt.pid # Wait for Tilt to be ready with retries From e01e8af8b17e04f20ad9c3b7733a3be714e4d47c Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Dec 2024 13:50:03 -0500 Subject: [PATCH 11/39] fix: split metro and tilt start --- .github/workflows/e2e-ios.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 3dd64035c7..7094827858 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -68,7 +68,7 @@ jobs: run: nix develop -c yarn install --frozen-lockfile --prefer-offline - name: Save Node Modules Cache - if: always() # This will run even if previous steps fail + if: always() uses: actions/cache/save@v4 with: path: | @@ -102,29 +102,35 @@ jobs: - name: Boot Simulator run: xcrun simctl boot $DEVICE_ID - - name: Start Metro, Tilt, Emulator, and run tests - id: run-tests + - name: Start Metro run: | - # Create directory for PID files mkdir -p /tmp/pids - - # Start Metro in background nix develop -c yarn start & echo $! > /tmp/pids/metro.pid - # Start Tilt in background - nix develop -c tilt up -f ./dev/Tiltfile > /tmp/logs/tilt.log 2>&1 & + # Wait for Metro to be ready + while ! lsof -i:8081 >/dev/null 2>&1; do + echo "Waiting for Metro to be ready..." + sleep 5 + done + + - name: Start Tilt + run: | + nix develop -c tilt up -f ./dev/Tiltfile & echo $! > /tmp/pids/tilt.pid - # Wait for Tilt to be ready with retries + # Wait for Tilt to be ready until nix develop -c tilt get uiresource >/dev/null 2>&1; do echo "Waiting for Tilt to be ready..." sleep 5 done - # Wait for galoy UI resource to be ready (timeout after 5 minutes) + # Wait for galoy UI resource to be ready nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m + - name: Run E2E Tests + id: run-tests + run: | # Wait for device to be ready while ! xcrun simctl list devices | grep "(Booted)"; do sleep 5 @@ -142,9 +148,6 @@ jobs: # Run the E2E tests nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ios-recordings - TEST_EXIT_CODE=$? - - exit $TEST_EXIT_CODE - name: Cleanup Processes if: always() @@ -167,7 +170,7 @@ jobs: [ -f "$pidfile" ] && kill_process "$pidfile" done - # Additional cleanup commands just to be thorough + # Additional cleanup commands nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true From 874b1bf69c45376a93d79a03090638795498f579 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Dec 2024 19:07:09 -0500 Subject: [PATCH 12/39] chore: update tilt ready timeout --- .github/workflows/e2e-ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 7094827858..afd37ea050 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -126,7 +126,7 @@ jobs: done # Wait for galoy UI resource to be ready - nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m + nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=10m - name: Run E2E Tests id: run-tests From bb652a4acdf52546658ea24db9fe8a74f2bb3829 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Dec 2024 21:02:28 -0500 Subject: [PATCH 13/39] chore: update timeout for api ready --- .github/workflows/e2e-ios.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index afd37ea050..34c7084c0b 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -126,7 +126,11 @@ jobs: done # Wait for galoy UI resource to be ready - nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=10m + echo "Waiting for Blink API to be ready..." + nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=20m + TEST_EXIT_CODE=$? + echo "Exit with code: $TEST_EXIT_CODE" + exit $TEST_EXIT_CODE - name: Run E2E Tests id: run-tests From 72d88f194486289fc2a41970a5530c78b675dd49 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Dec 2024 21:45:12 -0500 Subject: [PATCH 14/39] test: move test cmd to tilt file --- .github/workflows/e2e-ios.yml | 24 +----------------------- dev/Tiltfile | 13 +++++++++++++ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 34c7084c0b..90cbbd90da 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -114,24 +114,6 @@ jobs: sleep 5 done - - name: Start Tilt - run: | - nix develop -c tilt up -f ./dev/Tiltfile & - echo $! > /tmp/pids/tilt.pid - - # Wait for Tilt to be ready - until nix develop -c tilt get uiresource >/dev/null 2>&1; do - echo "Waiting for Tilt to be ready..." - sleep 5 - done - - # Wait for galoy UI resource to be ready - echo "Waiting for Blink API to be ready..." - nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=20m - TEST_EXIT_CODE=$? - echo "Exit with code: $TEST_EXIT_CODE" - exit $TEST_EXIT_CODE - - name: Run E2E Tests id: run-tests run: | @@ -146,12 +128,8 @@ jobs: xcrun simctl io booted recordVideo screenRecord.mov & echo $! > /tmp/pids/sim_record.pid - # Trigger dev setup and run tests - nix develop -c tilt trigger dev-setup - nix develop -c tilt wait --for=condition=Ready "uiresource/dev-setup" --timeout=5m - # Run the E2E tests - nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ios-recordings + nix develop -c tilt ci ios-e2e-tests - name: Cleanup Processes if: always() diff --git a/dev/Tiltfile b/dev/Tiltfile index 5a370207d7..45785fcb20 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -7,6 +7,7 @@ local_resource( "bria", ] ) + local_resource( name='init-lightning', labels = ['dev-setup'], @@ -46,6 +47,7 @@ local_resource( labels = ['dev-setup'], cmd='bin/dev-setup.sh', resource_deps = [ + "galoy" "dev-ln-setup" ] ) @@ -58,3 +60,14 @@ local_resource( "dev-setup" ] ) + +# iOS E2E test +local_resource( + name='ios-e2e-tests', + labels = ['test'], + cmd=''' + # Run the tests + nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ./ios-recordings + ''', + resource_deps = ["dev-setup"] +) From 8f47175b92faf5448f92fcd1d1b3ead7f3b7ba1b Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Dec 2024 21:59:55 -0500 Subject: [PATCH 15/39] fix: update tilt file and test cmd --- .github/workflows/e2e-ios.yml | 2 +- dev/Tiltfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 90cbbd90da..dec1983f7b 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -129,7 +129,7 @@ jobs: echo $! > /tmp/pids/sim_record.pid # Run the E2E tests - nix develop -c tilt ci ios-e2e-tests + nix develop -c tilt ci ios-e2e-tests -f ./dev/Tiltfile - name: Cleanup Processes if: always() diff --git a/dev/Tiltfile b/dev/Tiltfile index 45785fcb20..a06fb66db5 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -47,7 +47,7 @@ local_resource( labels = ['dev-setup'], cmd='bin/dev-setup.sh', resource_deps = [ - "galoy" + "galoy", "dev-ln-setup" ] ) From b5d6dd9854dd2fa2582a4ca95a26722014018e6f Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Dec 2024 22:44:06 -0500 Subject: [PATCH 16/39] fix: init onchain --- dev/Tiltfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/Tiltfile b/dev/Tiltfile index a06fb66db5..b752b2d40e 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -1,7 +1,7 @@ local_resource( - name='init-onchain', - labels = ['dev-setup'], - cmd='vendor/galoy-quickstart/bin/init-onchain.sh', + name="init-onchain", + labels = ["dev-setup"], + cmd="vendor/galoy-quickstart/bin/init-onchain.sh", resource_deps = [ "bitcoind", "bria", @@ -13,6 +13,7 @@ local_resource( labels = ['dev-setup'], cmd='vendor/galoy-quickstart/bin/init-lightning.sh', resource_deps = [ + "init-onchain", "lnd1", "lnd-outside-1", ] From 2d2944a0ecbdf1bd1173ca9f78d7bba24949c3bb Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 00:04:55 -0500 Subject: [PATCH 17/39] chore: update detox --- package.json | 2 +- yarn.lock | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index d37462e286..41db2b6488 100644 --- a/package.json +++ b/package.json @@ -216,7 +216,7 @@ "browserstack-local": "^1.5.1", "cross-fetch": "^4.0.0", "csv-parse": "^5.5.5", - "detox": "^20.20.2", + "detox": "^20.28.0", "dotenv": "^16.4.5", "eslint": "^8.33.0", "eslint-config-prettier": "^8.6.0", diff --git a/yarn.lock b/yarn.lock index d08f35f0c5..b1155dddae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11046,10 +11046,15 @@ detect-port@^1.3.0: address "^1.0.1" debug "4" -detox@^20.20.2: - version "20.20.2" - resolved "https://registry.npmjs.org/detox/-/detox-20.20.2.tgz#988619d99e08bd992931458e3db7af248254bf31" - integrity sha512-X0FWsj8Bry965fEy7N87bKecIIkcAg3AyaCDXFa0yO+kAIajFbSV7LMtNTQP/c1D0eD4+U5sn9zUJWWhQhucWg== +detox-copilot@^0.0.24: + version "0.0.24" + resolved "https://registry.yarnpkg.com/detox-copilot/-/detox-copilot-0.0.24.tgz#e505073866d1f4ff00641f2e48ef441a4dff6bbc" + integrity sha512-42g0QyJS31URl28YRxc4hGozSXhbbB1sKwzxEjZR9WtLoSx6WYDsQkQD8+yP5t1NExiSCZAfvNmBw8PYQwDKwg== + +detox@^20.28.0: + version "20.28.0" + resolved "https://registry.yarnpkg.com/detox/-/detox-20.28.0.tgz#7ae848e8df028c17d65cd0672040cd1c18338b25" + integrity sha512-JeUkWNnYE7lqby3S9AeYJP3ttCBKH+qZWACjWXwvSbe3tm6JeXvecVUYkzSoNfC4IzTX5p+rWvG0IPsfOsZSFw== dependencies: ajv "^8.6.3" bunyan "^1.8.12" @@ -11057,13 +11062,14 @@ detox@^20.20.2: caf "^15.0.1" chalk "^4.0.0" child-process-promise "^2.2.0" + detox-copilot "^0.0.24" execa "^5.1.1" find-up "^5.0.0" fs-extra "^11.0.0" funpermaproxy "^1.1.0" glob "^8.0.3" ini "^1.3.4" - jest-environment-emit "^1.0.5" + jest-environment-emit "^1.0.8" json-cycle "^1.3.0" lodash "^4.17.11" multi-sort-stream "^1.0.3" @@ -15484,10 +15490,10 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" -jest-environment-emit@^1.0.5: - version "1.0.7" - resolved "https://registry.npmjs.org/jest-environment-emit/-/jest-environment-emit-1.0.7.tgz#14c2197e9fa48affa25b15fc5f4a74690aea7efd" - integrity sha512-/0AYqbL3zrfRTtGyzTZwgRxQZiDXEM8ZUfY7Uscla/XGs9vszx4f0XTSZqAk3CQaiwYAoKvFZkB2vSKm1Q08fQ== +jest-environment-emit@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/jest-environment-emit/-/jest-environment-emit-1.0.8.tgz#ab0dad2c1dd04d3ca092762a99080607b0eef10b" + integrity sha512-WNqvxBLH0yNojHJQ99Y21963aT7UTavxV3PgiBQFi8zwrlnKU6HvkB6LOvQrbk5I8mI8JEKvcoOrQOvBVMLIXQ== dependencies: bunyamin "^1.5.2" bunyan "^2.0.5" From 6e4afd3db2a9a182324298c009ce5bde17242c8d Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 11:02:59 -0500 Subject: [PATCH 18/39] chore: vendir sync --- dev/vendir.lock.yml | 6 +++--- dev/vendir.yml | 2 +- dev/vendor/galoy-quickstart/docker-compose.yml | 15 ++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dev/vendir.lock.yml b/dev/vendir.lock.yml index 69b639b288..48c64fc5b0 100644 --- a/dev/vendir.lock.yml +++ b/dev/vendir.lock.yml @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@bd56a94ac9142ba771aa6d1e193c449c669bf2706f5de5727ffab7e50460eb4a' - sha: eddc43c797bbb3af3400c22a347b8968972b4c03 + commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@3a56597239aa1caf5c59cca1861c812310c6b3f99020de93527590439522d63b' + sha: 1f4ebb78cdfecd9e7b815eabe3a1dee1379954f1 tags: - - 0.21.15 + - 0.21.16 path: galoy-quickstart path: vendor kind: LockConfig diff --git a/dev/vendir.yml b/dev/vendir.yml index 6ca86e15a8..17e1d60340 100644 --- a/dev/vendir.yml +++ b/dev/vendir.yml @@ -7,7 +7,7 @@ directories: - path: galoy-quickstart git: url: https://github.com/GaloyMoney/blink.git - ref: "0.21.15" + ref: "0.21.16" depth: 1 includePaths: - quickstart/bin/* diff --git a/dev/vendor/galoy-quickstart/docker-compose.yml b/dev/vendor/galoy-quickstart/docker-compose.yml index 10cbb72e87..945f4b4492 100644 --- a/dev/vendor/galoy-quickstart/docker-compose.yml +++ b/dev/vendor/galoy-quickstart/docker-compose.yml @@ -98,7 +98,7 @@ services: - POSTGRES_PASSWORD=secret - POSTGRES_DB=hydra galoy: - image: us.gcr.io/galoy-org/galoy-api@sha256:bd56a94ac9142ba771aa6d1e193c449c669bf2706f5de5727ffab7e50460eb4a + image: us.gcr.io/galoy-org/galoy-api@sha256:3a56597239aa1caf5c59cca1861c812310c6b3f99020de93527590439522d63b environment: - HELMREVISION=dev - NETWORK=regtest @@ -139,7 +139,6 @@ services: - EXPORTER_PORT=3003 - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318 depends_on: - - trigger - apollo-router - oathkeeper - kratos @@ -149,12 +148,16 @@ services: - mongodb - redis - stablesats + - notifications + - price + - price-history + - svix networks: default: aliases: - bats-tests trigger: - image: us.gcr.io/galoy-org/galoy-api-trigger@sha256:c8479ff0088f3cbed3205e160d130a6fe2e8f1efb7b66d68e295fbb26c7eb119 + image: us.gcr.io/galoy-org/galoy-api-trigger@sha256:6057867f063ff205a9297a080d2d49e105bed20a8d41358d98cc01b978fddc69 environment: - HELMREVISION=dev - NETWORK=regtest @@ -195,9 +198,7 @@ services: - EXPORTER_PORT=3003 - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318 depends_on: - - lnd1 - - bria - - mongodb + - galoy notifications: image: us.gcr.io/galoy-org/galoy-notifications@sha256:71c53ab3d9a4282d44d0605b95f1691ebc23334e8108bd4d06021a0c627a1205 environment: @@ -241,7 +242,7 @@ services: environment: - MONGO_INITDB_DATABASE=galoy mongodb-migrate: - image: us.gcr.io/galoy-org/galoy-api-migrate@sha256:19b9cd06466116bc6d25d1c495438ac64b4fec05bde47ca9b83b7a8c1cd4633f + image: us.gcr.io/galoy-org/galoy-api-migrate@sha256:aa18803258d758b3d176460cf728d66f4c930783f8109919852a20a6a237821f depends_on: - mongodb environment: From b7e5897af34315d3b4df232984bf7706700dad0d Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 11:31:13 -0500 Subject: [PATCH 19/39] fix: avoid auto-init for e2e test --- dev/Tiltfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/Tiltfile b/dev/Tiltfile index b752b2d40e..2521c4698d 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -65,7 +65,8 @@ local_resource( # iOS E2E test local_resource( name='ios-e2e-tests', - labels = ['test'], + auto_init = False, + labels = ["test"], cmd=''' # Run the tests nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ./ios-recordings From 1b3f726dea6d602f7a5e2f021e091d26ebef25a9 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 20:00:19 -0500 Subject: [PATCH 20/39] fix: tilt deps --- .github/workflows/e2e-ios.yml | 2 +- dev/Tiltfile | 81 +++++++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index dec1983f7b..0cbc06ed73 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -129,7 +129,7 @@ jobs: echo $! > /tmp/pids/sim_record.pid # Run the E2E tests - nix develop -c tilt ci ios-e2e-tests -f ./dev/Tiltfile + nix develop -c tilt -f ./dev/Tiltfile ci -- --test ios-e2e-tests - name: Cleanup Processes if: always() diff --git a/dev/Tiltfile b/dev/Tiltfile index 2521c4698d..757c56b254 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -1,3 +1,6 @@ +config.define_string_list("test") +cfg = config.parse() + local_resource( name="init-onchain", labels = ["dev-setup"], @@ -9,9 +12,9 @@ local_resource( ) local_resource( - name='init-lightning', - labels = ['dev-setup'], - cmd='vendor/galoy-quickstart/bin/init-lightning.sh', + name="init-lightning", + labels = ["dev-setup"], + cmd="vendor/galoy-quickstart/bin/init-lightning.sh", resource_deps = [ "init-onchain", "lnd1", @@ -19,8 +22,8 @@ local_resource( ] ) -docker_compose('vendor/galoy-quickstart/docker-compose.yml') -galoy_services = ["apollo-router", "galoy", "trigger", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats", "notifications", "notifications-pg"] +docker_compose("vendor/galoy-quickstart/docker-compose.yml") +galoy_services = ["apollo-router", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats", "notifications", "notifications-pg"] auth_services = ["oathkeeper", "kratos", "kratos-pg", "hydra", "hydra-pg", "hydra-migrate"] bitcoin_services = ["bitcoind", "bitcoind-signer", "lnd1", "lnd-outside-1", "bria", "bria-pg", "fulcrum"] @@ -31,45 +34,77 @@ for service in auth_services: for service in bitcoin_services: dc_resource(service, labels = ["bitcoin"]) -dc_resource('otel-agent', labels = ["otel"]) -dc_resource('quickstart-test', labels = ['quickstart'], auto_init=False) +dc_resource("galoy", labels = ["galoy"], resource_deps = ["dev-ln-setup"]) +dc_resource("trigger", labels = ["galoy"], resource_deps = ["galoy", "dev-ln-setup"]) +dc_resource("otel-agent", labels = ["otel"]) +dc_resource("quickstart-test", labels = ["quickstart"], auto_init=False) local_resource( - name='dev-ln-setup', - labels = ['dev-setup'], - cmd='bin/dev-ln-setup.sh', + name="dev-ln-setup", + labels = ["dev-setup"], + cmd="bin/dev-ln-setup.sh", resource_deps = galoy_services + [ "init-lightning" ] ) local_resource( - name='dev-setup', - labels = ['dev-setup'], - cmd='bin/dev-setup.sh', + name="wait-for-galoy", + labels = ["dev-setup"], + cmd=''' + GALOY_ENDPOINT=${GALOY_ENDPOINT:-localhost:4455} + max_attempts=30 + attempt=1 + while [ $attempt -le $max_attempts ]; do + response=$(curl -s -X POST http://$GALOY_ENDPOINT/graphql \ + -H 'Content-Type: application/json' \ + -d '{"query":"query Globals { globals { network } }"}') + + # Check if response contains "errors" field + if echo "$response" | grep -q '"errors":'; then + echo "Attempt $attempt/$max_attempts: GraphQL server returned errors:" + echo "$response" + else + echo "GraphQL server is ready at $GALOY_ENDPOINT!" + exit 0 + fi + + echo "Waiting for GraphQL server at $GALOY_ENDPOINT..." + sleep 5 + attempt=$((attempt + 1)) + done + echo "GraphQL server failed to become ready at $GALOY_ENDPOINT" + exit 1 + ''', + resource_deps = ["galoy"] +) + +local_resource( + name="dev-setup", + labels = ["dev-setup"], + cmd="bin/dev-setup.sh", resource_deps = [ - "galoy", - "dev-ln-setup" + "wait-for-galoy", ] ) local_resource( - name='one-block-every-5s', - labels = ['dev-setup'], - serve_cmd='bin/one-block-every-5s.sh', + name="one-block-every-5s", + labels = ["dev-setup"], + serve_cmd="bin/one-block-every-5s.sh", resource_deps = [ - "dev-setup" + "dev-ln-setup" ] ) # iOS E2E test local_resource( - name='ios-e2e-tests', - auto_init = False, + name="ios-e2e-tests", + auto_init = "ios-e2e-tests" in cfg.get("test", []), labels = ["test"], - cmd=''' + cmd=""" # Run the tests nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ./ios-recordings - ''', + """, resource_deps = ["dev-setup"] ) From cc8c511d8674e276337cf3869c1644876068bc52 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 20:57:42 -0500 Subject: [PATCH 21/39] chore: set specific simulator version to build --- .detoxrc.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.detoxrc.js b/.detoxrc.js index 62acd4f5d7..97d790e939 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -14,7 +14,10 @@ module.exports = { type: "ios.app", binaryPath: "ios/build/Build/Products/Debug-iphonesimulator/Blink.app", build: - "xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build " + + "xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp " + + "-configuration Debug -sdk iphonesimulator " + + "-destination 'platform=iOS Simulator,name=iPhone SE (3rd generation)' " + + "-derivedDataPath ios/build " + "-parallelizeTargets " + "-jobs 8 " + "ONLY_ACTIVE_ARCH=YES " + @@ -25,7 +28,7 @@ module.exports = { "ENABLE_BITCODE=NO " + "GCC_OPTIMIZATION_LEVEL=0 " + "SWIFT_OPTIMIZATION_LEVEL=-Onone " + - "-quiet | xcbeautify", + "-quiet", }, "android.debug": { type: "android.apk", From ad4fcf520f11493c409f1e24a06253612db11b23 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 21:11:03 -0500 Subject: [PATCH 22/39] chore: create simulator without os version --- .github/workflows/e2e-ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 0cbc06ed73..91868ce813 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -96,7 +96,7 @@ jobs: - name: Create iOS Simulator run: | - DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-17-2) + DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation) echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV - name: Boot Simulator From 19e28cc67e75bb145a919beba10c22663d822b06 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 22:49:27 -0500 Subject: [PATCH 23/39] fix: create recording folder --- .github/workflows/e2e-ios.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 91868ce813..f12d5eb471 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -124,8 +124,9 @@ jobs: done # Start screen recording - rm -rf ios-recordings || true - xcrun simctl io booted recordVideo screenRecord.mov & + mkdir -p ios-recordings + rm -rf ios-recordings/* || true + xcrun simctl io booted recordVideo ios-recordings/screenRecord.mov & echo $! > /tmp/pids/sim_record.pid # Run the E2E tests From c550207d0ca75a039d6ee3ff49349647b5b95218 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 12 Dec 2024 23:20:52 -0500 Subject: [PATCH 24/39] chore: improve build + test start --- .github/workflows/e2e-ios.yml | 2 +- dev/Tiltfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index f12d5eb471..51c08d057d 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -76,7 +76,7 @@ jobs: key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Build E2E tests - run: nix develop -c yarn e2e:build ios.sim.debug + run: nix develop -c yarn e2e:build ios.sim.debug -i - name: Save Pods Cache if: always() diff --git a/dev/Tiltfile b/dev/Tiltfile index 757c56b254..b2133e1716 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -104,7 +104,7 @@ local_resource( labels = ["test"], cmd=""" # Run the tests - nix develop -c yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ./ios-recordings + nix develop -c yarn e2e:test ios.sim.debug --start -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ./ios-recordings """, resource_deps = ["dev-setup"] ) From bd8ae83976e6d6f5e36cab4d875ec0ca5f26244e Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 16 Dec 2024 20:56:33 -0500 Subject: [PATCH 25/39] test: increase jest timeout --- .detoxrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.detoxrc.js b/.detoxrc.js index 97d790e939..ef769aa182 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -6,7 +6,7 @@ module.exports = { config: "e2e/detox/jest.config.js", }, jest: { - setupTimeout: 120000, + setupTimeout: 240000, }, }, apps: { From 638b6a2b11038d0abc4130093e31f7b894f0774a Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 17 Dec 2024 00:15:45 -0500 Subject: [PATCH 26/39] ci: update docker compose start pulling cmd --- .github/workflows/e2e-ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 51c08d057d..5ea4253204 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -32,7 +32,7 @@ jobs: done # Start pulling images in background - docker-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --quiet & + docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & - name: Restore Node Modules Cache id: cache-node-restore From a2441dbfbb6f776a7044b5c41431fb7c8c426153 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 17 Dec 2024 23:38:51 -0500 Subject: [PATCH 27/39] test: add initialize ci step --- .github/workflows/e2e-ios.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 5ea4253204..f9d84a671c 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -34,6 +34,9 @@ jobs: # Start pulling images in background docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & + - name: Initialize ci deps + run: nix develop -c tilt -f ./dev/Tiltfile ci + - name: Restore Node Modules Cache id: cache-node-restore uses: actions/cache/restore@v4 From 751f5d20afb95dfa143f6dbc97acc10c3d55c2c8 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 08:27:17 -0500 Subject: [PATCH 28/39] chore: set ci timeout to 0 --- .github/workflows/e2e-ios.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index f9d84a671c..9499ab1d37 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -35,7 +35,7 @@ jobs: docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & - name: Initialize ci deps - run: nix develop -c tilt -f ./dev/Tiltfile ci + run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0 - name: Restore Node Modules Cache id: cache-node-restore From be226904d602d42c9755f10e2d93907852446426 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 15:19:16 -0500 Subject: [PATCH 29/39] chore: test docker compose pull sync --- .github/workflows/e2e-ios.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 9499ab1d37..7a532b9c4f 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -32,7 +32,8 @@ jobs: done # Start pulling images in background - docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & + # docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & + docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps - name: Initialize ci deps run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0 From 78d3caf27069c7f808fc503d7f075464b7ac3f94 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 19:43:22 -0500 Subject: [PATCH 30/39] fix: colima docker host path --- .github/workflows/e2e-ios.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e-ios.yml b/.github/workflows/e2e-ios.yml index 7a532b9c4f..56f73bbd98 100644 --- a/.github/workflows/e2e-ios.yml +++ b/.github/workflows/e2e-ios.yml @@ -23,19 +23,24 @@ jobs: - name: Set up Docker and pull images in background run: | brew install docker docker-compose colima - colima start --cpu 4 --memory 8 --disk 60 & + colima start --cpu 4 --memory 8 --disk 60 --vm-type=vz --mount-type=virtiofs + colima status - # Wait for Docker to be ready + # Wait for Docker to be ready and configure socket while ! docker info > /dev/null 2>&1; do echo "Waiting for Docker to be ready..." sleep 5 done - # Start pulling images in background - # docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & - docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps + # Ensure correct Docker context + echo "DOCKER_HOST=unix://${HOME}/.colima/default/docker.sock" >> $GITHUB_ENV + + # Start pulling images + docker compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & - name: Initialize ci deps + env: + DOCKER_HOST: "unix://${HOME}/.colima/default/docker.sock" run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0 - name: Restore Node Modules Cache @@ -120,6 +125,8 @@ jobs: - name: Run E2E Tests id: run-tests + env: + DOCKER_HOST: "unix://${HOME}/.colima/default/docker.sock" run: | # Wait for device to be ready while ! xcrun simctl list devices | grep "(Booted)"; do @@ -158,7 +165,7 @@ jobs: done # Additional cleanup commands - nix develop -c tilt down -f ./dev/Tiltfile + DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock" nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true colima stop || true From b36370e8a7d2714e6533a45f58af85a6e1dbaec5 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 19:54:46 -0500 Subject: [PATCH 31/39] test: add e2e ios with podman --- .github/workflows/e2e-ios-podman.yml | 183 +++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 .github/workflows/e2e-ios-podman.yml diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml new file mode 100644 index 0000000000..19110610ac --- /dev/null +++ b/.github/workflows/e2e-ios-podman.yml @@ -0,0 +1,183 @@ +name: iOS E2E Tests Podman + +on: + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + e2e-test: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v14 + + - name: Run the Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v8 + + - name: Set up Podman and pull images in background + run: | + brew install podman + podman machine init + podman machine start + podman version + + # Set DOCKER_HOST environment variable + echo "DOCKER_HOST=unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" >> $GITHUB_ENV + + # Wait for Podman to be ready + while ! podman info > /dev/null 2>&1; do + echo "Waiting for Podman to be ready..." + sleep 5 + done + + podman info + + # Start pulling images + podman compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & + + - name: Initialize ci deps + env: + DOCKER_HOST: "unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" + run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0 + + - name: Restore Node Modules Cache + id: cache-node-restore + uses: actions/cache/restore@v4 + with: + path: | + node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Restore Pods Cache + id: cache-pods-restore + uses: actions/cache/restore@v4 + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Restore iOS Build Cache + id: cache-ios-build-restore + uses: actions/cache/restore@v4 + with: + path: | + ios/build + ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj') }}-${{ hashFiles('ios/**/*.xcconfig') }} + restore-keys: | + ${{ runner.os }}-ios-build- + + - name: Install dependencies + run: nix develop -c yarn install --frozen-lockfile --prefer-offline + + - name: Save Node Modules Cache + if: always() + uses: actions/cache/save@v4 + with: + path: | + node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Build E2E tests + run: nix develop -c yarn e2e:build ios.sim.debug -i + + - name: Save Pods Cache + if: always() + uses: actions/cache/save@v4 + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + + - name: Save iOS Build Cache + if: always() + uses: actions/cache/save@v4 + with: + path: | + ios/build + ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj') }}-${{ hashFiles('ios/**/*.xcconfig') }} + + - name: Create iOS Simulator + run: | + DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation) + echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV + + - name: Boot Simulator + run: xcrun simctl boot $DEVICE_ID + + - name: Start Metro + run: | + mkdir -p /tmp/pids + nix develop -c yarn start & + echo $! > /tmp/pids/metro.pid + + # Wait for Metro to be ready + while ! lsof -i:8081 >/dev/null 2>&1; do + echo "Waiting for Metro to be ready..." + sleep 5 + done + + - name: Run E2E Tests + id: run-tests + env: + DOCKER_HOST: "unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" + run: | + # Wait for device to be ready + while ! xcrun simctl list devices | grep "(Booted)"; do + sleep 5 + echo "Waiting for Simulator device to come online..." + done + + # Start screen recording + mkdir -p ios-recordings + rm -rf ios-recordings/* || true + xcrun simctl io booted recordVideo ios-recordings/screenRecord.mov & + echo $! > /tmp/pids/sim_record.pid + + # Run the E2E tests + nix develop -c tilt -f ./dev/Tiltfile ci -- --test ios-e2e-tests + + - name: Cleanup Processes + if: always() + run: | + # Function to kill process by PID file + kill_process() { + local pidfile=$1 + if [ -f "$pidfile" ]; then + PID=$(cat "$pidfile") + if ps -p $PID > /dev/null; then + echo "Killing process $(basename "$pidfile" .pid) (PID: $PID)" + kill $PID || kill -9 $PID + fi + rm "$pidfile" + fi + } + + # Kill all processes + for pidfile in /tmp/pids/*.pid; do + [ -f "$pidfile" ] && kill_process "$pidfile" + done + + # Additional cleanup commands + DOCKER_HOST="unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" nix develop -c tilt down -f ./dev/Tiltfile + pkill -f "node.*metro" || true + pkill -f "tilt" || true + podman machine stop || true + + - name: Upload test artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-artifacts + path: | + ios-recordings/ + ios-recordings/screenRecord.mov From f051c7311158399c2d0b7223e44c658c57cd0f87 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 20:04:22 -0500 Subject: [PATCH 32/39] fix: update docker host path --- .github/workflows/e2e-ios-podman.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index 19110610ac..97ceaa9e63 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -28,7 +28,9 @@ jobs: podman version # Set DOCKER_HOST environment variable - echo "DOCKER_HOST=unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" >> $GITHUB_ENV + PODMAN_UID=$(id -u) + echo "PODMAN_UID=${PODMAN_UID}" >> $GITHUB_ENV + echo "DOCKER_HOST=unix:///run/user/${PODMAN_UID}/podman/podman.sock" >> $GITHUB_ENV # Wait for Podman to be ready while ! podman info > /dev/null 2>&1; do @@ -43,7 +45,7 @@ jobs: - name: Initialize ci deps env: - DOCKER_HOST: "unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" + DOCKER_HOST: "unix:///run/user/${{ env.PODMAN_UID }}/podman/podman.sock" run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0 - name: Restore Node Modules Cache @@ -129,7 +131,7 @@ jobs: - name: Run E2E Tests id: run-tests env: - DOCKER_HOST: "unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" + DOCKER_HOST: "unix:///run/user/${{ env.PODMAN_UID }}/podman/podman.sock" run: | # Wait for device to be ready while ! xcrun simctl list devices | grep "(Booted)"; do @@ -168,7 +170,7 @@ jobs: done # Additional cleanup commands - DOCKER_HOST="unix://${HOME}/.local/share/containers/podman/machine/podman-machine-default/podman.sock" nix develop -c tilt down -f ./dev/Tiltfile + DOCKER_HOST="unix:///run/user/${{ env.PODMAN_UID }}/podman/podman.sock" nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true podman machine stop || true From 9499053d79a20b89b75ca63129a23422db68b99a Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 20:11:09 -0500 Subject: [PATCH 33/39] fix: add podman compose --- .github/workflows/e2e-ios-podman.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index 97ceaa9e63..8e0dad50bb 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -22,15 +22,14 @@ jobs: - name: Set up Podman and pull images in background run: | - brew install podman + brew install podman podman-compose podman machine init podman machine start podman version # Set DOCKER_HOST environment variable - PODMAN_UID=$(id -u) - echo "PODMAN_UID=${PODMAN_UID}" >> $GITHUB_ENV - echo "DOCKER_HOST=unix:///run/user/${PODMAN_UID}/podman/podman.sock" >> $GITHUB_ENV + SOCKET_PATH=$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}') + echo "DOCKER_HOST=unix://${SOCKET_PATH}" >> $GITHUB_ENV # Wait for Podman to be ready while ! podman info > /dev/null 2>&1; do @@ -41,11 +40,11 @@ jobs: podman info # Start pulling images - podman compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull --include-deps --quiet & + podman-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull & - name: Initialize ci deps env: - DOCKER_HOST: "unix:///run/user/${{ env.PODMAN_UID }}/podman/podman.sock" + DOCKER_HOST: ${{ env.DOCKER_HOST }} run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0 - name: Restore Node Modules Cache @@ -131,7 +130,7 @@ jobs: - name: Run E2E Tests id: run-tests env: - DOCKER_HOST: "unix:///run/user/${{ env.PODMAN_UID }}/podman/podman.sock" + DOCKER_HOST: ${{ env.DOCKER_HOST }} run: | # Wait for device to be ready while ! xcrun simctl list devices | grep "(Booted)"; do @@ -150,6 +149,8 @@ jobs: - name: Cleanup Processes if: always() + env: + DOCKER_HOST: ${{ env.DOCKER_HOST }} run: | # Function to kill process by PID file kill_process() { @@ -170,7 +171,7 @@ jobs: done # Additional cleanup commands - DOCKER_HOST="unix:///run/user/${{ env.PODMAN_UID }}/podman/podman.sock" nix develop -c tilt down -f ./dev/Tiltfile + nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true podman machine stop || true From 86958c2689380dda982d57fc065b2e0c2b07ddfa Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 21:37:40 -0500 Subject: [PATCH 34/39] fix: export docker host path before pull images --- .github/workflows/e2e-ios-podman.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index 8e0dad50bb..189a0c7c49 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -38,8 +38,10 @@ jobs: done podman info + podman system connection list # Start pulling images + export DOCKER_HOST="unix://${SOCKET_PATH}" podman-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull & - name: Initialize ci deps From 5212d383d62ccdf03717f0e899a21040e4957e72 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 21:47:48 -0500 Subject: [PATCH 35/39] chore: update macos runner --- .github/workflows/e2e-ios-podman.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index 189a0c7c49..d1e4ae8c5d 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -10,7 +10,7 @@ concurrency: jobs: e2e-test: - runs-on: macos-13 + runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -23,8 +23,13 @@ jobs: - name: Set up Podman and pull images in background run: | brew install podman podman-compose - podman machine init - podman machine start + # Remove any existing machine and create new one + podman machine rm -f podman-machine-default || true + podman machine init --cpus 4 --memory 4104 --disk-size 60 --now + # podman machine start + + # Verify machine status + podman machine ls podman version # Set DOCKER_HOST environment variable From ecbc2236996a2985dced4c4b66efdd9c76e09f56 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 23:15:52 -0500 Subject: [PATCH 36/39] chore: force podman machine rm --- .github/workflows/e2e-ios-podman.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index d1e4ae8c5d..472e229dc4 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -24,7 +24,7 @@ jobs: run: | brew install podman podman-compose # Remove any existing machine and create new one - podman machine rm -f podman-machine-default || true + podman machine rm --force || true podman machine init --cpus 4 --memory 4104 --disk-size 60 --now # podman machine start @@ -178,7 +178,7 @@ jobs: done # Additional cleanup commands - nix develop -c tilt down -f ./dev/Tiltfile + # nix develop -c tilt down -f ./dev/Tiltfile pkill -f "node.*metro" || true pkill -f "tilt" || true podman machine stop || true From 0b40364fe273c481ea2ed3adddbe247956359d68 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Dec 2024 23:18:02 -0500 Subject: [PATCH 37/39] chore: install vfkit --- .github/workflows/e2e-ios-podman.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index 472e229dc4..bb16297d2d 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -10,21 +10,17 @@ concurrency: jobs: e2e-test: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v14 - - - name: Run the Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Set up Podman and pull images in background run: | brew install podman podman-compose + podman --help + # Remove any existing machine and create new one - podman machine rm --force || true + podman machine reset --force || true podman machine init --cpus 4 --memory 4104 --disk-size 60 --now # podman machine start @@ -35,6 +31,7 @@ jobs: # Set DOCKER_HOST environment variable SOCKET_PATH=$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}') echo "DOCKER_HOST=unix://${SOCKET_PATH}" >> $GITHUB_ENV + export DOCKER_HOST="unix://${SOCKET_PATH}" # Wait for Podman to be ready while ! podman info > /dev/null 2>&1; do @@ -46,8 +43,13 @@ jobs: podman system connection list # Start pulling images - export DOCKER_HOST="unix://${SOCKET_PATH}" - podman-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull & + podman-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v14 + + - name: Run the Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Initialize ci deps env: From 99f450fb03e20955e11a2a112cb504a231df6595 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 19 Dec 2024 12:46:13 -0500 Subject: [PATCH 38/39] chore: add tilt podman --- dev/Tiltfile-podman | 168 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 dev/Tiltfile-podman diff --git a/dev/Tiltfile-podman b/dev/Tiltfile-podman new file mode 100644 index 0000000000..f2907b3f62 --- /dev/null +++ b/dev/Tiltfile-podman @@ -0,0 +1,168 @@ +# Helper function to get runtime dir path +def get_runtime_dir(): + xdg_runtime = os.getenv("XDG_RUNTIME_DIR") + if xdg_runtime: + return xdg_runtime + + uid = os.getenv("UID", "1000") + return "/run/user/" + uid + +# Helper function to detect platform +def get_platform(): + is_mac = os.getenv("OSTYPE") == "darwin" + if not is_mac: + return "linux/amd64" + + # Check for Apple Silicon + uname_result = str(local('uname -m', quiet=True)) + is_arm = ('arm64' in uname_result) or ('aarch64' in uname_result) + return "linux/arm64" if is_arm else "linux/amd64" + +# Detect environment and set the DOCKER_HOST environment variable +macos_path = os.path.join(os.getenv("HOME", ""), ".local/share/containers/podman/machine/podman-machine-default/podman.sock") +macos_docker_host = "unix://" + macos_path +linux_docker_host = "unix://" + get_runtime_dir() + "/podman/podman.sock" + +docker_host = macos_docker_host if os.getenv("OSTYPE") == "darwin" else linux_docker_host + +# Set environment variables +os.putenv("DOCKER_HOST", docker_host) +os.putenv("DOCKER_CONTEXT", "default") +os.putenv("COMPOSE_DOCKER_CLI_BUILD", "1") +os.putenv("DOCKER_DEFAULT_PLATFORM", get_platform()) + +# Print platform information for debugging +print("Detected DOCKER_HOST: " + docker_host) +print("Detected platform: " + get_platform()) + +# Tiltfile configurations +docker_prune_settings(disable=True) + +config.define_string_list("test") +cfg = config.parse() + +# Environment setup for services +os.putenv("DOCKER_DEFAULT_PLATFORM", "linux/amd64") +os.putenv("COMPOSE_PROJECT_NAME", "galoy-quickstart") + +local_resource( + name="init-onchain", + labels=["dev-setup"], + cmd="vendor/galoy-quickstart/bin/init-onchain.sh", + resource_deps=[ + "bitcoind", + "bria", + ] +) + +local_resource( + name="init-lightning", + labels=["dev-setup"], + cmd="vendor/galoy-quickstart/bin/init-lightning.sh", + resource_deps=[ + "init-onchain", + "lnd1", + "lnd-outside-1", + ] +) + +# Use standard docker_compose with environment variables configured for Podman +docker_compose("vendor/galoy-quickstart/docker-compose.yml") + +galoy_services = ["apollo-router", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats", "notifications", "notifications-pg"] +auth_services = ["oathkeeper", "kratos", "kratos-pg", "hydra", "hydra-pg", "hydra-migrate"] +bitcoin_services = ["bitcoind", "bitcoind-signer", "lnd1", "lnd-outside-1", "bria", "bria-pg", "fulcrum"] + +for service in galoy_services: + dc_resource(service, labels = ["galoy"]) + +for service in auth_services: + dc_resource(service, labels = ["auth"]) + +for service in bitcoin_services: + dc_resource(service, labels = ["bitcoin"]) + +dc_resource("galoy", labels = ["galoy"], resource_deps = ["dev-ln-setup"]) +dc_resource("trigger", labels = ["galoy"], resource_deps = ["galoy", "dev-ln-setup"]) +dc_resource("otel-agent", labels = ["otel"]) +dc_resource("quickstart-test", labels = ["quickstart"], auto_init=False) + +local_resource( + name="dev-ln-setup", + labels = ["dev-setup"], + cmd="bin/dev-ln-setup.sh", + resource_deps = galoy_services + [ + "init-lightning" + ] +) + +local_resource( + name="wait-for-galoy", + labels = ["dev-setup"], + cmd=''' + GALOY_ENDPOINT=${GALOY_ENDPOINT:-localhost:4455} + max_attempts=30 + attempt=1 + while [ $attempt -le $max_attempts ]; do + response=$(curl -s -X POST http://$GALOY_ENDPOINT/graphql \ + -H 'Content-Type: application/json' \ + -d '{"query":"query Globals { globals { network } }"}') + # Check if response contains "errors" field + if echo "$response" | grep -q '"errors":'; then + echo "Attempt $attempt/$max_attempts: GraphQL server returned errors:" + echo "$response" + else + echo "GraphQL server is ready at $GALOY_ENDPOINT!" + exit 0 + fi + echo "Waiting for GraphQL server at $GALOY_ENDPOINT..." + sleep 5 + attempt=$((attempt + 1)) + done + echo "GraphQL server failed to become ready at $GALOY_ENDPOINT" + exit 1 + ''', + resource_deps = ["galoy"] +) + +local_resource( + name="dev-setup", + labels = ["dev-setup"], + cmd="bin/dev-setup.sh", + resource_deps = [ + "wait-for-galoy", + ] +) + +local_resource( + name="one-block-every-5s", + labels = ["dev-setup"], + serve_cmd="bin/one-block-every-5s.sh", + resource_deps = [ + "dev-ln-setup" + ] +) + +# iOS E2E test +local_resource( + name="ios-e2e-tests", + auto_init = "ios-e2e-tests" in cfg.get("test", []), + labels = ["test"], + cmd=""" + # Run the tests + nix develop -c yarn e2e:test ios.sim.debug --start -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ./ios-recordings + """, + resource_deps = ["dev-setup"] +) + +# Android E2E test +local_resource( + name="android-e2e-tests", + auto_init = "android-e2e-tests" in cfg.get("test", []), + labels = ["test"], + cmd=""" + # Run the tests + nix develop -c yarn e2e:test android.emu.debug --start -d --take-screenshots all --record-videos all --record-logs all --artifacts-location ./android-recordings + """, + resource_deps = ["dev-setup"] +) From bf108ed8cf3dde5a181363e120c79b8cb3e416d2 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Fri, 20 Dec 2024 14:51:36 -0500 Subject: [PATCH 39/39] chore: vendor sync --- .github/workflows/e2e-ios-podman.yml | 2 +- dev/Tiltfile | 13 +++++++++++++ dev/vendir.lock.yml | 6 +++--- dev/vendir.yml | 2 +- .../galoy-quickstart/dev/docker-compose.deps.yml | 13 ++++++------- dev/vendor/galoy-quickstart/docker-compose.yml | 15 +++++++-------- 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/workflows/e2e-ios-podman.yml b/.github/workflows/e2e-ios-podman.yml index bb16297d2d..0392c50c07 100644 --- a/.github/workflows/e2e-ios-podman.yml +++ b/.github/workflows/e2e-ios-podman.yml @@ -43,7 +43,7 @@ jobs: podman system connection list # Start pulling images - podman-compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull + podman compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull - name: Install Nix uses: DeterminateSystems/nix-installer-action@v14 diff --git a/dev/Tiltfile b/dev/Tiltfile index b2133e1716..0b9f7a4f36 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -108,3 +108,16 @@ local_resource( """, resource_deps = ["dev-setup"] ) + + +# Android E2E test +local_resource( + name="android-e2e-tests", + auto_init = "android-e2e-tests" in cfg.get("test", []), + labels = ["test"], + cmd=""" + # Run the tests + nix develop -c yarn e2e:test android.emu.debug --start -d --take-screenshots all --record-videos all --record-logs all --artifacts-location ./android-recordings + """, + resource_deps = ["dev-setup"] +) diff --git a/dev/vendir.lock.yml b/dev/vendir.lock.yml index 48c64fc5b0..d4922b1dba 100644 --- a/dev/vendir.lock.yml +++ b/dev/vendir.lock.yml @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@3a56597239aa1caf5c59cca1861c812310c6b3f99020de93527590439522d63b' - sha: 1f4ebb78cdfecd9e7b815eabe3a1dee1379954f1 + commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@d946a4de44c88dc188f5f416176c350acfecce8173b034bde75d7360b6865454' + sha: 43b1037676b141ab1c7721a3a0b1561cd9ccc31f tags: - - 0.21.16 + - 0.21.18 path: galoy-quickstart path: vendor kind: LockConfig diff --git a/dev/vendir.yml b/dev/vendir.yml index 17e1d60340..adc8ed2f59 100644 --- a/dev/vendir.yml +++ b/dev/vendir.yml @@ -7,7 +7,7 @@ directories: - path: galoy-quickstart git: url: https://github.com/GaloyMoney/blink.git - ref: "0.21.16" + ref: "0.21.18" depth: 1 includePaths: - quickstart/bin/* diff --git a/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml b/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml index 5c734d841e..daa0c71417 100644 --- a/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml +++ b/dev/vendor/galoy-quickstart/dev/docker-compose.deps.yml @@ -139,8 +139,8 @@ services: command: '"kratos migrate sql up -y -e && kratos serve -c /home/ory/kratos.yml --watch-courier --sqa-opt-out"' environment: DSN: postgres://dbuser:secret@kratos-pg:5432/default?sslmode=disable - links: - - kratos-pg:kratos-pg + depends_on: + - kratos-pg volumes: - ${HOST_PROJECT_PATH:-.}/config/ory:/home/ory kratos-pg: @@ -178,7 +178,7 @@ services: environment: - MONGO_INITDB_DATABASE=galoy lnd1: - image: lightninglabs/lnd:v0.18.3-beta + image: lightninglabs/lnd:v0.18.4-beta ports: - "10009:10009" volumes: @@ -198,7 +198,7 @@ services: cp /root/.lnd/admin.macaroon /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon /bin/lnd lnd2: - image: lightninglabs/lnd:v0.18.3-beta + image: lightninglabs/lnd:v0.18.4-beta ports: - "10010:10009" volumes: @@ -218,7 +218,7 @@ services: cp /root/.lnd/admin.macaroon /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon /bin/lnd lnd-outside-1: - image: lightninglabs/lnd:v0.18.3-beta + image: lightninglabs/lnd:v0.18.4-beta ports: - "10012:10009" volumes: @@ -238,7 +238,7 @@ services: /bin/lnd depends_on: [bitcoind] lnd-outside-2: - image: lightninglabs/lnd:v0.18.3-beta + image: lightninglabs/lnd:v0.18.4-beta ports: - "10013:10009" volumes: @@ -340,7 +340,6 @@ services: - ${HOST_PROJECT_PATH:-.}/config/otel-agent-config.yaml:/etc/otel-agent-config.yaml svix: image: svix/svix-server:v1.38 - platform: linux/amd64 environment: WAIT_FOR: "true" SVIX_DB_DSN: postgresql://postgres:postgres@svix-pg/postgres diff --git a/dev/vendor/galoy-quickstart/docker-compose.yml b/dev/vendor/galoy-quickstart/docker-compose.yml index 945f4b4492..61c9925228 100644 --- a/dev/vendor/galoy-quickstart/docker-compose.yml +++ b/dev/vendor/galoy-quickstart/docker-compose.yml @@ -55,8 +55,8 @@ services: command: '"kratos migrate sql up -y -e && kratos serve -c /home/ory/kratos.yml --watch-courier --sqa-opt-out"' environment: DSN: postgres://dbuser:secret@kratos-pg:5432/default?sslmode=disable - links: - - kratos-pg:kratos-pg + depends_on: + - kratos-pg volumes: - ${HOST_PROJECT_PATH:-.}/${GALOY_QUICKSTART_PATH:-vendor/galoy-quickstart}/dev/config/ory:/home/ory kratos-pg: @@ -98,7 +98,7 @@ services: - POSTGRES_PASSWORD=secret - POSTGRES_DB=hydra galoy: - image: us.gcr.io/galoy-org/galoy-api@sha256:3a56597239aa1caf5c59cca1861c812310c6b3f99020de93527590439522d63b + image: us.gcr.io/galoy-org/galoy-api@sha256:d946a4de44c88dc188f5f416176c350acfecce8173b034bde75d7360b6865454 environment: - HELMREVISION=dev - NETWORK=regtest @@ -157,7 +157,7 @@ services: aliases: - bats-tests trigger: - image: us.gcr.io/galoy-org/galoy-api-trigger@sha256:6057867f063ff205a9297a080d2d49e105bed20a8d41358d98cc01b978fddc69 + image: us.gcr.io/galoy-org/galoy-api-trigger@sha256:9dd26b7190215326627364fbb76d0cb9b98fd9debafb48db69b74cd09b223aeb environment: - HELMREVISION=dev - NETWORK=regtest @@ -242,7 +242,7 @@ services: environment: - MONGO_INITDB_DATABASE=galoy mongodb-migrate: - image: us.gcr.io/galoy-org/galoy-api-migrate@sha256:aa18803258d758b3d176460cf728d66f4c930783f8109919852a20a6a237821f + image: us.gcr.io/galoy-org/galoy-api-migrate@sha256:bdf753fcf44e8eab32d5b0410b79fffcb58a8d5f389be1d92fd261cdc15fc0a7 depends_on: - mongodb environment: @@ -318,7 +318,7 @@ services: - | bitcoind -connect=bitcoind:18444 lnd1: - image: lightninglabs/lnd:v0.18.3-beta + image: lightninglabs/lnd:v0.18.4-beta ports: - 10009:10009 volumes: @@ -341,7 +341,7 @@ services: cp /root/.lnd/admin.macaroon /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon /bin/lnd lnd-outside-1: - image: lightninglabs/lnd:v0.18.3-beta + image: lightninglabs/lnd:v0.18.4-beta ports: - 10012:10009 volumes: @@ -449,7 +449,6 @@ services: - ${HOST_PROJECT_PATH:-.}/${GALOY_QUICKSTART_PATH:-vendor/galoy-quickstart}/dev/config/otel-agent-config.yaml:/etc/otel-agent-config.yaml svix: image: svix/svix-server:v1.38 - platform: linux/amd64 environment: WAIT_FOR: "true" SVIX_DB_DSN: postgresql://postgres:postgres@svix-pg/postgres