* 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
on:
push:
branches:
- master
branches: [master]
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
name: Build binary wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
@ -21,12 +20,21 @@ jobs:
- name: Build wheels
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
needs: [build_wheels]
runs-on: ubuntu-20.04
needs: [build_wheels, build_sdist]
steps:
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.IMCTERMITE_GITHUB_WORKFLOW_PYPI_API_TOKEN }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.IMCTERMITE_GITHUB_WORKFLOW_PYPI_API_TOKEN }}

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
eatraw
eatdev
imctermite
IMCtermite
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)
[![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)
![Build Python Wheels](https://github.com/RecordEvolution/IMCtermite/actions/workflows/pypi-deploy.yml/badge.svg)
# IMCtermite

View File

@ -3,12 +3,11 @@
SHELL := /bin/bash
# name of executable and CLI tool
EXE = imctermite
EXE = IMCtermite
# directory names
SRC = src/
LIB = lib/
CYT = cython/
PYT = python/
# list headers
@ -16,14 +15,14 @@ HPP = $(wildcard $(LIB)/*.hpp)
# choose compiler and its options
CC = g++ -std=c++17
#OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
OPT = -O3 -Wall -Wconversion -Wpedantic -Werror -Wunused-variable -Wsign-compare
# determine git version/commit and release tag
GTAG := $(shell git tag -l --sort=version:refname | tail -n1)
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
INST := /usr/local/bin
@ -32,7 +31,7 @@ INST := /usr/local/bin
# C++ and CLI tool
# build exectuable
$(EXE) : check-vtag $(RTAG) main.o
$(EXE) : main.o
$(CC) $(OPT) main.o -o $@
# build main.cpp and include git version/commit tag
@ -40,6 +39,7 @@ main.o : src/main.cpp $(HPP)
@cp $< $<.cpp
@sed -i 's/TAGSTRING/$(GTAG)/g' $<.cpp
@sed -i 's/HASHSTRING/$(GHSH)/g' $<.cpp
@sed -i 's/TIMESTAMPSTRING/$(TMS)/g' $<.cpp
$(CC) -c $(OPT) -I $(LIB) $<.cpp -o $@
@rm $<.cpp
@ -54,23 +54,11 @@ cpp-clean :
rm -vf *.o
#-----------------------------------------------------------------------------#
# linter and code check
# C++ linter
check-code:
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
@ -83,28 +71,26 @@ docker-run:
#-----------------------------------------------------------------------------#
# python
cython-build : check-vtag $(CTAG) $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP)
python3 $(CYT)setup.py build_ext --inplace
cp -v imc_termite.cpython-*.so $(PYT)
python-build:
make -C python/ build-inplace
cp python/IMCtermite*.so ./ -v
cython-install : check-vtag $(CTAG) $(CYT)setup.py $(CYT)imc_termite.pxd $(CYT)py_imc_termite.pyx $(HPP)
python3 $(CYT)setup.py install --record files_imctermite.txt
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
python-clean:
make -C python/ clean
rm -vf IMCtermite*.so
#-----------------------------------------------------------------------------#
# clean
clean: cpp-clean cython-clean
cd ./pip/ && make clean
clean: cpp-clean python-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 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()
{
std::cout<<"imctermite ["<<gittag<<"-g"<<githash<<"]"<<"\n";
std::cout<<"imctermite ["<<gittag<<"-g"<<githash<<"-"<<timestamp<<"]"<<"\n";
}
void show_usage()
{
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"
<<"Decode IMC raw files and dump data as *.csv"
<<"\n\n"