Skip to content
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

RUM-4079 chore: Migrate lint, tests and ui-tests to GitLab #1910

Merged
merged 11 commits into from
Jun 19, 2024

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Jun 18, 2024

What and why?

πŸ“¦ 🧰 This PR migrates a significant portion of our CI setup to GitLab:

  • βœ… Lint
  • βœ… Unit tests
  • βœ… UI tests

The following integrations are still running on Bitrise:

  • ❌ SR snapshot tests - these will be moved to GitLab after upgrading our macOS runner to Xcode 15.4 and installing the iOS 17.5 runtime.
  • ❌ Smoke tests
  • ❌ Tooling tests
  • ❌ Dogfooding automation
  • ❌ Release automation
  • ❌ E2E tests app upload to s8s

I will address the remaining items in subsequent PR(s).

How?

General Remarks:

  • The performance and stability of tests on the GitLab runner are comparable to running them on a local laptop.
  • We're using a dedicated macos:sonoma runner, which currently lacks some components. I plan to update the AMI; however, in the meantime, missing components are installed at runtime and persisted, minimizing setup times.
  • For convenience of argument parsing in .sh scripts, I employed argparse-sh via my fork argparse-zsh.

Makefile

GitLab integrates changes through make commands, structured as follows:

.gitlab-ci.yml β†’ Makefile β†’ ./tools/*

Main motivations for the Makefile design:

  • Modularity: This allows us to easily replicate CI commands locally by copying them directly from the CI logs, e.g.:
Screenshot 2024-06-19 at 11 47 07
  • Utility: Several commands facilitate local development.

List of key commands:

  • Utility & Setup:
    • make env-check - Validates the presence of required CLI tools and displays their versions.
    • make repo-setup - Prepares the repo for development and testing (ENV="dev" | "ci").
    • make clean - Resets the repository state, clearing prebuilt artifacts and configurations.
  • Lint:
    • make lint - Lints SDK and tests code.
    • make license-check - Ensures Apache 2.0 license headers are present.
  • Unit Testing:
    • make test - Runs unit tests based on specified parameters (SCHEME, OS, PLATFORM, DEVICE).
    • make test-ios - Runs iOS Simulator unit tests for a specific scheme.
    • make test-ios-all - Runs iOS tests for all schemes.
    • make test-tvos - Runs tvOS Simulator unit tests for a specific scheme.
    • make test-tvos-all - Runs tvOS tests for all schemes.
  • UI Testing:
    • make ui-test - Runs UI tests based on specified parameters (TEST_PLAN, OS, PLATFORM, DEVICE).
    • make ui-test-all - Runs UI tests for all test plans.
    • make ui-test-podinstall - Prepares the UI Tests project for development.
  • Code Generation:

CI Parallelisation

The CI setup is designed to be efficient and modular, with three sequential stages containing multiple parallel jobs. The motivations are:

  • Fail Fast: Identify and stop processes at the first sign of a failure, such as linting errors.
  • Easy Retry: Allow easy retries of specific stages if flakiness occurs.

We split UI Tests into four distinct plans: "Default", "CrashReporting", "NetworkInstrumentation", and "RUM". Current job durations are optimal, hence further optimizations like caching are considered premature at this stage:

screenshot_2024-06-17_at_17 35 15

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests for Core, RUM, Trace, Logs, CR and WVT
  • Run unit tests for Session Replay
  • Run integration tests
  • Run smoke tests
  • Run tests for tools/

@ncreated ncreated self-assigned this Jun 18, 2024
@ncreated ncreated force-pushed the ncreated/RUM-4079/migrate-to-gitlab branch 2 times, most recently from 9fdbb1f to 3a0f1da Compare June 18, 2024 18:37
@ncreated ncreated force-pushed the ncreated/RUM-4079/migrate-to-gitlab branch from 3a0f1da to f832ba1 Compare June 19, 2024 07:07
@ncreated ncreated force-pushed the ncreated/RUM-4079/migrate-to-gitlab branch 3 times, most recently from 2a7ea33 to 410d9a2 Compare June 19, 2024 07:59
@ncreated ncreated marked this pull request as ready for review June 19, 2024 09:48
@ncreated ncreated requested review from a team as code owners June 19, 2024 09:48
ganeshnj
ganeshnj previously approved these changes Jun 19, 2024
Copy link
Contributor

@ganeshnj ganeshnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, left some improvement suggestions but nothing blocking.

Great job πŸŽ‰

maxep
maxep previously approved these changes Jun 19, 2024
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done πŸ‘ πŸ‘ I like the argparse.sh and echo_color.sh 🌈 utilities!

- fix conditional trigger by using `changes:path:compare_to:`
- `set -e` in all scripts
- add `--os` to `runner-setup.sh`
- use `xctrace list devices` to list available simulators
@ncreated ncreated dismissed stale reviews from maxep and ganeshnj via 053f19a June 19, 2024 14:18
@ncreated ncreated force-pushed the ncreated/RUM-4079/migrate-to-gitlab branch from 4f9e22a to 33586e9 Compare June 19, 2024 14:34
@ncreated ncreated requested review from maxep and ganeshnj June 19, 2024 14:36
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants