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

feat: Swift client #472

Merged
merged 3 commits into from
Oct 29, 2024
Merged

feat: Swift client #472

merged 3 commits into from
Oct 29, 2024

Conversation

arussellsaw
Copy link
Collaborator

No description provided.

@arussellsaw arussellsaw requested a review from a team as a code owner October 28, 2024 14:45
Copy link
Contributor

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

looking good! couple observations

class FliptClientTests: XCTestCase {

var evaluationClient: FliptClient!
var fliptUrl: String = "https://features-arussellsawsgtest.flipt.cloud"
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll want to replace this with env vars

@@ -212,7 +212,7 @@ pub unsafe extern "C" fn initialize_engine(

let engine_opts_bytes = CStr::from_ptr(opts).to_bytes();
let bytes_str_repr = std::str::from_utf8(engine_opts_bytes).unwrap();
let engine_opts: EngineOpts = serde_json::from_str(bytes_str_repr).unwrap_or_default();
let engine_opts: EngineOpts = serde_json::from_str(bytes_str_repr).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

this will cause a panic if invalid which we don't want to do when initializing the engine.

Copy link
Contributor

Choose a reason for hiding this comment

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

i guess we panic above though as there are several unwrap calls above this. so ignore me. I've actually been bitten by this before when doing the C# client, where it uses the defaults instead of failing fast so this is probably better they way you have it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah yes sorry this was from debugging

Copy link
Contributor

Choose a reason for hiding this comment

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

all good, feel free to keep this change. we need to to do a better job of not panicking in the engine init in the future

@@ -588,6 +591,92 @@ func csharpBuild(ctx context.Context, client *dagger.Client, hostDirectory *dagg
return err
}

func swiftBuild(ctx context.Context, client *dagger.Client, hostDirectory *dagger.Directory, opts ...buildOptionsFn) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add the 'integration' tests to test/main.go as well

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@befd40b). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #472   +/-   ##
=======================================
  Coverage        ?   85.48%           
=======================================
  Files           ?        8           
  Lines           ?     3933           
  Branches        ?        0           
=======================================
  Hits            ?     3362           
  Misses          ?      571           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Alex Russell-Saw <[email protected]>
run: |
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim

- name: Build Engine
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this duplicates some work by recompiling the binaries and packaging the xcframework here, but i figured the small time tradeoff is worth the simpler workflow. and this completes before the rest of the integration tests anyway

Copy link
Contributor

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

one minor request for client options defaults, otherwise looks GREAT! ty

private var url: String = ""
private var authentication: Authentication?
private var ref: String = ""
private var updateInterval: Int = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make this 120? (seconds)

Comment on lines 658 to 660
// because of how Go modules work, we need to create a new repo that contains
// only the go client code. This is because the go client code is in a subdirectory
// we also need to copy the ext directory into the tag of this new repo so that it can be used
Copy link
Member

Choose a reason for hiding this comment

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

Could drop or change the messaging here to be swift appropriate

Copy link
Member

@GeorgeMac GeorgeMac left a comment

Choose a reason for hiding this comment

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

Looks all gravy to me

Signed-off-by: Alex Russell-Saw <[email protected]>
@arussellsaw arussellsaw merged commit 9516f12 into main Oct 29, 2024
21 checks passed
@arussellsaw arussellsaw deleted the ios-client branch October 29, 2024 16:41
@erka erka changed the title WIP: Swift client Swift client Oct 29, 2024
@erka erka changed the title Swift client feat: Swift client Oct 29, 2024
@markphelps markphelps mentioned this pull request Oct 31, 2024
3 tasks
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.

4 participants