Skip to content

Better resizing of char_vector in edge cases #263

Better resizing of char_vector in edge cases

Better resizing of char_vector in edge cases #263

Workflow file for this run

name: Test
on:
push:
branches:
- '*'
- '*/**'
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- 'LICENSE'
- 'doc/**'
- 'tools/**'
jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
hosts: ${{ steps.matrix.outputs.hosts }}
containers: ${{ steps.matrix.outputs.containers }}
steps:
- name: Define Matrix
id: matrix
shell: python
run: |
import json
import os
macos_map = {
'macos-14': "15.4",
'macos-15': "16.2"
}
win_paltforms = ["x64", "Win32"]
win_clang_archs = ["x64", "x86"]
gcc_map = {
12: 'ubuntu-latest',
13: 'ubuntu-latest',
14: 'ubuntu-24.04'
}
gcc_cont_map = {
15: 'gcc:15.1'
}
clang_map = {
16: 'ubuntu-22.04',
17: 'ubuntu-latest',
18: 'ubuntu-latest',
19: 'ubuntu-latest',
20: 'ubuntu-latest',
21: 'ubuntu-latest'
}
hosts = []
containers=[]
#macOS
for runon, xcode in macos_map.items():
hosts.append({'os': runon, 'version': xcode, 'jobname': f'macOS - Xcode{xcode}'})
#windows
for platform in win_paltforms:
hosts.append({'os': 'windows-latest', 'platform': platform, 'nopython': platform == "Win32", 'jobname': f'Windows - {platform}'})
for arch in win_clang_archs:
hosts.append({'os': 'windows-latest', 'arch': arch, 'compiler': 'clang-cl', 'nopython': arch == "x86", 'jobname': f'Windows - clang - {arch}'})
#gcc hosts
for gcc, runon in gcc_map.items():
hosts.append({'os': runon, 'compiler': 'gcc', 'version': gcc, 'jobname': f'Linux - GCC{gcc}'})
#gcc containers
for gcc, container in gcc_cont_map.items():
containers.append({'container': container, 'jobname': f'Linux - GCC{gcc}'})
#clang
for clang, runon in clang_map.items():
hosts.append({'os': runon, 'compiler': 'clang', 'version': clang, 'jobname': f'Linux - Clang{clang}'})
with open(os.environ['GITHUB_OUTPUT'], 'w') as env:
print('hosts=' + json.dumps(hosts), file=env)
print('containers=' + json.dumps(containers), file=env)
desktop:
needs: define-matrix
name: ${{ matrix.jobname }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.define-matrix.outputs.hosts) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: System Setup
shell: bash
run: |
if [[ '${{ matrix.os }}' == ubuntu-* ]]; then
if [[ '${{ matrix.compiler }}' == 'clang' ]]; then
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh ${{ matrix.version }}
sudo apt-get install -y clang-tools-${{ matrix.version }} libc++-${{ matrix.version }}-dev libc++abi-${{ matrix.version }}-dev
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
fi
if [[ '${{ matrix.compiler }}' == 'gcc' ]]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-${{ matrix.version }} g++-${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
fi
mkdir bin
wget -qO- https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip | \
gunzip > bin/ninja
chmod a+x bin/ninja
echo PATH=`pwd`/bin:$PATH >> $GITHUB_ENV
echo "CMAKE_GENERATOR=-GNinja" >> $GITHUB_ENV
# wget https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz
# tar -xzf icu4c-76_1-src.tgz
# cd icu/source
# ./configure --prefix $GITHUB_WORKSPACE/icu_root \
# --enable-static=no \
# --enable-shared=yes \
# --enable-extras=no \
# --enable-icuio=no \
# --enable-tests=no \
# --enable-samples=no \
# --enable-tools=yes \
# --with-data-packaging=library
# make -j `nproc`
# make install
# echo "ICU_ROOT=$GITHUB_WORKSPACE/icu_root" >> $GITHUB_ENV
# echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/icu_root/lib" >> $GITHUB_ENV
fi
if [[ '${{ matrix.os }}' == macos-* ]]; then
brew install icu4c
echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.version }}.app" >> $GITHUB_ENV
echo "ICU_ROOT=$(brew --cellar icu4c)/$(brew info --json icu4c | jq -r '.[0].installed[0].version')" >> $GITHUB_ENV
fi
if [[ '${{ matrix.os }}' == windows-* ]]; then
if [[ '${{ matrix.compiler }}' != '' ]]; then
if [[ '${{ matrix.arch }}' == "x64" ]]; then
VCPREFIX="C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\x64\\bin"
else
VCPREFIX="C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\bin"
fi
echo "CC=$VCPREFIX\\${{ matrix.compiler }}" >> $GITHUB_ENV
echo "CXX=$VCPREFIX\\${{ matrix.compiler }}" >> $GITHUB_ENV
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
fi
fi
CMAKE_ARGS=( )
if [[ '${{ matrix.platform }}' != "" ]]; then
CMAKE_ARGS+=(-DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform }})
fi
if [[ ${#CMAKE_ARGS[@]} != 0 ]]; then
echo "CMAKE_ARGS=${CMAKE_ARGS[@]}" >> $GITHUB_ENV
fi
- name: Configure
shell: bash
run: |
cmake $CMAKE_GENERATOR -S . -B out $CMAKE_ARGS -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: cmake --build out --config MinSizeRel --target run-test
container:
needs: define-matrix
name: ${{ matrix.jobname }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.define-matrix.outputs.containers) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pre-requisites
run: |
apt-get update
apt-get install -y ninja-build cmake
apt-get install -y python3-dev
- name: Configure
shell: bash
run: |
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: cmake --build out --config MinSizeRel --target run-test
big-endian:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
run: |
sudo apt-get update
sudo apt-get install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu qemu-user-binfmt
- name: Configure
run: |
export CC=powerpc-linux-gnu-gcc
export CXX=powerpc-linux-gnu-g++
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu/
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_SYSTEM_PROCESSOR=powerpc
- name: Build and Test
shell: bash
run: |
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu/
cmake --build out --config MinSizeRel --target run-test
android:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [27.2.12479018]
api: [29, 30]
arch: [x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.version }}-${{ matrix.arch }}-${{ matrix.api }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.arch }}
target: google_apis
ndk: ${{ matrix.version }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Configure, Build and Test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.arch }}
target: google_apis
ndk: ${{ matrix.version }}
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: true
script: |
echo "::group::Configure"
cmake -S . -B out -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$ANDROID_SDK_ROOT/ndk/${{ matrix.version }}/build/cmake/android.toolchain.cmake -DANDROID_ABI:STRING=${{ matrix.arch }} -DANDROID_PLATFORM:STRING=${{ matrix.version }} -DANDROID_STL:STRING=c++_static
echo "::endgroup::"
echo "::group::Build and Test"
cmake --build out --config MinSizeRel --target run-test
echo "::endgroup::"
emscripten:
runs-on: ubuntu-latest
container: emscripten/emsdk:3.1.70
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pre-requisites
run: |
apt-get update
apt-get install -y ninja-build
apt-get install -y python3-dev
export CMAKE_VERSION=3.27.1
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh \
-q -O /tmp/cmake-install.sh \
&& chmod u+x /tmp/cmake-install.sh \
&& /tmp/cmake-install.sh --skip-license --prefix=/usr \
rm -f /tmp/cmake-install.sh
- name: Configure
shell: bash
run: cmake -S . -B out -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: cmake --build out --config MinSizeRel --target run-test
pythons:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t",
"pypy-3.9", "pypy-3.10", "pypy-3.11"
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{matrix.python-version}}
- name: Configure
shell: bash
run: |
cmake -S . -B out -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build and Test
shell: bash
run: |
cmake --build out --config MinSizeRel --target test-20python test-23python
echo Running test-20python
out/test/test-20python -ni -fc
echo Running test-23python
out/test/test-23python -ni -fc