Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
151 changes: 151 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Build HpCore

on:
push:
branches: [ main, master, develop, build-github ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev libsodium-dev \
sqlite3 libsqlite3-dev libboost-stacktrace-dev fuse3 jq

- name: Cache CMake
id: cache-cmake
uses: actions/cache@v4
with:
path: |
/usr/local/bin/cmake
/usr/local/bin/ctest
/usr/local/bin/cpack
/usr/local/share/cmake-3.16
key: cmake-3.16.0-rc3

- name: Install CMake
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: |
cd /tmp
CMAKE_VERSION=cmake-3.16.0-rc3-Linux-x86_64
wget https://github.com/Kitware/CMake/releases/download/v3.16.0-rc3/$CMAKE_VERSION.tar.gz
tar -zxf $CMAKE_VERSION.tar.gz
sudo cp -r $CMAKE_VERSION/bin/* /usr/local/bin/
sudo cp -r $CMAKE_VERSION/share/* /usr/local/share/

- name: Cache libraries
id: cache-libs
uses: actions/cache@v4
with:
path: |
/usr/local/lib/libblake3.so
/usr/local/include/blake3.h
/usr/local/include/jsoncons
/usr/local/include/jsoncons_ext
/usr/local/include/flatbuffers
/usr/local/bin/flatc
/usr/local/include/readerwriterqueue
/usr/local/include/concurrentqueue.h
/usr/local/include/plog
key: hpcore-libs-v1

- name: Install Blake3
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
git clone https://github.com/BLAKE3-team/BLAKE3.git
cd BLAKE3/c
gcc -shared -fPIC -O3 -o libblake3.so blake3.c blake3_dispatch.c blake3_portable.c \
blake3_sse2_x86-64_unix.S blake3_sse41_x86-64_unix.S blake3_avx2_x86-64_unix.S \
blake3_avx512_x86-64_unix.S
sudo cp blake3.h /usr/local/include/
sudo cp libblake3.so /usr/local/lib/

- name: Install jsoncons
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/danielaparker/jsoncons/archive/v0.153.3.tar.gz
tar -zxf v0.153.3.tar.gz
cd jsoncons-0.153.3
sudo cp -r include/jsoncons /usr/local/include/
sudo mkdir -p /usr/local/include/jsoncons_ext/
sudo cp -r include/jsoncons_ext/bson /usr/local/include/jsoncons_ext/

- name: Install Flatbuffers
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
tar -zxf v1.12.0.tar.gz
cd flatbuffers-1.12.0
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF
make
sudo cp -r include/flatbuffers /usr/local/include/
sudo cp flatc /usr/local/bin/flatc
sudo chmod +x /usr/local/bin/flatc

- name: Install Reader-Writer queue
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/cameron314/readerwriterqueue/archive/v1.0.3.tar.gz
tar -zxf v1.0.3.tar.gz
cd readerwriterqueue-1.0.3
mkdir build
cd build
cmake ..
sudo make install

- name: Install Concurrent queue
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/cameron314/concurrentqueue/archive/1.0.2.tar.gz
tar -zxf 1.0.2.tar.gz
cd concurrentqueue-1.0.2
sudo cp concurrentqueue.h /usr/local/include/

- name: Install Plog
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz
tar -zxf 1.1.5.tar.gz
cd plog-1.1.5
sudo cp -r include/plog /usr/local/include/

- name: Update library cache
run: sudo ldconfig

- name: Build hpcore
run: |
mkdir -p build
cmake .
make -j$(nproc)

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: hpcore-build
path: |
build/hpcore
build/hpws
build/hpfs
build/evernode-license.pdf
retention-days: 30

- name: Build info
run: |
echo "Build completed successfully!"
ls -lh build/
file build/hpcore
154 changes: 154 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Build Docker Image

on:
push:
branches: [ main, master ]
tags:
- 'v*.*.*'
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev libsodium-dev \
sqlite3 libsqlite3-dev libboost-stacktrace-dev fuse3

- name: Cache libraries
id: cache-libs
uses: actions/cache@v4
with:
path: |
/usr/local/lib/libblake3.so
/usr/local/include/blake3.h
/usr/local/include/jsoncons
/usr/local/include/jsoncons_ext
/usr/local/include/flatbuffers
/usr/local/bin/flatc
/usr/local/include/readerwriterqueue
/usr/local/include/concurrentqueue.h
/usr/local/include/plog
key: hpcore-libs-v1

- name: Install Blake3
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
git clone https://github.com/BLAKE3-team/BLAKE3.git
cd BLAKE3/c
gcc -shared -fPIC -O3 -o libblake3.so blake3.c blake3_dispatch.c blake3_portable.c \
blake3_sse2_x86-64_unix.S blake3_sse41_x86-64_unix.S blake3_avx2_x86-64_unix.S \
blake3_avx512_x86-64_unix.S
sudo cp blake3.h /usr/local/include/
sudo cp libblake3.so /usr/local/lib/

- name: Install jsoncons
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/danielaparker/jsoncons/archive/v0.153.3.tar.gz
tar -zxf v0.153.3.tar.gz
cd jsoncons-0.153.3
sudo cp -r include/jsoncons /usr/local/include/
sudo mkdir -p /usr/local/include/jsoncons_ext/
sudo cp -r include/jsoncons_ext/bson /usr/local/include/jsoncons_ext/

- name: Install Flatbuffers
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
tar -zxf v1.12.0.tar.gz
cd flatbuffers-1.12.0
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF
make
sudo cp -r include/flatbuffers /usr/local/include/
sudo cp flatc /usr/local/bin/flatc
sudo chmod +x /usr/local/bin/flatc

- name: Install Reader-Writer queue
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/cameron314/readerwriterqueue/archive/v1.0.3.tar.gz
tar -zxf v1.0.3.tar.gz
cd readerwriterqueue-1.0.3
mkdir build
cd build
cmake ..
sudo make install

- name: Install Concurrent queue
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/cameron314/concurrentqueue/archive/1.0.2.tar.gz
tar -zxf 1.0.2.tar.gz
cd concurrentqueue-1.0.2
sudo cp concurrentqueue.h /usr/local/include/

- name: Install Plog
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
cd /tmp
wget https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz
tar -zxf 1.1.5.tar.gz
cd plog-1.1.5
sudo cp -r include/plog /usr/local/include/

- name: Update library cache
run: sudo ldconfig

- name: Build hpcore
run: |
mkdir -p build
cmake .
make -j$(nproc)
make docker

- name: Push Docker image
run: |
docker tag hpcore:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

# Push version tag if available
if [ "${{ github.ref_type }}" == "tag" ]; then
docker tag hpcore:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
fi
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ target_link_libraries(hpcore
add_custom_command(TARGET hpcore POST_BUILD

# COMMAND strip ./build/hpcore
COMMAND cp ./test/bin/hpws ./test/bin/hpfs ./evernode-license.pdf ./build/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ./test/bin/hpws ./build/hpws
COMMAND ${CMAKE_COMMAND} -E copy_if_different ./test/bin/hpfs ./build/hpfs
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ./evernode-license.pdf ./build/evernode-license.pdf
)

target_precompile_headers(hpcore PUBLIC src/pchheader.hpp)
Expand Down
Loading