* rename workflows file and add sdist job

* rename CLI executable to IMCtermite
* add workflow badge to README.md
* clean up makefile
* add timestamp of build to CLI binary showing version/help
This commit is contained in:
Mario Fink 2021-09-21 15:12:42 +02:00
parent b71d86f735
commit 12963bae91
5 changed files with 45 additions and 48 deletions

View File

@ -2,11 +2,10 @@
name: Build Python Wheels name: Build Python Wheels
on: on:
push: push:
branches: branches: [master]
- master
jobs: jobs:
build_wheels: build_wheels:
name: Build wheels on ${{ matrix.os }} name: Build binary wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -21,12 +20,21 @@ jobs:
- name: Build wheels - name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse run: python -m cibuildwheel --output-dir wheelhouse
upload_wheels: build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build sdist
run: python setup.py sdist
upload_pypi:
name: Upload binary wheels to PyPI name: Upload binary wheels to PyPI
needs: [build_wheels] runs-on: ubuntu-20.04
needs: [build_wheels, build_sdist]
steps: steps:
uses: pypa/gh-action-pypi-publish@release/v1 - uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: __token__ user: __token__
password: ${{ secrets.IMCTERMITE_GITHUB_WORKFLOW_PYPI_API_TOKEN }} password: ${{ secrets.IMCTERMITE_GITHUB_WORKFLOW_PYPI_API_TOKEN }}

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
eatraw eatraw
eatdev eatdev
imctermite imctermite
IMCtermite
nohup.out nohup.out

View File

@ -4,6 +4,7 @@
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/RecordEvolution/IMCtermite.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:python) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/RecordEvolution/IMCtermite.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:python)
[![LICENSE](https://img.shields.io/github/license/RecordEvolution/IMCtermite)](https://img.shields.io/github/license/RecordEvolution/IMCtermite) [![LICENSE](https://img.shields.io/github/license/RecordEvolution/IMCtermite)](https://img.shields.io/github/license/RecordEvolution/IMCtermite)
[![STARS](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)](https://img.shields.io/github/stars/RecordEvolution/IMCtermite) [![STARS](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
![Build Python Wheels](https://github.com/RecordEvolution/IMCtermite/actions/workflows/pypi-deploy.yml/badge.svg)
# IMCtermite # IMCtermite

View File

@ -3,12 +3,11 @@
SHELL := /bin/bash SHELL := /bin/bash
# name of executable and CLI tool # name of executable and CLI tool
EXE = imctermite EXE = IMCtermite
# directory names # directory names
SRC = src/ SRC = src/
LIB = lib/ LIB = lib/
CYT = cython/
PYT = python/ PYT = python/
# list headers # list headers
@ -16,14 +15,14 @@ HPP = $(wildcard $(LIB)/*.hpp)
# choose compiler and its options # choose compiler and its options
CC = g++ -std=c++17 CC = g++ -std=c++17
#OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
OPT = -O3 -Wall -Wconversion -Wpedantic -Werror -Wunused-variable -Wsign-compare OPT = -O3 -Wall -Wconversion -Wpedantic -Werror -Wunused-variable -Wsign-compare
# determine git version/commit and release tag # determine git version/commit and release tag
GTAG := $(shell git tag -l --sort=version:refname | tail -n1) GTAG := $(shell git tag -l --sort=version:refname | tail -n1)
GHSH := $(shell git rev-parse HEAD | head -c8) GHSH := $(shell git rev-parse HEAD | head -c8)
RTAG := v$(shell cat pip/setup.py | grep version | grep -oP "([0-9]\.){2}[0-9]{1,2}")
CTAG := v$(shell cat cython/setup.py | grep version | grep -oP "([0-9]\.){2}[0-9]{1,2}") # current timestamp
TMS = $(shell date +%Y%m%dT%H%M%S)
# define install location # define install location
INST := /usr/local/bin INST := /usr/local/bin
@ -32,7 +31,7 @@ INST := /usr/local/bin
# C++ and CLI tool # C++ and CLI tool
# build exectuable # build exectuable
$(EXE) : check-vtag $(RTAG) main.o $(EXE) : main.o
$(CC) $(OPT) main.o -o $@ $(CC) $(OPT) main.o -o $@
# build main.cpp and include git version/commit tag # build main.cpp and include git version/commit tag
@ -40,6 +39,7 @@ main.o : src/main.cpp $(HPP)
@cp $< $<.cpp @cp $< $<.cpp
@sed -i 's/TAGSTRING/$(GTAG)/g' $<.cpp @sed -i 's/TAGSTRING/$(GTAG)/g' $<.cpp
@sed -i 's/HASHSTRING/$(GHSH)/g' $<.cpp @sed -i 's/HASHSTRING/$(GHSH)/g' $<.cpp
@sed -i 's/TIMESTAMPSTRING/$(TMS)/g' $<.cpp
$(CC) -c $(OPT) -I $(LIB) $<.cpp -o $@ $(CC) -c $(OPT) -I $(LIB) $<.cpp -o $@
@rm $<.cpp @rm $<.cpp
@ -54,23 +54,11 @@ cpp-clean :
rm -vf *.o rm -vf *.o
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# linter and code check # C++ linter
check-code: check-code:
cppcheck --enable=all -I lib/ src/main.cpp cppcheck --enable=all -I lib/ src/main.cpp
#-----------------------------------------------------------------------------#
# check version consistency of git tags and version string in package.json
$(GTAG) :
@echo "consistent versions check successful: building $(GTAG)"
check-vtag:
@echo "git tag version: "$(GTAG)
@echo "git commit hash: "$(GHSH)
@echo "release version: "$(RTAG)
@echo "module version: "$(CTAG)
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Docker # Docker
@ -83,28 +71,26 @@ docker-run:
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# python # python
cython-build : check-vtag $(CTAG) $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP) python-build:
python3 $(CYT)setup.py build_ext --inplace make -C python/ build-inplace
cp -v imc_termite.cpython-*.so $(PYT) cp python/IMCtermite*.so ./ -v
cython-install : check-vtag $(CTAG) $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP) python-clean:
python3 $(CYT)setup.py install --record files_imctermite.txt make -C python/ clean
rm -vf IMCtermite*.so
cython-clean :
rm -vf imc_termite.cpython-*.so
rm -vf $(PYT)imc_termite.cpython-*.so
rm -rvf build/
#-----------------------------------------------------------------------------#
# pip
pip-release: check-vtag $(RTAG) cython-build
cd ./pip/ && make publish-source
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# clean # clean
clean: cpp-clean cython-clean clean: cpp-clean python-clean
cd ./pip/ && make clean
#-----------------------------------------------------------------------------#
# github actions
github-action-lint: .github/workflows/pypi-deploy.yml
actionlint $<
# for reference, see:
# https://github.com/rhysd/actionlint
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#

View File

@ -12,6 +12,7 @@
const std::string gittag("TAGSTRING"); const std::string gittag("TAGSTRING");
const std::string githash("HASHSTRING"); const std::string githash("HASHSTRING");
const std::string timestamp("TIMESTAMPSTRING");
//---------------------------------------------------------------------------// //---------------------------------------------------------------------------//
@ -127,13 +128,13 @@ optkeys parse_args(int argc, char* argv[], bool list_args = false)
void show_version() void show_version()
{ {
std::cout<<"imctermite ["<<gittag<<"-g"<<githash<<"]"<<"\n"; std::cout<<"imctermite ["<<gittag<<"-g"<<githash<<"-"<<timestamp<<"]"<<"\n";
} }
void show_usage() void show_usage()
{ {
std::cout<<"\n" std::cout<<"\n"
<<"imctermite ["<<gittag<<"-g"<<githash<<"] (https://github.com/RecordEvolution/IMCtermite.git)" <<"imctermite ["<<gittag<<"-g"<<githash<<"-"<<timestamp<<"] (https://github.com/RecordEvolution/IMCtermite.git)"
<<"\n\n" <<"\n\n"
<<"Decode IMC raw files and dump data as *.csv" <<"Decode IMC raw files and dump data as *.csv"
<<"\n\n" <<"\n\n"