JSON BinPack #2333
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
name: JSON BinPack | |
on: | |
schedule: | |
# Once per day, Monday to Friday | |
- cron: '0 19 * * 1-5' | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
# TODO: Add Unikraft job too | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: macos-latest | |
cc: clang | |
cxx: clang++ | |
type: static | |
- os: macos-latest | |
cc: clang | |
cxx: clang++ | |
type: shared | |
- os: ubuntu-latest | |
cc: clang | |
cxx: clang++ | |
type: static | |
- os: ubuntu-latest | |
cc: gcc | |
cxx: g++ | |
type: static | |
- os: ubuntu-latest | |
cc: clang | |
cxx: clang++ | |
type: shared | |
- os: ubuntu-latest | |
cc: gcc | |
cxx: g++ | |
type: shared | |
- os: windows-latest | |
type: static | |
- os: windows-latest | |
type: shared | |
# Sanitizers | |
- os: ubuntu-latest | |
cc: clang | |
cxx: clang++ | |
type: static | |
options: -DJSONBINPACK_ADDRESS_SANITIZER:BOOL=ON | |
- os: ubuntu-latest | |
cc: clang | |
cxx: clang++ | |
type: static | |
options: -DJSONBINPACK_UNDEFINED_SANITIZER:BOOL=ON | |
runs-on: ${{ matrix.platform.os }} | |
env: | |
CC: ${{ matrix.platform.cc }} | |
CXX: ${{ matrix.platform.cxx }} | |
steps: | |
- name: Install ClangFormat | |
run: pip install clang-format==18.1.0 | |
# See https://github.com/actions/runner-images/issues/8659 | |
- name: Workaround Clang issue (GNU/Linux) | |
if: runner.os == 'linux' && matrix.platform.cc == 'clang' | |
run: | | |
sudo apt-get purge -y g++-13 gcc-13 libstdc++-13-dev | |
sudo apt-get install -y --allow-downgrades libstdc++-12-dev libstdc++6=12.* libgcc-s1=12.* | |
- uses: actions/checkout@v3 | |
- name: Install dependencies (macOS) | |
if: runner.os == 'macos' | |
run: brew bundle | |
env: | |
HOMEBREW_NO_ANALYTICS: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
- run: cmake --version | |
- name: Configure JSON BinPack (static) | |
if: matrix.platform.type == 'static' | |
run: > | |
cmake -S . -B ./build | |
-DCMAKE_BUILD_TYPE:STRING=Release | |
-DJSONBINPACK_CLI:BOOL=ON | |
-DJSONBINPACK_RUNTIME:BOOL=ON | |
-DJSONBINPACK_COMPILER:BOOL=ON | |
-DJSONBINPACK_TESTS:BOOL=ON | |
-DJSONBINPACK_WEBSITE:BOOL=OFF | |
-DJSONBINPACK_DOCS:BOOL=OFF | |
-DBUILD_SHARED_LIBS:BOOL=OFF | |
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON | |
${{ matrix.platform.options }} | |
- name: Configure JSON BinPack (shared) | |
if: matrix.platform.type == 'shared' | |
run: > | |
cmake -S . -B ./build | |
-DCMAKE_BUILD_TYPE:STRING=Release | |
-DJSONBINPACK_CLI:BOOL=ON | |
-DJSONBINPACK_RUNTIME:BOOL=ON | |
-DJSONBINPACK_COMPILER:BOOL=ON | |
-DJSONBINPACK_TESTS:BOOL=ON | |
-DJSONBINPACK_WEBSITE:BOOL=OFF | |
-DJSONBINPACK_DOCS:BOOL=OFF | |
-DBUILD_SHARED_LIBS:BOOL=ON | |
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON | |
${{ matrix.platform.options }} | |
- run: cmake --build ./build --config Release --target clang_format_test | |
- run: cmake --build ./build --config Release --parallel 4 | |
- run: > | |
cmake --install ./build --prefix ./build/dist --config Release --verbose | |
--component sourcemeta_jsontoolkit | |
- run: > | |
cmake --install ./build --prefix ./build/dist --config Release --verbose | |
--component sourcemeta_jsontoolkit_dev | |
- run: > | |
cmake --install ./build --prefix ./build/dist --config Release --verbose | |
--component sourcemeta_jsonbinpack | |
- run: > | |
cmake --install ./build --prefix ./build/dist --config Release --verbose | |
--component sourcemeta_jsonbinpack_dev | |
# Not every CTest version supports the --test-dir option. If such option | |
# is not recognized, `ctest` will successfully exit finding no tests. | |
# Better to be sure and `cd` all the time here. | |
- run: cd ./build && ctest --build-config Release --output-on-failure --parallel | |
env: | |
# See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html | |
UBSAN_OPTIONS: print_stacktrace=1 | |
unikraft: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies (GNU/Linux) | |
run: | | |
sudo apt-get update --yes | |
sudo apt-get install --yes qemu-system-x86 | |
- uses: actions/checkout@v3 | |
- name: Install KraftKit | |
run: | | |
wget https://github.com/unikraft/kraftkit/releases/download/v0.7.5/kraftkit_0.7.5_linux_amd64.deb | |
sudo dpkg -i kraftkit_0.7.5_linux_amd64.deb | |
rm kraftkit_0.7.5_linux_amd64.deb | |
- run: cd unikraft && kraft build --target development --jobs 4 --log-type=basic | |
- run: cd unikraft && kraft run --target development --memory 200M --disable-acceleration unikraft |