-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
6d912ce
to
2aa7bfd
Compare
0193b00
to
a19704f
Compare
…t continue compilation.
… files on both macos and ios SDKs
d0b8bab
to
f234ca7
Compare
@AliSoftware To get faster builds, we could only compile the output files if they've changed, and only those that have changed. Or would that be too much of an optimisation? |
That's a nice idea. How do you propose to determine that in a deterministic way? |
In the Danger PR, you do something like: if !git.modified_files.include?("CHANGELOG.yml") I was hoping to do something similar, but just matching the path to the |
Yeah but we can do that because Danger is driving the Dangerfile, and what it does for that is using octokit (the gem to make GH API requests in ruby easier) to get the PR metadata and exposing it to the Dangerfile So if we want to do what you're suggesting we must either replicate this (using octokit in our Rakefile to fetch the PR metadata including the list of changed files) or embed the step of compiling the generated files in |
Right, right. Any preference for this? Or do we consider this as something nice to have, but maybe later? 😄 |
If we're gonna do that is prefer it to not be part of the Dangerfile, is not it's job. So either using octokit ourselves or find a way to reuse the danger cache after the danger step. For now I think it's not worth the effort and could be just ruled as nice to have 😉 |
Note that maybe there would be another way in case circle CI exposes the git target branch of that PR as part of env variables or something. In that case, no need for GH metadata, a git diff or git log with proper parameters could give us the list |
https://circleci.com/docs/1.0/environment-variables/ it does (the commit branch and SHA) |
|
I'm not sure which env vars you're talking about, all the env vars I see contains the SHA1 and branch name… being tested, not the branch we try to merge into, does it? So if the PR is trying to merge And I guess those env vars contain the name of the branch being tested so |
Ah what I meant was to only compile the files changed by a commit, but that would indeed not be enough now that I think about it:
The command you suggested works though, and we could add an extra check:
|
Anyway I think this is probably an over optimisation at least for now, especially given that it feels too risky to me to miss some cases and not compile files that we should test anyway. For example if the stub env for those files were to change we'd still need to compile everything to be sure. It would be easy to miss some cases and think it compiles (because of green status) while it doesn't Better compile all tests and trust our CI even if it takes a little more time, rather than trying to avoid compiling some files and have false positive builds, which seem way more dangerous to me. I prefer a CI I can trust, and if we were gonna optimize something it would rather be compiling expected files in parallel rather than trying to compile only some of them. |
There's no guarantee all PRs are against master, so that assumption seems dangerous to me too (and that's why I was looking for an env var containing that info but doesn't seem there's one, and querying it via octokit doesn't seem worth it to me anyway as explained in my previous comment — too great a risk to miss an overlooked use case) |
Yeah, let's just leave that be for what it is. I don't know if we can parallelize our builds though, not with the current plan we have. |
rakelib/utils.rake
Outdated
def xcpretty(cmd, task, subtask = '') | ||
name = (task.name + (subtask.empty? ? '' : "_#{subtask}")).gsub(/[:-]/, "_") | ||
command = [*cmd].join(' && ') | ||
xcpretty = `which xcpretty` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remarks for rakelib/lint.rake
rakelib/utils.rake
here than the ones in SwiftGen/SwiftGen#269 (review)
39168ce
to
99121eb
Compare
rakelib/output.rake
Outdated
puts "Compiling #{f}…\n" | ||
compile_file(f, task) | ||
}.reduce(true) { |result, status| | ||
result && status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as SwiftGen/StencilSwiftKit#28 (comment)
rakelib/pod.rake
Outdated
@@ -0,0 +1,9 @@ | |||
if File.file?('Podfile') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for the podspec, not the Podfile
Fixes #20, keep track of SwiftGen/StencilSwiftKit#20 for any changes that need to be copied here.