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

Turned on static analyser after build #1213

Merged
merged 39 commits into from
Dec 30, 2021
Merged

Conversation

maratal
Copy link
Collaborator

@maratal maratal commented Nov 7, 2021

Closes #1202

@maratal
Copy link
Collaborator Author

maratal commented Nov 11, 2021

Analyzing turned on (screenshot from "View raw logs"):

Screenshot 2021-11-11 at 16 08 32

@lawrence-forooghian
Copy link
Collaborator

lawrence-forooghian commented Nov 11, 2021

Will this fail the CI build if the static analyser spots a problem? It seems necessary to me — I don't think anybody's going to come and look at the build logs. (@QuintinWillison, what do you think? Was this implicit in #1202?)

@lukasz-szyszkowski
Copy link
Contributor

lukasz-szyszkowski commented Nov 11, 2021

Will this fail the CI build if the static analyser spots a problem? It seems necessary to me — I don't think anybody's going to come and look at the build logs. (@QuintinWillison, what do you think? Was this implicit in #1202?)

agree, but analyze can't fail xcodebuild so it's a bit tricky, there should be some output other than console log, something "human readable" like HTML files, to achieve this you need to pass config params to xcodebuild command and then check the existence of files from the analyzer, you can read about this here .
Additionally, you should add artifact step to upload the result of the analysis.

@QuintinWillison
Copy link
Contributor

analyze can't fail xcodebuild

Really? It's been quite a number of years since I set this up in a project but my memory is that this was possible. Maybe things have changed significantly, but regardless, if CI doesn't fail when analyze fails then it's impotent and meaningless in reality.

@maratal
Copy link
Collaborator Author

maratal commented Nov 11, 2021

Will this fail the CI build if the static analyser spots a problem?

We should turn on "Treat warnings as errors" to achieve this, as was pointed out by @QuintinWillison in one of our calls.

Additionally, you should add artifact step to upload the result of the analysis.

Isn't it in the same log file? @lukasz-szyszkowski

@lawrence-forooghian
Copy link
Collaborator

My memory of setting this up a long time ago is that out of the box it doesn't fail a build which produces analyzer warnings, and I think that's true even with "treat warnings as errors" enabled. My rough memory is that you need to do what @lukasz-szyszkowski said — set up something separate to check the output of xcodebuild.

@lukasz-szyszkowski
Copy link
Contributor

lukasz-szyszkowski commented Nov 11, 2021

Isn't it in the same log file?

it produces something like this
report-2b2517.html.zip

@maratal maratal requested a review from ben-xD November 15, 2021 14:51
@maratal
Copy link
Collaborator Author

maratal commented Nov 15, 2021

Guys, do you have any idea where "Ably_vers.c" file comes from? It fails while trying to analyze it. The project contains nothing like that. Also any feedback on the approach taken in this PR is very appreciated. @lukasz-szyszkowski @lawrence-forooghian @QuintinWillison @ben-xD

UPDATE:
Turned out it's generated _vers.c

.github/workflows/check.yml Outdated Show resolved Hide resolved
.github/workflows/check.yml Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
@maratal maratal marked this pull request as draft November 17, 2021 16:49
Copy link
Contributor

@QuintinWillison QuintinWillison left a comment

Choose a reason for hiding this comment

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

Sorry, @maratal - perhaps I should have spotted this on first pass but I still think this isn't doing what you expect it might.

.github/workflows/check.yml Outdated Show resolved Hide resolved
@jamienewcomb
Copy link
Member

@maratal what is the status of this one? are you wanting on another review from Quintin. If so, please re-request

@QuintinWillison
Copy link
Contributor

Sorry, @jamienewcomb - my bad - I was somewhat overloaded last few weeks so didn't come back to this. Reviewing again now.

Copy link
Contributor

@QuintinWillison QuintinWillison left a comment

Choose a reason for hiding this comment

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

Looks sensible from a workflows perspective, though I'll admit the solution as a whole feels a little fragile (i.e. failing due to second hand information, being presence of reports output). Either way, presumably this is better than what we had before so I do think it'll move the codebase forwards (even though I predict we'll probably end up looking at this again in the future... time will tell).

@QuintinWillison QuintinWillison removed the request for review from ben-xD December 21, 2021 16:37
@maratal maratal merged commit 79b2843 into main Dec 30, 2021
@maratal maratal deleted the feature/1202-static-analyser branch December 30, 2021 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Run static analysis for builds in CI
5 participants