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

Added GitHub Actions workflows #506

Closed
wants to merge 1 commit into from

Conversation

nmoinvaz
Copy link
Contributor

@nmoinvaz nmoinvaz commented Jun 6, 2020

Description:

  • On each commit these workflows will be run to verify that project generation, source file compilation, and test cases run successfully.
  • On each pull request a workflow will be run to verify that all fuzzing tests pass successfully.

Supports the following CI configurations:

  • CMake
    • Ubuntu GCC
    • Ubuntu GCC OSB (out of source build)
    • Ubuntu Clang
    • Ubuntu Clang Debug
    • Windows MSVC Win32
    • Windows MSVC Win64
    • macOS Clang
    • macOS GCC
  • Configure
    • Ubuntu GCC
    • Ubuntu GCC OSB (out of source build)
    • macOS GCC
  • Fuzz
    • OSS-Fuzz on pull request only

Example runs can be found here:
https://github.com/nmoinvaz/zlib/actions

This PR does not change any source code and only adds yaml workflows. Take from this PR what you need.

@nmoinvaz
Copy link
Contributor Author

@madler consider getting rid of appveyor and use GitHub Actions.

0ric1 added a commit to 0ric1/zlib that referenced this pull request Apr 9, 2022
@Neustradamus
Copy link

@madler: What do you think?

@nmoinvaz nmoinvaz force-pushed the improvements/ci-cmake branch from 138b8f4 to 79a98fb Compare August 18, 2022 22:01
@nmoinvaz
Copy link
Contributor Author

I did some minor cleanup incase anybody cares.

@ProgramMax
Copy link

FWIW, I support this. :)
The changes from https://github.com/madler/zlib/pull/492/files test/example.c would still be helpful.

Back when that other pull request was proposed, there was concern within Google about Github Actions not being secure enough. That has since changed. And given the change, I recommend using Github Actions instead of AppVeyor.

It will be much easier for everyone involved, too. You'll recall last time we tried to get AppVeyor running it had more steps (each of which required confirming it is safe) than it was worth. With this, we won't need those annoying steps.

It might be good to land this first. Then I can update the other pull request to not include any AppVeyor parts. That'll bring the useful test/example.c changes in.

@madler
Copy link
Owner

madler commented Aug 23, 2022

So I just add these files, and then, magic? Are there any settings or permissions on GitHub needed?

I think I have turned off appveyor.

@nmoinvaz
Copy link
Contributor Author

Correct, magic, if you build it they will come.

@nmoinvaz
Copy link
Contributor Author

By the way, something I did not add was the ability to check to see that contribs compiled. Perhaps contrib authors can add those workflows. And I did not add checks for the vcproj files you have. Only checked cmake and configure.

If there is interest I can look into some of that.

@madler
Copy link
Owner

madler commented Aug 23, 2022

Pull requests need to be on develop, not master. @nmoinvaz Can you resubmit?

@nmoinvaz
Copy link
Contributor Author

They should be activated for all branches. Are you saying you only want for develop?

@madler
Copy link
Owner

madler commented Aug 23, 2022

Yes, develop. master is only for releases. When there is a new release, the files will end up on master as well.

@nmoinvaz
Copy link
Contributor Author

You should be able to press the Edit button on this PR on the top right and change it from master to develop.

@madler madler changed the base branch from master to develop August 23, 2022 22:04
@madler
Copy link
Owner

madler commented Aug 23, 2022

Didn't know I could do that. Thanks!

@ProgramMax
Copy link

I'll submit a pull request to get rid of AppVeyor. That "build failed" just then is annoying. :)

@ProgramMax
Copy link

Oh. The AppVeyor files didn't land. I think the error is because the AppVeyor account is linked here but isn't finding any files instructing it.

You can probably log into AppVeyor and remove zlib from the repos for it to check.

@madler
Copy link
Owner

madler commented Aug 23, 2022

@ProgramMax I have deleted zlib from appveyor. Hopefully it has been exorcised now.

@ProgramMax
Copy link

Sounds good.
It is likely still showing up here because there have been no code changes and GitHub remembers the last CI results. But future changes should be fine.

@nmoinvaz nmoinvaz force-pushed the improvements/ci-cmake branch 3 times, most recently from 0c61909 to 75fc8b3 Compare August 24, 2022 20:15
@Croydon
Copy link

Croydon commented Aug 24, 2022

Please don't force push into pull requests when it isn't necessary for the future. Reviewers have to start again to review the entire pull request instead of just the new changes. Additionally, you don't give any credits to the reviewers for code suggestions.

@nmoinvaz
Copy link
Contributor Author

nmoinvaz commented Aug 24, 2022

Please don't force push into pull requests when it isn't necessary for the future. Reviewers have to start again to review the entire pull request instead of just the new changes.

There are pros and cons of each way.

Additionally, you don't give any credits to the reviewers for code suggestions.

I'm not sure that it makes sense for EVERY suggestion to be credited. The commits in zlib are always authored by @madler and he can credit whoever he wants - even all 6 participants on this PR. After having it open for 2 years I would be happy if the changes are merged even if I don't get credit. A lot of the changes I made since last push were already made by me in zlib-ng GHA workflows (which is where these workflows come from) but this PR was never updated, your suggestions I have already made there even, although the GCC issue was only partially made in zlib-ng already.

Comment on lines 11 to 19
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc

- name: Ubuntu GCC OSB
os: ubuntu-latest
compiler: gcc
build-dir: ../build
build-src-dir: ../zlib

Choose a reason for hiding this comment

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

What is "OSB" here?

Also, isn't it normal when using CMake to:
$ mkdir build
$ cd build
$ cmake ..
Should all the CMake builds be doing that? (Which is similar but not the same to what OSB is doing.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OSB means out of source build, meaning build in a separate directory from the source directory, which is the typical case. I have reversed it, so there is now a "ISB" aka in-source-build run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I now realize why I did it in reverse, because GitHub does not allow you to upload a configure.log from outside the source directory.

uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'zlib'
fuzz-seconds: 600

Choose a reason for hiding this comment

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

I'm curious about a 10 minute fuzzer run.

On one hand, I like the idea of making sure the fuzzer works. That way we don't accidentally break it. That is the benefit of having it in the CI.

But on the other hand, we are unlikely to find problems in only 10 minutes. And we don't need it to run for 10 minutes to make sure it wasn't broken. Also, I don't think anyone wants to wait around for 10 minutes before learning if the CI approves their change.

Could this just be 30s? Do we actually want 10 minutes of fuzzing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

10 minutes might be long as you say. But there is also a cost to spooling up a new CI instance for GH so it should probably be greater than 30 seconds. I think 5 minutes is a good medium.

@nmoinvaz nmoinvaz force-pushed the improvements/ci-cmake branch 6 times, most recently from 00e55c2 to 76ecc86 Compare October 6, 2022 21:46
@nmoinvaz
Copy link
Contributor Author

nmoinvaz commented Oct 6, 2022

Rebased.

On each commit these workflows will be run to verify that project
generation, source file compilation, and test cases run successfully. On each
pull request a workflow will be run to verify that all fuzzing tests pass
successfully. madler#492
@nmoinvaz nmoinvaz force-pushed the improvements/ci-cmake branch from 76ecc86 to 5236324 Compare October 6, 2022 21:51
@madler
Copy link
Owner

madler commented Oct 7, 2022

Incorporated.

@madler madler closed this Oct 7, 2022
@madler
Copy link
Owner

madler commented Oct 10, 2022

Thank you so much @nmoinvaz for this! It seems to working great.

I say "seems", only because it's always giving a green check mark. I find this suspicious. I went in and looked at the output, and I didn't even see any warnings. Will this show or flag warnings from the compilations? Or only errors?

@ProgramMax
Copy link

Agreed. Thank you for doing this, @nmoinvaz.

Warnings are allowed by default. Errors will not give a green check mark. We can add a flag to treat warnings as errors if we wanted.
Any step that has a non-zero exit code (IE returning -1 from main()) will prevent the green checkmark.

It does seem strangely quiet, though. Things which I thought would return non-zero aren't.

There are 3 jobs: Ubuntu GCC, Ubuntu GCC ISB, and macOS GCC.
Only the Ubuntu GCC ISB is really working. The other two print "Please use ./configure first. Thank you." and "make: Nothing to be done for 'test'.".

So I think we have some follow-up work to do. But it is correctly building and testing on Ubuntu GCC ISB.

@ProgramMax
Copy link

Oops. Let me correct myself:
There are 3 workflows. The "Configure" workflow behaves the way I described above.
There is also a "CMake" workflow that builds and tests correctly on all of its platforms.
Then there is an "OSS-Fuzz" workflow which hasn't run yet.

@madler
Copy link
Owner

madler commented Oct 10, 2022

What is "GCC ISB"?

@ProgramMax
Copy link

ISB = In-Source Build.

For CMake, it is common to:
$ mkdir build
$ cd build
$ cmake ..
Then all build files are inside the build/ subdirectory, rather than scattered within the code.
The non-ISB jobs do this. The ISB job does not.

@nmoinvaz
Copy link
Contributor Author

nmoinvaz commented Oct 10, 2022

@ProgramMax is right.

And configure working-directory steps should be changed to:

image

When I created this PR 2 years ago, there were some CI instances I knew weren't working, but I decided to only go with those that were working first (I don't remember which ones failed). It also may have been something incompatible with zlib CMake/configure itself.

I can add more CI instances to the workflows (ARM, etc) in another PR.

@nmoinvaz
Copy link
Contributor Author

Also we don't check building of any contribs.

@madler
Copy link
Owner

madler commented Oct 11, 2022

Also we don't check building of any contribs.

That's fine for now. The only one we might eventually want to add is minizip. I check that one in my internal tests.

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.

6 participants