awesome-system-swift icon indicating copy to clipboard operation
awesome-system-swift copied to clipboard

On Continuous Integration

Open felix91gr opened this issue 6 years ago • 8 comments

@vknabel had a really great idea about how to add CI such that we could test the projects both periodically and before merging a PR, to see that they worked on both Darwin and Linux.

These are the benefits:

  • This helps us maintain our goal of listing cross-platform libraries.
  • This helps a contributor (and us!) know what might be missing in a newly added project, instantly and with extensive feedback.

And this is (more or less) the idea as I can recall it:

  • Parse the document for links, and check if the repo has the structure of a Swift SPM project. If not, whatevs.
  • If yes, then download it and run swift test. Collect the results (passed/total and console output) into a list.
  • Display the results in the PR.

This would be enhanced by tools such as that described by #31

felix91gr avatar Jun 05 '18 04:06 felix91gr

A draft of the current approach is located here: vknabel/awesome-system-swift#1

The problem is using danger swift: I could not get it running https://travis-ci.org/vknabel/awesome-system-swift/builds/370196293

vknabel avatar Jun 05 '18 06:06 vknabel

(Sorry if my writing has been sloppy, when I wrote these issues I was very tired)

Do you think it's possible to do this? Tell me where can I help you :)

felix91gr avatar Jun 06 '18 04:06 felix91gr

(Sorry if my writing has been sloppy, when I wrote these issues I was very tired)

No worries :)

I got Danger-Swift to work for now. Though I use NSURLConnection.sendSynchronousRequest in order to download the pr-diffs. Sadly it is not available on linux. Can you have a look on this?

https://github.com/vknabel/CompatabilityDetection/blob/master/Sources/CompatabilityDetection/CompatabilityDetection.swift#L95-L100

vknabel avatar Jun 06 '18 15:06 vknabel

Awesome!

And,

Can you have a look on this?

Sure :) I have to leave for class soon, but I'll be back later. I'll check it out then!

felix91gr avatar Jun 06 '18 20:06 felix91gr

That function seems to be deprecated, take a look at this.

I'm going to check out what the Web projects like Vapor and Kitura do. In the case there's nothing Swift-based we could use (which I don't believe is likely), we at least have the CCUrl wrapper that IBM made as a last resort.

felix91gr avatar Jun 07 '18 03:06 felix91gr

Huh. Seems like the entire NSURLConnection API is getting slowly deprecated. The replacement for it is based around URLSession, which in the corelibs-foundation repo seems to be mostly complete (open and then Ctrl + F: "urlsession" for the details). Do you think we could use that instead?

felix91gr avatar Jun 07 '18 04:06 felix91gr

As an alternative, I've found Vapor's HTTPRequest. Since Vapor's API is 100% implememted, that's a solid option if the corelibs-foundation alternative can't be used.

felix91gr avatar Jun 07 '18 04:06 felix91gr

Thanks a lot. I used URLSession and semaphores to get the synchronous behavior.

My testing PR did actually pass. 🎉 Now I need to start playing around and improve some parts (compile errors should fail, but missing tests should just warn)

vknabel avatar Jun 07 '18 07:06 vknabel