CC - container Alpine clang-static-pie #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) Markus Franz Xaver Johannes Oberhumer | |
# DO NOT EDIT, GENERATED AUTOMATICALLY | |
name: CC - container Alpine clang-static-pie | |
"on": | |
schedule: | |
- cron: 20 1 * * 2 | |
workflow_dispatch: null | |
env: | |
CMAKE_REQUIRED_QUIET: "OFF" | |
CMAKE_VERBOSE_MAKEFILE: "ON" | |
CTEST_OUTPUT_ON_FAILURE: "ON" | |
DEBIAN_FRONTEND: noninteractive | |
UPX_CMAKE_CONFIG_FLAGS: -Wdev --warn-uninitialized | |
UPX_CONFIG_DISABLE_SHARED_LIBS: "ON" | |
UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1 | |
UPX_DEBUG_TEST_LIBC_QSORT: 1 | |
VERBOSE: 1 | |
REMOTE_REF_NAME: devel | |
REMOTE_REF_TYPE: branch | |
REMOTE_REPOSITORY: upx/upx | |
REMOTE_SERVER_URL: https://github.com | |
REMOTE_SHA: "0000000000000000000000000000000000000000" | |
jobs: | |
clang: | |
if: github.repository_owner == 'upx' | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- container: alpine:3.11 | |
skip_valgrind: true | |
- container: alpine:3.12 | |
skip_qemu: true | |
skip_valgrind: true | |
- container: alpine:3.13 | |
- container: alpine:3.14 | |
- container: alpine:3.15 | |
- container: alpine:3.16 | |
- container: alpine:3.17 | |
- container: alpine:3.18 | |
- container: alpine:3.19 | |
- container: alpine:3.20 | |
- container: alpine:3.21 | |
skip_qemu: true | |
- container: alpine:edge | |
- container: i386/alpine:3.11 | |
- container: i386/alpine:3.12 | |
skip_qemu: true | |
- container: i386/alpine:3.13 | |
- container: i386/alpine:3.14 | |
- container: i386/alpine:3.15 | |
- container: i386/alpine:3.16 | |
- container: i386/alpine:3.17 | |
- container: i386/alpine:3.18 | |
- container: i386/alpine:3.19 | |
- container: i386/alpine:3.20 | |
- container: i386/alpine:3.21 | |
- container: i386/alpine:edge | |
env: | |
CC: clang -static-pie -fPIE -Wno-unused-command-line-argument | |
CXX: clang++ -static-pie -fPIE -Wno-unused-command-line-argument | |
steps: | |
- name: Display environment | |
run: | | |
uname -a; pwd; id; umask | |
env | LC_ALL=C sort | |
- name: ${{ format('Install packages {0}', matrix.container) }} | |
run: | | |
apk update && apk upgrade && apk add cmake clang git make | |
case ${{ matrix.container }} in | |
# g++ is needed on Alpine <= 3.18 because of missing dependencies | |
*:3.[0-9] | *:3.1[0-8]) apk add g++ ;; | |
esac | |
case ${{ matrix.container }} in | |
# clang-dev is needed on Alpine <= 3.11 for clang headers like <emmintrin.h> | |
*:3.[0-9] | *:3.1[0-1]) apk add clang-dev ;; | |
esac | |
case ${{ matrix.container }} in | |
# llvm-dev is needed on Alpine <= 3.18 for -flto (-flto only works on Alpine >= 3.15) | |
*:3.1[5-8]) apk add llvm-dev ;; | |
esac | |
- run: set -x; $CC --version; $CXX --version | |
- run: $CC -E -x c -dM /dev/null | |
- run: $CXX -E -x c++ -dM /dev/null | |
- name: ${{ format('Check out {0}/{1} {2} {3} source code', env.REMOTE_SERVER_URL, env.REMOTE_REPOSITORY, env.REMOTE_REF_TYPE, env.REMOTE_REF_NAME) }} | |
run: | | |
# git config | |
git config --global core.autocrlf false | |
git config --global --add safe.directory '*' | |
# install Self, needed for config file below | |
git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" ../Self | |
# install repo | |
git clone --branch "$REMOTE_REF_NAME" --depth 1 "$REMOTE_SERVER_URL/$REMOTE_REPOSITORY" . | |
test -f ./.gitmodules && git submodule update --init | |
# TODO: handle REMOTE_REF_TYPE == "tag" | |
# update environment | |
rev="$(git rev-parse HEAD)" | |
echo "REMOTE_SHA=$rev" >> $GITHUB_ENV | |
- name: ${{ format('Build Debug with {0} and {1}', env.CC, env.CXX) }} | |
run: make build/debug | |
- name: ${{ format('Build Release with {0} and {1}', env.CC, env.CXX) }} | |
run: make build/release | |
- name: Inspect binaries | |
run: | | |
apk add file | |
ls -l build/*/upx | |
size build/*/upx | |
file build/*/upx | |
- name: Run tests | |
run: | | |
make build/debug+test | |
make build/release+test | |
if test -f ./misc/testsuite/test_symlinks.sh; then true; | |
apk add bash sudo | |
# IMPORTANT: do NOT run as user root! | |
(cd build/release && chmod a+w . && sudo -u nobody bash ../../misc/testsuite/test_symlinks.sh) | |
fi | |
true | |
- name: Mimic ctest tests | |
run: | | |
if test -f ./misc/testsuite/mimic_ctest.sh; then true; | |
apk add bash | |
(cd build/debug && bash ../../misc/testsuite/mimic_ctest.sh) | |
(cd build/release && bash ../../misc/testsuite/mimic_ctest.sh) | |
fi | |
true | |
- name: Mimic ctest tests QEMU | |
if: ${{ !matrix.skip_qemu }} | |
run: | | |
if test -f ./misc/testsuite/mimic_ctest.sh; then true; | |
case ${{ matrix.container }} in | |
i386/*) apk add bash qemu-i386; export upx_exe_runner=qemu-i386 ;; | |
*) apk add bash qemu-x86_64; export upx_exe_runner=qemu-x86_64 ;; | |
esac | |
(cd build/debug && bash ../../misc/testsuite/mimic_ctest.sh) | |
(cd build/release && bash ../../misc/testsuite/mimic_ctest.sh) | |
fi | |
true | |
- name: Mimic ctest tests Valgrind | |
if: ${{ !matrix.skip_valgrind && (success() || failure()) }} | |
run: | | |
if test -f ./misc/testsuite/mimic_ctest.sh; then true; | |
apk add bash valgrind | |
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all" | |
#upx_exe_runner="$upx_exe_runner --show-error-list=yes" # only works on Alpine >= 3.10 | |
for f in "$PWD"/misc/valgrind/musl.supp "$PWD"/../Self/.github/misc/valgrind/musl.supp; do | |
if test -f "$f"; then upx_exe_runner="$upx_exe_runner --suppressions=$f"; fi | |
done | |
(cd build/debug && bash ../../misc/testsuite/mimic_ctest.sh) | |
(cd build/release && bash ../../misc/testsuite/mimic_ctest.sh) | |
fi | |
true |