diff --git a/.github/workflows/testfabien.yml b/.github/workflows/testfabien.yml new file mode 100644 index 0000000..c9471bf --- /dev/null +++ b/.github/workflows/testfabien.yml @@ -0,0 +1,74 @@ +name: build + +on: + push: + branches: + - master + tags: + - v* + pull_request: + branches: + - master + +jobs: + prepare: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: checkout repository + - name: make docker buildimage + uses: elgohr/Publish-Docker-Github-Action@master + with: + username: "${{ secrets.DOCKER_USERNAME }}" + password: "${{ secrets.DOCKER_PASSWORD }}" + name: metwork/logproxy-centos6-buildimage + context: docker + cache: true + tags: "latest" + build: + runs-on: ubuntu-latest + needs: prepare + steps: + - name: checkout repository + uses: actions/checkout@v2 + - name: debug env + run: env |grep GITHUB + - name: build + uses: docker://metwork/logproxy-centos6-buildimage + - name: compute tag name + id: vars + run: | + TMPREF=${GITHUB_REF#refs/*/} + if [[ "$TMPREF" == */merge ]]; then echo ::set-output name=tag::`echo pr${TMPREF} |awk -F '/' '{print $1;}'`; else echo ::set-output name=tag::${TMPREF}; fi + - name: make tar.gz + run: | + mv release log_proxy-linux64-${{ steps.vars.outputs.tag }} + tar -cvf log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar log_proxy-linux64-${{ steps.vars.outputs.tag }} + gzip log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar + - name: upload artifact + uses: actions/upload-artifact@v1 + with: + name: log_proxy-linux64-${{ steps.vars.outputs.tag }} + path: ./log_proxy-linux64-${{ steps.vars.outputs.tag }} + - name: create release + id: create_release + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ steps.vars.outputs.tag }} + draft: false + prerelease: false + - name: upload release asset + id: upload-release-asset + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar.gz + asset_name: log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar.gz + asset_content_type: application/gzip diff --git a/Makefile b/Makefile index 5c66e24..0b23112 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ all: clean: cd src && $(MAKE) clean + rm -Rf release install: cd src && $(MAKE) install @@ -15,3 +16,10 @@ leak: coverage: cd src && $(MAKE) coverage + +release: clean + mkdir -p release/lib + cd src && $(MAKE) PREFIX=$(shell pwd)/release FORCE_RPATH='@ORIGIN/../lib' install + rm -f release/bin/test_log_proxy + ldd release/bin/log_proxy + cp -f `ldd release/bin/log_proxy |grep libglib |awk -F '=> ' '{print $$2;}' |awk '{print $$1;}'` `ldd release/bin/log_proxy |grep libpcre |awk -F '=> ' '{print $$2;}' |awk '{print $$1;}'` release/lib/ diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..8b53ccc --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM centos:centos6 +MAINTAINER Fabien MARTY + +RUN yum -y install gcc make valgrind glib2-devel + +ADD entrypoint.sh /entrypoint.sh +CMD /entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..ed0fd7d --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +make +make leak +make release diff --git a/src/Makefile b/src/Makefile index 0be6f07..371bd6f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -DEBUG=yes +DEBUG=no ifeq ($(DEBUG),yes) DEBUG_CFLAGS=-g else @@ -8,7 +8,7 @@ FORCE_RPATH= ifeq ($(FORCE_RPATH),) FORCE_RPATH_STR= else - FORCE_RPATH_STR=-Wl,-rpath=$(FORCE_RPATH) + FORCE_RPATH_STR=-Wl,-rpath=~$(FORCE_RPATH)~ endif PREFIX=/usr/local CFLAGS+=-D_XOPEN_SOURCE=700 @@ -19,7 +19,7 @@ else COVERAGE_CFLAGS= endif -_LDFLAGS=$(LDFLAGS) -L. $(shell pkg-config --libs glib-2.0) $(FORCE_RPATH_STR) +_LDFLAGS=$(LDFLAGS) -L. $(shell pkg-config --libs glib-2.0) $(shell echo '$(FORCE_RPATH_STR)' |sed 's/@/$$/g' |sed s/~/"'"/g) _CFLAGS=$(CFLAGS) -I. $(shell pkg-config --cflags glib-2.0) -fPIC -Wall -std=c99 -Wextra -pedantic -Werror -Wshadow -Wstrict-overflow -Wno-cast-function-type -fno-strict-aliasing -DG_LOG_DOMAIN=\"log_proxy\" $(DEBUG_CFLAGS) $(COVERAGE_CFLAGS) CC=gcc