-
Notifications
You must be signed in to change notification settings - Fork 4
Add internal Checkout Kit telemetry foundations #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Telemetry | ||
|
|
||
| on: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Typecheck, lint, test | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| defaults: | ||
| run: | ||
| # The TypeScript telemetry package is a member of the web pnpm | ||
| # workspace, so dependency install and filtered runs happen there. | ||
| working-directory: platforms/web | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - name: Setup Node.js, pnpm, and install dependencies | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| node-version-file: platforms/web/package.json | ||
| cache-dependency-path: platforms/web/pnpm-lock.yaml | ||
| package-json-file: platforms/web/package.json | ||
| working-directory: platforms/web | ||
|
|
||
| - name: Typecheck | ||
| run: pnpm --filter @shopify/checkout-kit-telemetry run typecheck | ||
|
|
||
| - name: Lint | ||
| run: pnpm --filter @shopify/checkout-kit-telemetry run lint | ||
|
|
||
| - name: Test | ||
| run: pnpm --filter @shopify/checkout-kit-telemetry run test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,7 @@ commands: | |
| /opt/dev/bin/dev react-native lint | ||
| /opt/dev/bin/dev web lint | ||
| /opt/dev/bin/dev protocol lint | ||
| /opt/dev/bin/dev telemetry typecheck | ||
|
|
||
| test: | ||
| desc: Run tests across all supported workspaces | ||
|
|
@@ -146,6 +147,7 @@ commands: | |
| /opt/dev/bin/dev react-native test | ||
| /opt/dev/bin/dev web test | ||
| /opt/dev/bin/dev protocol test typescript | ||
| /opt/dev/bin/dev telemetry test typescript | ||
|
|
||
| apollo: | ||
| desc: "Apollo GraphQL schema and code generation commands" | ||
|
|
@@ -237,6 +239,55 @@ commands: | |
| desc: Verify protocol codegen tools match protocol/package.json | ||
| run: ./protocol/scripts/check_codegen_tools.sh "$@" | ||
|
|
||
| telemetry: | ||
| desc: "Checkout telemetry package commands" | ||
| subcommands: | ||
| test: | ||
| desc: "Run telemetry tests for every language, or a single one. Usage: dev telemetry test [typescript|swift|kotlin]" | ||
| syntax: "[typescript|swift|kotlin]" | ||
| run: | | ||
| set -e | ||
| run_typescript() { (cd telemetry/languages/typescript && pnpm test); } | ||
| run_swift() { | ||
| # xcode_run only auto-discovers test targets under | ||
| # platforms/swift/Tests, so pass the telemetry target/suite | ||
| # pair explicitly. | ||
| (cd platforms/swift && ./Scripts/xcode_run test ShopifyCheckoutKit-Package CheckoutKitTelemetryTests/CheckoutKitTelemetryTests) | ||
| } | ||
| run_kotlin() { | ||
| platforms/android/gradlew -p platforms/android :lib:testDebugUnitTest \ | ||
| --tests "com.shopify.checkoutkit.telemetry.*" \ | ||
| --tests "com.shopify.checkoutkit.Telemetry*" \ | ||
| --console=plain | ||
| } | ||
| case "${1:-all}" in | ||
| typescript|ts) run_typescript ;; | ||
| swift|ios) run_swift ;; | ||
| kotlin|android) run_kotlin ;; | ||
| all) run_typescript; run_swift; run_kotlin ;; | ||
| *) echo "Usage: dev telemetry test [typescript|swift|kotlin]"; exit 1 ;; | ||
| esac | ||
| typecheck: | ||
| desc: "Type-check the TypeScript telemetry package" | ||
| run: cd telemetry/languages/typescript && pnpm typecheck | ||
| lint: | ||
| desc: "Lint the TypeScript and Swift telemetry sources (Kotlin lives in the Android lib and is covered by dev android lint)" | ||
| run: | | ||
| set -e | ||
| (cd telemetry/languages/typescript && pnpm lint) | ||
| # SwiftLint's scope comes from .swiftlint.yml's `included`, which | ||
| # covers the telemetry Swift sources. Use the Mintfile-pinned | ||
| # binary so results match CI. | ||
| swiftlint_bin="$(cd platforms/swift && mint which swiftlint)" | ||
| "$swiftlint_bin" lint --strict --no-cache --quiet | ||
| check: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should update all of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done — |
||
| desc: "Type-check, lint, and test the telemetry packages in every language" | ||
| run: | | ||
| set -e | ||
| /opt/dev/bin/dev telemetry typecheck | ||
| /opt/dev/bin/dev telemetry lint | ||
| /opt/dev/bin/dev telemetry test | ||
|
|
||
| # Android | ||
| android: | ||
| aliases: ["kotlin"] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broke my brain for a second - not introduced by your PR but that workspace file shouldn't sit in the web package