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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 51 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Run tests
run: ./test/ci/amd64.sh
run: ./test/ci/test.sh

cmake-test:
name: cmake-${{ matrix.runner }}
Expand Down Expand Up @@ -63,15 +63,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Run tests
run: ./test/ci/amd64.sh
run: ./test/ci/test.sh

alpine-cmake-test:
name: cmake-alpine-amd64-gcc
runs-on: ubuntu-latest
container:
image: alpine:3.12
env:
CC: gcc
steps:
- name: Install deps
run: apk add --update bash build-base cmake git
Expand All @@ -84,3 +82,52 @@ jobs:
- name: CTest
run: ctest --no-tests=error -VV --build-config Release
working-directory: ./out

alpine-alt-arch-makefile-test:
name: makefile-alpine-${{ matrix.arch }}-${{ matrix.cc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [armv7, aarch64, s390x, ppc64le]
cc: [gcc, clang]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
with:
arch: ${{matrix.arch}}
distro: alpine_latest
mayeut marked this conversation as resolved.
Show resolved Hide resolved
env: |
CC: ${{matrix.cc}}
install: apk add --update bash build-base cmake git ${{matrix.cc}}
run: ./test/ci/test.sh

alpine-alt-arch-cmake-test:
name: cmake-alpine-${{ matrix.arch }}-${{ matrix.cc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [armv7, aarch64, s390x, ppc64le]
cc: [gcc, clang]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
with:
arch: ${{matrix.arch}}
distro: alpine_latest
env: |
CC: ${{matrix.cc}}
install: apk add --update bash build-base cmake git ${{matrix.cc}}
run: |
echo "::group::CMake Configure"
cmake -B out -Werror=dev -DBASE64_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release
echo "::endgroup::CMake Configure"
echo "::group::CMake Build"
cmake --build out --config Release --verbose
echo "::endgroup::CMake Build"
echo "::group::CTest"
ctest --no-tests=error --test-dir out -VV --build-config Release
echo "::endgroup::CTest"
9 changes: 6 additions & 3 deletions lib/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@
#endif

// Detect word size:
#if defined(_INTEGRAL_MAX_BITS)
#if defined(__x86_64__) && defined(__ILP32__)
// this is the way to detect x32 ABI per https://wiki.debian.org/X32Port
# define BASE64_WORDSIZE 64
#elif defined(_INTEGRAL_MAX_BITS)
# define BASE64_WORDSIZE _INTEGRAL_MAX_BITS
#elif defined(__WORDSIZE)
# define BASE64_WORDSIZE __WORDSIZE
#elif defined (__LONG_WIDTH__)
# define BASE64_WORDSIZE __LONG_WIDTH__
#elif defined (__SIZE_WIDTH__)
# define BASE64_WORDSIZE __SIZE_WIDTH__
#else
# error BASE64_WORDSIZE_NOT_DEFINED
#endif
Expand Down
21 changes: 0 additions & 21 deletions test/ci/amd64.sh

This file was deleted.

13 changes: 0 additions & 13 deletions test/ci/docker-arm32.sh

This file was deleted.

11 changes: 0 additions & 11 deletions test/ci/docker-guest.sh

This file was deleted.

12 changes: 0 additions & 12 deletions test/ci/docker-powerpc.sh

This file was deleted.

8 changes: 0 additions & 8 deletions test/ci/generic.sh

This file was deleted.

28 changes: 28 additions & 0 deletions test/ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -ve

MACHINE=$(uname -m)
if [ "${MACHINE}" == "x86_64" ]; then
export SSSE3_CFLAGS=-mssse3
export SSE41_CFLAGS=-msse4.1
export SSE42_CFLAGS=-msse4.2
export AVX_CFLAGS=-mavx
# no AVX2 on GHA macOS
if [ "$(uname -s)" != "Darwin" ]; then
export AVX2_CFLAGS=-mavx2
fi
Comment on lines +10 to +13
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.

elif [ "${MACHINE}" == "aarch64" ]; then
export NEON64_CFLAGS="-march=armv8-a"
elif [ "${MACHINE}" == "armv7l" ]; then
export NEON32_CFLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=neon"
fi

if [ "${OPENMP:-}" == "0" ]; then
unset OPENMP
fi

uname -a
${CC} --version

make
make -C test