Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
abf4438
Start writing new config
HyperWinX Oct 11, 2025
e95f0e4
spdlog fixes
HyperWinX Oct 11, 2025
8bcc7b9
Working CMake
HyperWinX Oct 22, 2025
fe26b66
Update includes
HyperWinX Oct 22, 2025
7d33aec
Update workflow
HyperWinX Nov 5, 2025
9ed1a4e
Fix dockerfile
HyperWinX Nov 5, 2025
91349af
Fix workflow
HyperWinX Nov 5, 2025
e6d5b05
Update dockerfile
HyperWinX Nov 5, 2025
998cfe8
Update dockerfile
HyperWinX Nov 5, 2025
af6d513
Fix workflow
HyperWinX Nov 5, 2025
e1f6d86
Fix workflow
HyperWinX Nov 5, 2025
4e70e06
Fix workflow
HyperWinX Nov 5, 2025
8af5b6e
Lets test this shit
HyperWinX Nov 5, 2025
fdfffd6
HOW
HyperWinX Nov 5, 2025
b8aa9b3
DAMN
HyperWinX Nov 5, 2025
791b310
Prepare for packaging, fix CMake
HyperWinX Nov 5, 2025
871c96c
DO IT
HyperWinX Nov 5, 2025
e8aee36
Update workflow
HyperWinX Nov 6, 2025
b62c593
Update CMake
HyperWinX Nov 6, 2025
fb91501
Fix workflow
HyperWinX Nov 6, 2025
8101b31
Fix workflow
HyperWinX Nov 6, 2025
389072b
Disable repackaging
HyperWinX Nov 6, 2025
d686fc9
Update workflow
HyperWinX Nov 6, 2025
08b6bd2
Include unzip
HyperWinX Nov 6, 2025
94ffff6
Fix workflow
HyperWinX Nov 6, 2025
e55807b
Fix workflow
HyperWinX Nov 6, 2025
2d5e111
Fix workflow
HyperWinX Nov 6, 2025
78930aa
Fix workflow
HyperWinX Nov 6, 2025
02d7796
Fix workflow
HyperWinX Nov 6, 2025
9166f7c
Fix workflow
HyperWinX Nov 6, 2025
6e66ac1
Update workflow
HyperWinX Nov 11, 2025
5610af0
Fix workflow
HyperWinX Nov 11, 2025
35421cf
Add pip
HyperWinX Nov 11, 2025
75e72e1
Add pip
HyperWinX Nov 11, 2025
a8a66f7
Add libasan
HyperWinX Nov 11, 2025
1017791
Add libubsan
HyperWinX Nov 11, 2025
5687957
Update workflow
HyperWinX Nov 11, 2025
84bafae
Fix workflow
HyperWinX Nov 11, 2025
22ea4f4
Fix workflow
HyperWinX Nov 11, 2025
cad4b81
Fix workflow
HyperWinX Nov 11, 2025
3d2c849
Fix workflow
HyperWinX Nov 11, 2025
6dbc131
Fix workflow
HyperWinX Nov 11, 2025
02ede64
Fix workflow
HyperWinX Nov 11, 2025
6cc50ee
Fix workflow
HyperWinX Nov 11, 2025
8b1a38c
Fix workflow
HyperWinX Nov 11, 2025
8499397
Revert "Fix workflow"
HyperWinX Nov 12, 2025
38e27a9
Update dependencies
HyperWinX Nov 12, 2025
3272cd3
Fix workflow
HyperWinX Nov 12, 2025
f2ed4d1
Disable fedora
HyperWinX Nov 12, 2025
6e230ac
Fix workflow
HyperWinX Nov 12, 2025
822abb9
Fix workflow
HyperWinX Nov 12, 2025
8257387
Fix workflow
HyperWinX Nov 12, 2025
c94e196
Apply formatting
HyperWinX Nov 12, 2025
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
21 changes: 0 additions & 21 deletions .github/Dockerfile

This file was deleted.

17 changes: 17 additions & 0 deletions .github/docker/clang/Dockerfile-debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM debian:latest

ARG USER=ci

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git \
build-essential unzip clang-format \
clang lld ninja-build sudo \
python3 python3-pip cmake \
&& rm -rf /var/lib/apt/lists/*

RUN pip install conan --break-system-packages

RUN useradd -m ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/${USER}/workspace
18 changes: 18 additions & 0 deletions .github/docker/clang/Dockerfile-fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM fedora:latest

ARG USER=ci

RUN dnf update -y && dnf -y install \
ca-certificates curl git \
make g++ unzip libasan libubsan \
clang lld ninja-build sudo \
python3 python3-pip cmake \
&& rm -rf /var/cache/dnf/*


RUN pip install conan --break-system-packages

RUN useradd -m ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/${USER}/workspace
17 changes: 17 additions & 0 deletions .github/docker/clang/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:latest

ARG USER=ci

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git \
build-essential unzip clang-format \
clang lld ninja-build sudo \
python3 python3-pip cmake \
&& rm -rf /var/lib/apt/lists/*

RUN pip install conan --break-system-packages

RUN useradd -m ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/${USER}/workspace
17 changes: 17 additions & 0 deletions .github/docker/gcc/Dockerfile-debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM debian:latest

ARG USER=ci

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git \
build-essential unzip clang-format \
gcc lld ninja-build sudo \
python3 python3-pip cmake \
&& rm -rf /var/lib/apt/lists/*

RUN pip install conan --break-system-packages

RUN useradd -m ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/${USER}/workspace
18 changes: 18 additions & 0 deletions .github/docker/gcc/Dockerfile-fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM fedora:latest

ARG USER=ci

RUN dnf update -y && dnf -y install \
ca-certificates curl git \
make g++ unzip libasan libubsan \
gcc lld ninja-build sudo clang-format \
python3 python3-pip cmake \
&& rm -rf /var/cache/dnf/*


RUN pip install conan --break-system-packages

RUN useradd -m ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/${USER}/workspace
17 changes: 17 additions & 0 deletions .github/docker/gcc/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:latest

ARG USER=ci

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl git \
build-essential unzip clang-format \
gcc lld ninja-build sudo \
python3 python3-pip cmake \
&& rm -rf /var/lib/apt/lists/*

RUN pip install conan --break-system-packages

RUN useradd -m ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/${USER}/workspace
45 changes: 22 additions & 23 deletions .github/workflows/mainline-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:

jobs:
testing:
name: Compile (${{ matrix.compiler }})
name: Compile (${{ matrix.compiler }} on ${{ matrix.distribution }})
runs-on: ubuntu-latest
container:
image: ghcr.io/hypercpu-project/hypercpu-builder:latest
image: ghcr.io/hypercpu-project/hypercpu-builder-${{ matrix.compiler }}-${{ matrix.distribution }}:latest
options: --init
permissions:
contents: read
Expand All @@ -18,6 +18,8 @@ jobs:
fail-fast: false
matrix:
compiler: [gcc, clang]
distribution: [debian, ubuntu]
build-type: [Release, Debug]

steps:
- name: Checkout code
Expand All @@ -26,27 +28,24 @@ jobs:
submodules: true
fetch-depth: 0

- name: Cache Bazel
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
key: bazel-${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('**/*.bazel', '**/*.bzl') }}
restore-keys: |
bazel-${{ runner.os }}-${{ matrix.compiler }}-
bazel-${{ runner.os }}-

- name: Install dependencies with Conan
run: sudo -u ci conan profile detect

- name: Fix permissions
run: chown -R ci:ci "$GITHUB_WORKSPACE"

- name: Bazel build (linux-opt mode, with ${{ matrix.compiler }} compiler)
run: sudo -u ci bazelisk build //... --config=linux-opt --compiler=${{ matrix.compiler }}

- name: Upload package tarball
uses: actions/upload-artifact@v4
with:
name: hcpu-tarballs-${{ matrix.compiler }}
path: |
bazel-bin/tools/packaging/*.tar.gz
!bazel-bin/tools/packaging/hcpu.tar.gz
if-no-files-found: error
- name: Build project (Release, with ${{ matrix.compiler }} compiler)
run: |
sudo -u ci conan install . --build=missing -s build_type=${{ matrix.build-type }}
if [ "${{ matrix.build-type }}" = "Release" ]; then
sudo -u ci cmake --preset conan-release -DINSTALL_TESTS=1
else
sudo -u ci cmake --preset conan-debug -DINSTALL_TESTS=1
fi
sudo -u ci cmake --build build/${{ matrix.build-type }} -j$(nproc)
sudo -u ci cmake --build build/${{ matrix.build-type }} --target package

- name: Run all tests
run: |
sudo -u ci build/${{ matrix.build-type }}/tests/Integration/integration-tests
sudo -u ci build/${{ matrix.build-type }}/tests/Modular/modular-tests
10 changes: 8 additions & 2 deletions .github/workflows/mainline-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
format:
runs-on: ubuntu-latest
container:
image: ghcr.io/hypercpu-project/hypercpu-builder:latest
image: ghcr.io/hypercpu-project/hypercpu-builder-gcc-debian:latest
options: --init
permissions:
contents: read
Expand All @@ -16,12 +16,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: true

- name: Fix permissions
run: chown -R ci:ci "$GITHUB_WORKSPACE"

- name: Run formatters
run: sudo -u ci bazelisk run :format
run: |
sudo -u ci conan profile detect
sudo -u ci conan install . --build=missing
sudo -u ci cmake --preset conan-release
sudo -u ci cmake --build build/Release --target format

- name: Check diff
run: sudo -u ci git diff --quiet
12 changes: 9 additions & 3 deletions .github/workflows/mainline-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
contents: read
packages: write

strategy:
fail-fast: false
matrix:
compiler: [ gcc, clang ]
distribution: [ ubuntu, debian ]

steps:
- name: Checkout
uses: actions/checkout@v5
Expand All @@ -24,12 +30,12 @@
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
- name: Build and push clang image
uses: docker/build-push-action@v6

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Build & Push GHCR HyperCPU Builder Image (prepare environment)' step
Uses Step
uses 'docker/build-push-action' with ref 'v6', not a pinned commit hash
with:
context: .
file: .github/Dockerfile
file: .github/docker/${{ matrix.compiler }}/Dockerfile-${{ matrix.distribution }}
push: true
tags: ghcr.io/hypercpu-project/hypercpu-builder:latest
tags: ghcr.io/hypercpu-project/hypercpu-builder-${{ matrix.compiler }}-${{ matrix.distribution }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
11 changes: 11 additions & 0 deletions .github/workflows/mainline-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,21 @@
path: artifacts/

- name: Extract and run tarballs
shell: bash
run: |
if [[ "${{ matrix.image }}" == "debian:stable" ]]; then

Check warning

Code scanning / CodeQL

Code injection Medium

Potential code injection in
${ matrix.image }
, which may be controlled by an external user.
apt update && apt install unzip file -y
elif [[ "${{ matrix.image }}" == "fedora:latest" ]]; then

Check warning

Code scanning / CodeQL

Code injection Medium

Potential code injection in
${ matrix.image }
, which may be controlled by an external user.
dnf update -y && dnf install unzip -y
else
pacman -Sy --noconfirm && pacman -S unzip --noconfirm
fi
ls -la artifacts
file artifacts/*.tar.gz
for archive in artifacts/*.tar.gz; do
tar -xpf "$archive" -C / --overwrite
for f in /opt/hcpu/tests/*; do
[ -f "$f" ] && [ -x "$f" ] && "$f"
done
rm -rf unpacked
done
8 changes: 2 additions & 6 deletions .github/workflows/mainline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
prepare:
uses: ./.github/workflows/mainline-prepare.yml

package:
compile:
needs: prepare
uses: ./.github/workflows/mainline-compile.yml

Expand All @@ -21,8 +21,4 @@ jobs:

lint:
needs: prepare
uses: ./.github/workflows/mainline-lint.yml

tests:
needs: package
uses: ./.github/workflows/mainline-test.yml
uses: ./.github/workflows/mainline-lint.yml
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.28)
project(HyperCPU VERSION 0.5.0 LANGUAGES CXX)

include(CheckIPOSupported)
include(CPack)

set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_FILE_NAME "hypercpu-${CMAKE_BUILD_TYPE}")

find_package(GTest REQUIRED)
find_package(argparse REQUIRED)
find_package(eternal REQUIRED)
find_package(spdlog REQUIRED)
find_package(fmt REQUIRED)
find_package(re2 REQUIRED)
add_subdirectory(foreign/HPool)
include_directories(foreign/HPool)

check_ipo_supported(RESULT SUPPORTED OUTPUT ERR)

string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)

# TODO: Enable UBSan and fix all errors
if ("${CMAKE_BUILD_TYPE}" STREQUAL "debug")
message(STATUS "Enabled debug flags")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "release")
message(STATUS "Enabled release flags")

if (SUPPORTED)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()
endif()

add_subdirectory(src)
add_subdirectory(tests)

# Find formatters
find_program(CLANG_FORMAT NAMES clang-format REQUIRED)

# Collect source files (customize as needed)
file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS
src/**.cpp src/**.hpp tests/**.cpp tests/**.hpp
)

# Create formatting target
add_custom_target(format
COMMAND ${CLANG_FORMAT} -i ${CPP_SOURCES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Formatting code with clang-format and cmake-format"
)
21 changes: 21 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout


class HyperCPU(ConanFile):
name = "HyperCPU"
version = "0.5.0"
settings = ["os", "compiler", "build_type", "arch"]
author = "HyperCPU Project"
requires = [
"gtest/1.14.0",
"spdlog/1.15.0",
"argparse/3.2",
"eternal/1.0.1",
"fmt/11.0.2",
"re2/20250722"
]
generators = ["CMakeToolchain", "CMakeDeps"]

def layout(self) -> None:
cmake_layout(self)
2 changes: 1 addition & 1 deletion foreign/HPool
Submodule HPool updated 1 files
+3 −3 CMakeLists.txt
Loading
Loading