CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2023-11-01 08:48:27 +01:00
parent e964d4acf3
commit 3b7d25ac49
7 changed files with 136 additions and 79 deletions

View File

@ -13,8 +13,8 @@ env:
CTEST_OUTPUT_ON_FAILURE: "ON"
DEBIAN_FRONTEND: noninteractive
UPX_CMAKE_BUILD_FLAGS: --verbose
# 2023-10-30
ZIG_DIST_VERSION: 0.12.0-dev.1350+91e117697
# 2023-11-01
ZIG_DIST_VERSION: 0.12.0-dev.1369+a09ba455c
jobs:
job-rebuild-and-verify-stubs:

View File

@ -17,5 +17,5 @@ jobs:
uses: actions/checkout@v4
with: { submodules: false }
- name: 'Spell check with crate-ci/typos'
uses: crate-ci/typos@c004e98018d8621614d1ca516eed8ca2d04b365a # v1.16.20
uses: crate-ci/typos@47dd2976043bd5c76a33aa9300b328a176a1d6f7 # v1.16.21
with: { config: ./.github/typos_config.toml }

View File

@ -19,14 +19,15 @@ jobs:
fail-fast: false
matrix:
include:
# cl (msvc)
# cl (MSVC)
- { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64 }
- { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_arm64 }
- { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_x86 }
- { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64 }
- { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_arm64 }
- { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_x86 }
# clang-cl
# clang-cl (from MSVC)
- { os: windows-2019, cc: clang-cl, cxx: clang-cl, vsversion: 2019, arch: amd64 }
- { os: windows-2022, cc: clang-cl, cxx: clang-cl, vsversion: 2022, arch: amd64 }
# clang
- { os: windows-2022, cc: clang, cxx: 'clang++', arch: amd64, xflags: '-static' }

53
.github/workflows/weekly-ci-bs-misc.yml vendored Normal file
View File

@ -0,0 +1,53 @@
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
# BS BuildSystem: build misc
name: 'Weekly CI BS - Misc'
on:
schedule: [cron: '40 1 * * 3'] # run weekly Wednesday 01:50 UTC
workflow_dispatch:
env:
CMAKE_REQUIRED_QUIET: "OFF"
CTEST_OUTPUT_ON_FAILURE: "ON"
DEBIAN_FRONTEND: noninteractive
jobs:
job-bs-misc: # uses cmake + make
if: github.repository_owner == 'upx'
strategy:
fail-fast: false
matrix:
container:
- 'alpine:3.18'
- 'i386/alpine:3.18'
cc:
- 'clang'
- 'gcc'
cppflags:
- '-DWITH_XSPAN=0'
- '-DWITH_XSPAN=1'
- '-DWITH_XSPAN=2'
- '-DDOCTEST_CONFIG_DISABLE'
runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
- name: ${{ format('Install packages {0}', matrix.container) }}
run: 'apk update && apk upgrade && apk add clang cmake g++ git make'
- name: ${{ format('Check out UPX {0} source code', github.ref_name) }}
run: |
# this seems to be needed when running in a container (beause of UID mismatch??)
git config --global --add safe.directory '*'
git clone --branch "$GITHUB_REF_NAME" --depth 1 https://github.com/upx/upx .
git submodule update --init
# set environment
xflags="-static ${{ matrix.cppflags }}"
case ${{ matrix.cc }} in
clang) CC="clang $xflags"; CXX="clang++ $xflags" ;;
gcc) CC="gcc $xflags"; CXX="g++ $xflags" ;;
*) CC=false; CXX=false ;;
esac
echo -e "CC=$CC\nCXX=$CXX" >> $GITHUB_ENV
- name: 'Build Debug'
run: 'make debug && ctest --test-dir build/debug'
- name: 'Build Release'
if: success() || failure() # run this step even if the previous step failed
run: 'make release && ctest --test-dir build/debug'

View File

@ -11,8 +11,8 @@ env:
CMAKE_REQUIRED_QUIET: "OFF"
CTEST_OUTPUT_ON_FAILURE: "ON"
DEBIAN_FRONTEND: noninteractive
# 2023-10-30
ZIG_DIST_VERSION: 0.12.0-dev.1350+91e117697
# 2023-11-01
ZIG_DIST_VERSION: 0.12.0-dev.1369+a09ba455c
jobs:
job-linux-zigcc: # uses cmake + make

View File

@ -99,36 +99,36 @@ TEST_CASE("ptr_reinterpret_cast") {
int *ip = nullptr;
double *dp = nullptr;
CHECK((vp == ptr_reinterpret_cast<void *>(vp)));
CHECK((vp == ptr_reinterpret_cast<void *>(bp)));
CHECK((vp == ptr_reinterpret_cast<void *>(ip)));
CHECK((vp == ptr_reinterpret_cast<void *>(dp)));
assert((vp == ptr_reinterpret_cast<void *>(vp)));
assert((vp == ptr_reinterpret_cast<void *>(bp)));
assert((vp == ptr_reinterpret_cast<void *>(ip)));
assert((vp == ptr_reinterpret_cast<void *>(dp)));
CHECK((bp == ptr_reinterpret_cast<byte *>(vp)));
CHECK((bp == ptr_reinterpret_cast<byte *>(bp)));
CHECK((bp == ptr_reinterpret_cast<byte *>(ip)));
CHECK((bp == ptr_reinterpret_cast<byte *>(dp)));
assert((bp == ptr_reinterpret_cast<byte *>(vp)));
assert((bp == ptr_reinterpret_cast<byte *>(bp)));
assert((bp == ptr_reinterpret_cast<byte *>(ip)));
assert((bp == ptr_reinterpret_cast<byte *>(dp)));
CHECK((ip == ptr_reinterpret_cast<int *>(vp)));
CHECK((ip == ptr_reinterpret_cast<int *>(bp)));
CHECK((ip == ptr_reinterpret_cast<int *>(ip)));
CHECK((ip == ptr_reinterpret_cast<int *>(dp)));
assert((ip == ptr_reinterpret_cast<int *>(vp)));
assert((ip == ptr_reinterpret_cast<int *>(bp)));
assert((ip == ptr_reinterpret_cast<int *>(ip)));
assert((ip == ptr_reinterpret_cast<int *>(dp)));
CHECK((dp == ptr_reinterpret_cast<double *>(vp)));
CHECK((dp == ptr_reinterpret_cast<double *>(bp)));
CHECK((dp == ptr_reinterpret_cast<double *>(ip)));
CHECK((dp == ptr_reinterpret_cast<double *>(dp)));
assert((dp == ptr_reinterpret_cast<double *>(vp)));
assert((dp == ptr_reinterpret_cast<double *>(bp)));
assert((dp == ptr_reinterpret_cast<double *>(ip)));
assert((dp == ptr_reinterpret_cast<double *>(dp)));
const byte *bc = nullptr;
const int *ic = nullptr;
CHECK((bc == ptr_reinterpret_cast<byte *>(bp)));
CHECK((bc == ptr_reinterpret_cast<const byte *>(bc)));
CHECK((bc == ptr_reinterpret_cast<byte *>(ip)));
CHECK((bc == ptr_reinterpret_cast<const byte *>(ic)));
CHECK((ic == ptr_reinterpret_cast<int *>(bp)));
CHECK((ic == ptr_reinterpret_cast<const int *>(bc)));
CHECK((ic == ptr_reinterpret_cast<int *>(ip)));
CHECK((ic == ptr_reinterpret_cast<const int *>(ic)));
assert((bc == ptr_reinterpret_cast<byte *>(bp)));
assert((bc == ptr_reinterpret_cast<const byte *>(bc)));
assert((bc == ptr_reinterpret_cast<byte *>(ip)));
assert((bc == ptr_reinterpret_cast<const byte *>(ic)));
assert((ic == ptr_reinterpret_cast<int *>(bp)));
assert((ic == ptr_reinterpret_cast<const int *>(bc)));
assert((ic == ptr_reinterpret_cast<int *>(ip)));
assert((ic == ptr_reinterpret_cast<const int *>(ic)));
}
TEST_CASE("noncopyable") {
@ -155,7 +155,7 @@ TEST_CASE("noncopyable") {
namespace {
template <class T>
struct TestTriBool {
static void test(bool expect_true) noexcept {
static void test(bool expect_true) {
static_assert(std::is_class<T>::value);
static_assert(std::is_nothrow_default_constructible<T>::value);
static_assert(std::is_nothrow_destructible<T>::value);
@ -171,6 +171,7 @@ struct TestTriBool {
#endif
static_assert(!bool(T(false)));
static_assert(bool(T(true)));
static_assert(bool(T(T::Third)) == T::is_third_true);
static_assert(T(false) == T::False);
static_assert(T(true) == T::True);
static_assert(T(T::False) == T::False);
@ -190,64 +191,65 @@ struct TestTriBool {
static_assert(array[2].isThird());
static_assert(sizeof(array) == 3 * sizeof(T));
T a;
CHECK(a.getValue() == T::False);
CHECK(!a);
CHECK(!bool(a));
CHECK((!a ? true : false));
CHECK(a.isStrictFalse());
CHECK(!a.isStrictTrue());
CHECK(a.isStrictBool());
CHECK(!a.isThird());
assert(a.getValue() == T::False);
assert(!a);
assert(!bool(a));
assert((!a ? true : false));
assert(a.isStrictFalse());
assert(!a.isStrictTrue());
assert(a.isStrictBool());
assert(!a.isThird());
a = false;
CHECK(a.getValue() == T::False);
CHECK(!a);
CHECK(!bool(a));
CHECK((!a ? true : false));
CHECK(a.isStrictFalse());
CHECK(!a.isStrictTrue());
CHECK(a.isStrictBool());
CHECK(!a.isThird());
assert(a.getValue() == T::False);
assert(!a);
assert(!bool(a));
assert((!a ? true : false));
assert(a.isStrictFalse());
assert(!a.isStrictTrue());
assert(a.isStrictBool());
assert(!a.isThird());
a = true;
CHECK(a.getValue() == T::True);
CHECK(a);
CHECK(bool(a));
CHECK((a ? true : false));
CHECK(!a.isStrictFalse());
CHECK(a.isStrictTrue());
CHECK(a.isStrictBool());
CHECK(!a.isThird());
assert(a.getValue() == T::True);
assert(a);
assert(bool(a));
assert((a ? true : false));
assert(!a.isStrictFalse());
assert(a.isStrictTrue());
assert(a.isStrictBool());
assert(!a.isThird());
a = T::Third;
CHECK(a.getValue() == T::Third);
assert(a.getValue() == T::Third);
assert(T::is_third_true == expect_true);
if (expect_true) {
CHECK(a);
CHECK(bool(a));
CHECK((a ? true : false));
assert(a);
assert(bool(a));
assert((a ? true : false));
} else {
CHECK(!a);
CHECK(!bool(a));
CHECK((!a ? true : false));
assert(!a);
assert(!bool(a));
assert((!a ? true : false));
}
CHECK(!a.isStrictFalse());
CHECK(!a.isStrictTrue());
CHECK(!a.isStrictBool());
CHECK(a.isThird());
assert(!a.isStrictFalse());
assert(!a.isStrictTrue());
assert(!a.isStrictBool());
assert(a.isThird());
a = 99;
CHECK(a.getValue() == T::Third);
assert(a.getValue() == T::Third);
if (expect_true) {
CHECK(a);
CHECK(bool(a));
CHECK((a ? true : false));
assert(a);
assert(bool(a));
assert((a ? true : false));
} else {
CHECK(!a);
CHECK(!bool(a));
CHECK((!a ? true : false));
assert(!a);
assert(!bool(a));
assert((!a ? true : false));
}
CHECK(!a.isStrictFalse());
CHECK(!a.isStrictTrue());
CHECK(!a.isStrictBool());
CHECK(a.isThird());
assert(!a.isStrictFalse());
assert(!a.isStrictTrue());
assert(!a.isStrictBool());
assert(a.isThird());
mem_clear(&a);
CHECK(a.isStrictFalse());
assert(a.isStrictFalse());
}
};
} // namespace

View File

@ -114,6 +114,7 @@ constexpr bool string_ge(const char *a, const char *b) { return !string_lt(a, b)
template <class T = int, bool IsThirdTrue = false> // Third is false by default
struct TriBool final {
static constexpr bool is_third_true = IsThirdTrue;
// types
typedef T underlying_type;
static_assert(std::is_integral_v<underlying_type>);