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

Add round-trip tests for precompiled gems #76

Merged
merged 12 commits into from
Jul 25, 2023

Conversation

stanhu
Copy link
Collaborator

@stanhu stanhu commented Jul 16, 2023

This ensures that all precompiled gems are built properly and can be run on their target operating systems.

In addition, this ensures the Ruby platform gem can be installed and tested on all platforms.

This also fixes a number of build and install issues on Windows, such as pkgconf/pkgconf#268.

Closes #69 and #70

@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch 16 times, most recently from 7671e6b to 46112b8 Compare July 16, 2023 08:27
@stanhu stanhu mentioned this pull request Jul 16, 2023
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch 2 times, most recently from d023bf2 to 4852100 Compare July 17, 2023 06:53
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch 3 times, most recently from e983957 to a9fdc8e Compare July 17, 2023 19:14
@stanhu stanhu marked this pull request as ready for review July 17, 2023 19:38
ext/re2/extconf.rb Outdated Show resolved Hide resolved
@stanhu
Copy link
Collaborator Author

stanhu commented Jul 17, 2023

@mudge This is now passing all tests! Getting Windows working was a lot trickier than I had expected.

ext/re2/extconf.rb Outdated Show resolved Hide resolved
re2.gemspec Outdated Show resolved Hide resolved
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from a9fdc8e to 8d2b685 Compare July 18, 2023 13:48
This pulls in flavorjones/mini_portile#129.
When cross-compiling Windows targets with cmake in a Linux
environment, the MSYS generator may not be available. Supplying -G
MSYS will cause the build to fail.
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from 8d2b685 to 840b822 Compare July 18, 2023 13:53
This pulls in flavorjones/mini_portile#130.
We no longer need to write custom logic for finding the right
compilers and setting CMake variables for cross-compilation.
This ensures the generated gem has a unique version number, so define
`RE2::VERSION` in a separate file to make this possible.
Previously sence `rake spec` required the `compile` step,
`scripts/test-gem-install` failed because `extconf.rb` was
removed. Fix this by making the default task depend on the `compile`
task, but the `spec` task independent of the `compile` task.
This ensures that all precompiled gems are built properly and can be
run on their target operating systems.

Closes mudge#69
This reduces the filename lengths since Windows can hit a limit of 250
characters (CMAKE_OBJECT_PATH_MAX).
These are required dependencies for abseil until a custom musl gem is
built:
mudge#67 (comment)
On systems where pkgconf v1.9.3 is used for pkg-config, the output of
`pkg-config --static --libs` is incorrect, resulting in build failures
(pkgconf/pkgconf#268). This commit fixes
the issue by hard-coding the abseil libraries needed to link the
extension properly.
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from 840b822 to 6985843 Compare July 18, 2023 16:45
Rather than remove all files and conditionally guard against
version.rb load errors, just include the required files for testing
in the gem and test against the installed directory.
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from 3fa1bb4 to 0bec72c Compare July 19, 2023 08:05
@stanhu stanhu requested a review from mudge July 19, 2023 16:30
@mudge
Copy link
Owner

mudge commented Jul 21, 2023

@flavorjones if you have any availability, it’d be great if you could cast a critical eye on this too.

Copy link

@flavorjones flavorjones left a comment

Choose a reason for hiding this comment

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

Made a few suggestions, but this mostly looks good.

.github/workflows/precompiled.yml Outdated Show resolved Hide resolved
.github/workflows/precompiled.yml Outdated Show resolved Hide resolved
.github/workflows/precompiled.yml Outdated Show resolved Hide resolved
.github/workflows/precompiled.yml Outdated Show resolved Hide resolved
.github/workflows/precompiled.yml Outdated Show resolved Hide resolved
.github/workflows/precompiled.yml Outdated Show resolved Hide resolved
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from 54a35a6 to 43e2d36 Compare July 22, 2023 15:14
with:
name: cruby-x64-mingw-ucrt-gem
path: gems
- run: ./scripts/test-gem-install gems

Choose a reason for hiding this comment

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

I'm curious how this is running without specifying shell: bash? I expected this to fail. I wonder if there's been some shebang magic introduced on the windows images (or if github changed the default behavior?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, I'm not sure https://github.com/mudge/re2/actions/runs/5596591577/job/15159473313 actually ran. Maybe since ErrorActionPreference=Stop wasn't set, the job didn't actually fail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from 43e2d36 to 06bbaa1 Compare July 22, 2023 15:51
This avoids the visibility setting warnings in the linker
(https://github.com/mudge/re2/actions/runs/5631492710/job/15258506852)
and reduces the size of the binaries.
@stanhu stanhu force-pushed the sh-add-precompiled-ci-tests branch from eef907e to f42a93d Compare July 23, 2023 04:53
@mudge mudge merged commit 443214e into mudge:v2.0.x Jul 25, 2023
101 checks passed
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.

3 participants