Skip to content

Commit

Permalink
Tca 145 (#29)
Browse files Browse the repository at this point in the history
* github workflow
* tcamake updates
  • Loading branch information
tcarland authored Aug 6, 2023
1 parent 0f838b2 commit 3c0cf96
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 27 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/c-cpp-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: C/C++ Build CI

on:
push:
tags: [ "v*" ]
pull_request:
branches: [ master ]

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

jobs:
build:

runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3

- uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build Container
run: docker build -t ${{ env.IMAGE_NAME }} -f build/Containerfile .

- name: Run Docker Build
run: docker run --rm -v $PWD:/app -e TCAMAKE_HOME=/tcamake ${{ env.IMAGE_NAME }} /bin/bash -c "cd /app && source resources/tcanetpp_release_mt && make arlib"
40 changes: 19 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Makefile for tcanetpp
# Requires 'tcamake' build environment to exist in TOPDIR
#
TOPDIR = ..

NEED_SOCKET = 1
NEED_LIBDL = 1

Expand All @@ -16,28 +14,28 @@ endif
#-------------------#

ifdef TCAMAKE_DEBUG
OPT_FLAGS = -g -DEV_DEBUG
OPT_FLAGS = -g -DEV_DEBUG
endif

OPT_FLAGS += -fPIC -O2
CCSHARED += -Wl,-soname,$@
CXXFLAGS = -std=c++11
OPT_FLAGS += -fPIC -O2
CCSHARED += -Wl,-soname,$@
CXXFLAGS = -std=c++11

INCLUDES = -Iinclude
INCLUDES = -Iinclude
LIBS =

PT_OBJS = src/patricia.o
TH_OBJS = src/Thread.o src/ThreadLock.o src/ThreadMutexPool.o
CMDBUF_OBJS = src/CmdBuffer.o
PT_OBJS = src/patricia.o
TH_OBJS = src/Thread.o src/ThreadLock.o src/ThreadMutexPool.o
CMDBUF_OBJS = src/CmdBuffer.o

OBJS = src/SocketOption.o src/Socket.o src/BufferedSocket.o \
src/CircularBuffer.o src/Serializer.o \
src/Whois.o src/EventManager.o \
src/IpAddr.o src/AddrInfo.o \
src/StringUtils.o src/FileStat.o src/FileUtils.o \
src/LogFacility.o src/tcanetpp_random.o src/INotify.o \
src/patricia.o src/DeviceMap.o \
src/NetworkDevice.o src/NetworkInterface.o
OBJS = src/SocketOption.o src/Socket.o src/BufferedSocket.o \
src/CircularBuffer.o src/Serializer.o \
src/Whois.o src/EventManager.o \
src/IpAddr.o src/AddrInfo.o \
src/StringUtils.o src/FileStat.o src/FileUtils.o \
src/LogFacility.o src/tcanetpp_random.o src/INotify.o \
src/patricia.o src/DeviceMap.o \
src/NetworkDevice.o src/NetworkInterface.o

ifdef USE_PTHREADS
OBJS += $(TH_OBJS)
Expand All @@ -49,22 +47,22 @@ ALL_BINS = $(BIN)

# ---------------------------------------------

include ${TOPDIR}/tcamake/tcamake_include
include ${TCAMAKE_HOME}/tcamake_include

# ---------------------------------------------

all: lib cmdbuf
lib: arlib

arlib: lib/libtcanetpp.a
solib: libtcanetpp.so.1.4.4
solib: libtcanetpp.so.1.4.5
libtcapt: lib/libtcapt.a

cmdbuffer: cmdbuf
cmdbuf: libcmdbuf
libcmdbuf: lib/libcmdbuf.a

libtcanetpp.so.1.4.4: ${OBJS}
libtcanetpp.so.1.4.5: ${OBJS}
( $(MKDIR) lib )
( $(RM) $@ lib/libtcanetpp.so )
$(make-so-rule)
Expand Down
20 changes: 20 additions & 0 deletions build/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:22.04
LABEL Description="CPP Build Environment"

ENV HOME /root

shell ["/bin/bash", "-c"]

RUN apt-get update && apt-get -y --no-install-recommends install \
build-essential \
ca-certificates \
curl \
net-tools \
tini

RUN curl https://github.com/tcarland/tcamake/archive/refs/tags/v23.08.tar.gz -L -o /tmp/tcamake.tar.gz && \
tar -xzf /tmp/tcamake.tar.gz -C / && \
mv /tcamake-* /tcamake && \
rm /tmp/tcamake.tar.gz

ENTRYPOINT ["/usr/bin/tini", "--"]
4 changes: 2 additions & 2 deletions include/tcanetpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "net/Socket.h"
#include "event/EventManager.h"

#define TCANETPP_VERSION_TS "23.06"
#define TCANETPP_VERSION "1.4.4"
#define TCANETPP_VERSION_TS "23.08"
#define TCANETPP_VERSION "1.4.5"

#endif _TCANETPP_H_
1 change: 1 addition & 0 deletions resources/tcanetpp_debug_mt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# profile debug_mt
export PROFILE="tcanetpp_debug_mt"

export TCAMAKE_HOME=${TCAMAKE_HOME:-$(realpath ../tcamake)}
export TCAMAKE_PREFIX=
export TCAMAKE_DEBUG=1

Expand Down
1 change: 1 addition & 0 deletions resources/tcanetpp_release_mt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Profile release_mt
export PROFILE="tcanetpp_release_mt"

export TCAMAKE_HOME=${TCAMAKE_HOME:-$(realpath ../tcamake)}
export TCAMAKE_PREFIX="/usr/local"
export TCAMAKE_DEBUG=

Expand Down
6 changes: 2 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
TOPDIR = ../..

NEED_LIBDL = 1
NEED_SOCKET = 1
NEED_TCANETPP = 1
Expand All @@ -22,7 +20,7 @@ CXXFLAGS= -std=c++0x
OPT_FLAGS+= -DTWHOIS_MAIN


ASOBJ= ../src/IpAddr.o ../src/AddrInfo.o \
ASOBJ= ../src/IpAddr.o ../src/AddrInfo.o \
../src/tcanetpp_random.o ../src/Socket.o \
../src/SocketOption.o ../src/Whois.o

Expand All @@ -41,7 +39,7 @@ ALL_OBJS=$(OBJS) $(ASOBJ) $(STROBJ) $(CBUFF_OBJS) $(CIDR_OBJS)
ALL_BINS=$(BIN)


include ${TOPDIR}/tcamake/tcamake_include
include ${TCAMAKE_HOME}/tcamake_include


all: asnclean asnwho ipconvert client server cidrtest strtest bufftest \
Expand Down

0 comments on commit 3c0cf96

Please sign in to comment.