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

Migrate build and test workflow to GitHub Actions #509

Merged
merged 23 commits into from
Nov 25, 2024

Conversation

timkimadobe
Copy link
Contributor

@timkimadobe timkimadobe commented Nov 15, 2024

Questions for reviewers

  1. Is removing the custom destination for test results acceptable? Or should we also make copies of the test results in the same custom destination as before?
  2. Is removing the version rules acceptable? I wasn't sure of the frequency/usefulness of these rules being run locally

Description

This PR updates the Makfile test rules to use configurable device name and OS, and removes some local scripts that are handled by the new reusable workflows.

The configurable device name and OS also enable compatibility with GitHub Actions matrix configurations:
Example run (with matrix using both iOS and tvOS paths): https://github.com/timkimadobe/aepsdk-edge-ios/actions/runs/11695962501

Makefile

New computed properties IOS_DESTINATION and TVOS_DESTINATION used in the xcodebuild test commands, which rely on the new input values:

  • IOS_DEVICE_NAME - defaults to "iPhone 15"
  • IOS_VERSION - defaults to nothing (same behavior as before)
  • TVOS_DEVICE_NAME - defaults to "Apple TV"
  • TVOS_VERSION - defaults to nothing (same behavior as before)

Breaking changes

  1. The custom -derivedDataPath and -resultBundlePath for test rules has been removed so that test coverage is placed in the default location. This is to facilitate compatibility with the Codecov action's Xcode plugin test result coverage search behavior: iOS CircleCI to GitHub Actions reusable workflow conversion aepsdk-commons#67 (comment)
    • The test result cleanup pre-step for each test rule has been updated to reflect this new location (whose path is randomly generated)
    • Ex default result path: /Users/runner/Library/Developer/Xcode/DerivedData/AEPEdge-byotfosbfuyloqdajycdwzyadpcv/Logs/Test/Test-UnitTests-2024.11.15_13-51-24--0800.xcresult
  2. The version related rules check-version and test-version-update have been removed

Example usage

make unit-test-ios IOS_DEVICE_NAME="iPhone 16"

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@kevinlind
Copy link
Contributor

The -resultBundlePath option when running the tests is used by the CircleCI config to upload the results to CodeCov. That is currently disabled, but you should still update config.yml with the new path to the test results, or add back the -resultBundlePath option.

Removing the version scripts is great. Seems like that was missed when adding the version update GH Action script.

@timkimadobe
Copy link
Contributor Author

The -resultBundlePath option when running the tests is used by the CircleCI config to upload the results to CodeCov. That is currently disabled, but you should still update config.yml with the new path to the test results, or add back the -resultBundlePath option.

Removing the version scripts is great. Seems like that was missed when adding the version update GH Action script.

Thanks @kevinlind, that's a great point! For some additional context, I was planning on also migrating the Edge iOS repo to use the reusable workflow build and test for PR checks in aepsdk-commons:

Basically, the Codecov action's Xcode plugin which handles creating test coverage looks in the default directory xcodebuild uses and this change was meant to align with that

Comment on lines +27 to +32
run-test-ios-unit: true
run-test-ios-functional: true
run-test-ios-integration: true
run-test-tvos-unit: true
run-test-tvos-functional: true
run-build-xcframework-and-app: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to only run some of these tests on specific branches? For example, we run the integration tests and build the xcframework and app just on the staging and main branches to reduce the time it takes to build the dev and pr branches. Depending on how long it takes to run these jobs it may not be necessary to exclude them, however.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kevinlind thanks for your help in updating the actions rules for the repo - after running the new build and test workflow which runs all of these in parallel, it looks like integration tests (3m 44s) and building the xcframework and app (3m 36s) take less time than the functional tests (9m+)

In that case, I think it should be ok to keep them in the regular checks? What do you think

Copy link
Contributor

Choose a reason for hiding this comment

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

We will have to make changes to add branch if we cause or run into the issue of unavailability of runners. Even if we don't have the branch based rule today, it will be a good practice to have it ready in case we need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we wait to implement that if/when we encounter the unavailability? I could split the usage of the workflow into two pieces - the branch dependent and non-dependent jobs, which should be a quick change

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, then let's see how this plays out.

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.97%. Comparing base (3d22a85) to head (9b411f2).
Report is 102 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #509      +/-   ##
==========================================
- Coverage   96.73%   95.97%   -0.77%     
==========================================
  Files          27       28       +1     
  Lines        1653     1463     -190     
==========================================
- Hits         1599     1404     -195     
- Misses         54       59       +5     

@timkimadobe timkimadobe changed the title Update Makefile test rules for configurable device and OS Migrate build and test workflow to GitHub Actions Nov 20, 2024
@@ -22,7 +22,7 @@ import XCTest

/// End-to-end testing for the AEPEdge public APIs
class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts {
private let TIMEOUT_SEC: TimeInterval = 2
private let TIMEOUT_SEC: TimeInterval = 10
private let LONGER_TIMEOUT_SEC: TimeInterval = 10
Copy link
Contributor

@addb addb Nov 22, 2024

Choose a reason for hiding this comment

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

We have LONGER_TIMEOUT_SEC which is 10 seconds. We can move this into common constants file (FuntionalTestConstants.swift) if this applies to all the integration tests, and let's use only one time and update it to 10 sec if that makes our tests more stable.

@timkimadobe timkimadobe merged commit 3538584 into adobe:dev Nov 25, 2024
17 of 18 checks passed
addb added a commit that referenced this pull request Nov 26, 2024
…lows (#512)

* Make EdgeEventHandles and completionHandlers interactions thread safe (#481)

* Make EdgeEventHandles and completionHandlers interactions thread safe

* Minor refactor

* Update queue name

* Update AEPTestUtils to 5.2.2

* Update GitHub Action workflows to use aepsdk-commons (#507)

* Migrate release and update versions workflows to use reusable workflows (testing configuration)

* Revert naming update

* Update input types

* Update input order

* Revert testing config

* Add code docs on how to update the workflow tag

* Update release workflow to use env var and ternary

* Temp use testing config

* Test github actions style ternary

* Update input descriptions and name + usages

Update workflow call input variable names

* Revert testing config

* Add permissions to workflows

* Testing new version validation process in release

* Update to testing config

* Test version script updates

* Fix pattern type override missing

* Revert back to production configs

* Remove default from mandatory fields to trigger error on empty submit

* Apply testing config

* Update tags

* Apply testing config

* Remove passing workflow_tag

* Remove outdated comment

* Update with production tags

* Update to full production config

* Revert "Make EdgeEventHandles and completionHandlers interactions thread safe (#481)" (#510)

This reverts commit 607f927.

* Migrate build and test workflow to GitHub Actions (#509)

* Remove local version related rules and scripts

* Test removing resultBundlePath flag

* TEST: versions-update branch compatibility with original versions usage

* Apply prod config

* Update Makefile test rules for configurable device and OS

This supports command line args updating the device and OS to test with, and also enables CI matrix support

* Replace CircleCI with GitHub Actions reusable workflow

* Add license headers to workflow files

* Apply prod config

* Trigger change

* Remove @ from Makefile rule for integration test

Rename build and test job
Revert change to README

* Increase timeout from 2 to 5 sec

* Fix double expectation for first event

* Add MobileCore resetSDK to teardown

* Add reset test expectations to tear down and increase timeout

* Increase timeout duration to 10 sec default

* Add timeout to all network request assertions

* Update order of files

* Rename upstream integration test job to align with naming convention style

* Create integration test rule name that aligns with reusable workflow

* Use codecov flag based on new default

* Create new functional test constants and route functional test usage to new default

* Add default timeout to network request assertions

* Functional test stability (#513)

* Pod lock with 1.16.2

* Apply default timeout to all network request gets

---------

Co-authored-by: Arjun Bhadra <[email protected]>
@timkimadobe timkimadobe deleted the workflow-updates branch December 5, 2024 02:18
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