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

chore: add alt-arch tests to GHA #85

Closed
wants to merge 2 commits into from
Closed

Conversation

mayeut
Copy link
Contributor

@mayeut mayeut commented Jun 5, 2022

Add alt-arch tests to GHA

Use alpine images rather the debian/ubuntu images that were used on TravisCI as they are much lighter (5.5 MB vs 65 MB).
The size of downloaded packages shall be roughly the same in any case.

fixes #83

build on top of #87

lib/env.h Outdated
@@ -49,6 +49,8 @@
# define BASE64_WORDSIZE __WORDSIZE
#elif defined (__LONG_WIDTH__)
# define BASE64_WORDSIZE __LONG_WIDTH__
#elif defined(__SIZEOF_LONG__) && defined(__CHAR_BIT__) && (__CHAR_BIT__ == 8)
# define BASE64_WORDSIZE (__SIZEOF_LONG__ * 8)
Copy link
Owner

Choose a reason for hiding this comment

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

Why sizeof(long) * 8? That makes no sense to me. Also, I think we can assume that __CHAR_BIT__ == 8, unless we expect to run on very very strange and unsupported architectures. I mean, we're writing a bit-twiddling library here.

At the least, the commit message should explain why this change is necessary.

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 think we can assume that CHAR_BIT == 8

If we assume, let's just enforce that the assumption is correct no ?

I amende the commit message.

Why sizeof(long) * 8

That's 64 on 64-bits arch and 32 on 32-bits arch, same as __LONG_WIDTH__ just above but not defined with clang.

Copy link
Owner

Choose a reason for hiding this comment

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

I think __SIZE_WIDTH__ or __POINTER_WIDTH__ might be more applicable, because size_t and pointers are pretty much always expressed in the native word size.

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 think SIZE_WIDTH or POINTER_WIDTH might be more applicable, because size_t and pointers are pretty much always expressed in the native word size.

not on x86_32

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 don't like that long stuff either but that's what makes the most sense to me right now...

Copy link
Owner

Choose a reason for hiding this comment

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

Alright, fair enough. The only place where BASE64_WORDSIZE is used is to choose between 32-bit and 64-bit generic codecs, so nothing should break if we accidentally pick the wrong one.

Copy link
Contributor Author

@mayeut mayeut Jun 5, 2022

Choose a reason for hiding this comment

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

I'm reworking this a bit differently with __SIZE_WIDTH__ & proper detection for x32 ABI in #87.

@aklomp
Copy link
Owner

aklomp commented Jun 5, 2022

Thanks, not bad, I see shades of my other project here 😸

I was going to take this ticket, but you beat me to it. My plan was to split out the multiarch stuff into a separate workflow file called .github/workflows/multiarch.yml, to separate the different workflows a bit. In my opinion, multiarch testing is different from functional testing. What do you think?

@mayeut mayeut force-pushed the alt-arch branch 2 times, most recently from 7016231 to 642f8b7 Compare June 5, 2022 13:19
@aklomp
Copy link
Owner

aklomp commented Jun 5, 2022

I noticed that at least on makefile-alpine-aarch64-clang, the NEON64 codec is not enabled. That reduces the value of the tests by a lot.

@aklomp
Copy link
Owner

aklomp commented Jun 5, 2022

Same for e.g. cmake-alpine-armv7-clang and NEON32.

@mayeut
Copy link
Contributor Author

mayeut commented Jun 5, 2022

My plan was to split out the multiarch stuff into a separate workflow file called .github/workflows/multiarch.yml, to separate the different workflows a bit. In my opinion, multiarch testing is different from functional testing. What do you think?

I think if we test specific code (I missed NEON64/NEON32 for makefile, will add it) or big-endian, it's still functional testing. But more than that, it's easy to update one workflow and forget the other one in another file so I feel it's less error prone to have them in a single file (given it does not increase its complexity/readablity by much).

@aklomp
Copy link
Owner

aklomp commented Jun 5, 2022

Can we remove the Travis CI support in a separate issue? I'd like to separate that concern. Also, some extra commits would need to be made, such as removing the Travis badge from the README.md and replacing it with a GHA badge.

@mayeut mayeut force-pushed the alt-arch branch 2 times, most recently from c9ec6ac to 08d8d55 Compare June 5, 2022 14:23
@mayeut mayeut changed the title chore: move alt-arch tests to GHA chore: add alt-arch tests to GHA Jun 5, 2022
Comment on lines +10 to +13
# no AVX2 on GHA macOS
if [ "$(uname -s)" != "Darwin" ]; then
export AVX2_CFLAGS=-mavx2
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The exception for macOS can be removed once #82 lands.

The detection for word size was dependent on `__LONG_WIDTH__` for at least gcc Alpine Linux (probably other musl distros too).
This is not working with clang which does not define `__LONG_WIDTH__`.
Replace `__LONG_WIDTH__` by `__SIZE_WIDTH__`.
As this will not work as expected for x32 ABI, add a robust x32 detection first.
Use alpine images rather the debian/ubuntu images that
were used on TravisCI as they are much lighter (5.5 MB vs 65 MB).
The size of downloaded packages shall be roughly the same in any case.
aklomp pushed a commit that referenced this pull request Jun 5, 2022
The old Travis CI config compiled and tested the code on various
architectures: arm32, arm64, ppc64be, ppc64le and s390. We can partly
replicate this with GitHub Actions by using the
`uraimo/run-on-arch-action'.

Update the CI config to run and test the library on various
architectures.

Closes #83.
Closes #85.
@aklomp aklomp closed this in 1bcb2d0 Jun 5, 2022
@mayeut mayeut deleted the alt-arch branch June 5, 2022 17:06
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.

CI: GitHub Actions: build and test on different architectures
2 participants