Skip to content

Commit

Permalink
feat: use github action
Browse files Browse the repository at this point in the history
  • Loading branch information
thefab authored Mar 23, 2020
1 parent 19794a5 commit 381b76e
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 3 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/testfabien.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ all:

clean:
cd src && $(MAKE) clean
rm -Rf release

install:
cd src && $(MAKE) install
Expand All @@ -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/
7 changes: 7 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM centos:centos6
MAINTAINER Fabien MARTY <[email protected]>

RUN yum -y install gcc make valgrind glib2-devel

ADD entrypoint.sh /entrypoint.sh
CMD /entrypoint.sh
5 changes: 5 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

make
make leak
make release
6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEBUG=yes
DEBUG=no
ifeq ($(DEBUG),yes)
DEBUG_CFLAGS=-g
else
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 381b76e

Please sign in to comment.