crystal-lang / install-crystal

GitHub Action: Install Crystal programming language
https://crystal-lang.github.io/install-crystal/configurator.html
MIT License
68 stars 8 forks source link

Dependencies inconsistency #26

Open straight-shoota opened 1 year ago

straight-shoota commented 1 year ago

The actions explicitly installs some dependencies such as libssl-dev on Linux, but not on macOS (on Windows, the libraries are already included in the Crystal package). This causes some inconsistency because after installing with this action, a program linking against libssl compiles fine on Linux, but not on macOS.

Example for such a failure: https://github.com/crystal-lang/test-ecosystem/actions/runs/5400167770/jobs/9808241746 (the workflow succeeds on Linux and Windows, but not on macOS).

Should this action install some dependencies on macOs as well?

oprypin commented 1 year ago

There is a test that require "openssl" passes on macos-latest.

https://github.com/crystal-lang/install-crystal/actions/runs/5397768652/jobs/9802797905#step:10:1

straight-shoota commented 1 year ago

After further experimenting, it seems like pkg-config might be missing? /Users/runner/work/_temp/aab7155d-6082-4491-80ef-a413a4c35af6.sh: line 3: pkg-config: command not found.

After installing it with brew install pkg-config the build works.

oprypin commented 1 year ago

FWIW the two runs that we are comparing are macos versions 13.4 versus 12.6.6. It may very well be that this action is broken on "macos-13" and we should add something to install. Or alternatively the test for require "openssl" does not catch the problem.

straight-shoota commented 1 year ago

I don't think 'require "openssl"' is sufficient to verify the library is available and builds succesfully. There is no top level code that calls into libssl, so there will never be any code generated that would link any functions in the library.

oprypin commented 1 year ago

I would really welcome a contribution that addresses all of this.

Expand the example so it actually exercises the libraries in some way, and confirm that it fails

Add a background depsTask for mac similarly to this

Maybe this is simple enough that you don't even need to try it out locally, just push it to a branch and see if it runs as expected :sweat_smile:

straight-shoota commented 1 year ago

So it seems the issue is specific to macos-13, the new version of the macos runner; macos-latest is still macos-12. Dependencies are found on macos-12, but not macos-13. This now properly reproduces the error I have experienced: https://github.com/crystal-lang/install-crystal/actions/runs/5436842140/jobs/9886971657

UPDATE: Apparently pkg-config is missing from macos-13 on purpose until the image is stable: https://github.com/actions/runner-images/issues/7632 Seems a bit weird to me 🤷

That should confirm that we only need to fix the test to properly fail when dependencies are missing / cannot be found. But I suppose we probably should not need to install pkg-config explicitly because it would be expected to be available in stable runner image environments. On the other hand, it might not hurt to be explicit about it...?