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

chore: Caching the build folder for unit test schemes #3200

Merged
merged 11 commits into from
Oct 4, 2023

Conversation

ruisebas
Copy link
Member

Description

In order to speed up running unit tests, this PR makes the following changes:

  • We will now cache the Build folder used when running tests in main, per scheme per platform.
  • When we run a test, if there is no build cache for the specific SHA (existing behaviour) we will now retrieve the build cache from main, so that xcodebuild would theoretically only need to build incrementally what has changed.
  • GitHub Actions does not have direct support to overwrite/update caches, so we need to execute gh cache delete first in order to save it. We do this for every successfull test run, only in main.
    • Because of this, all the workflows that run tests now need to specify the actions: write permission for the GitHub token.
  • I added a restore-key for the SHA caches so that we can retrieve old ones from previous commits. This was done mostly so we can now delete them when the test succeeds, so we don't end up with many orphaned caches if the tests are not re-run.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ruisebas ruisebas requested a review from a team as a code owner August 31, 2023 20:12
@codecov-commenter
Copy link

Codecov Report

Merging #3200 (de8d064) into main (ac1a266) will decrease coverage by 0.06%.
Report is 3 commits behind head on main.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main    #3200      +/-   ##
==========================================
- Coverage   64.77%   64.71%   -0.06%     
==========================================
  Files        1090     1090              
  Lines       36999    36999              
==========================================
- Hits        23966    23944      -22     
- Misses      13033    13055      +22     
Flag Coverage Δ
API_plugin_unit_test 66.52% <ø> (ø)
AWSPluginsCore 69.55% <ø> (ø)
Amplify 47.84% <ø> (-0.02%) ⬇️
Analytics_plugin_unit_test 86.39% <ø> (ø)
Auth_plugin_unit_test 75.11% <ø> (-0.15%) ⬇️
CoreMLPredictions_plugin_unit_test 59.44% <ø> (ø)
DataStore_plugin_unit_test 81.06% <ø> (-0.08%) ⬇️
Geo_plugin_unit_test 54.06% <ø> (ø)
Logging_plugin_unit_test 62.61% <ø> (ø)
Predictions_plugin_unit_test 35.17% <ø> (ø)
PushNotifications_plugin_unit_test 69.43% <ø> (ø)
Storage_plugin_unit_test 54.10% <ø> (ø)
unit_tests 64.71% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 11 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ruisebas ruisebas merged commit e39de97 into main Oct 4, 2023
@ruisebas ruisebas deleted the ruisebas/cache-build-schemes branch October 4, 2023 16:02
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