[tox]
envlist = py3{7,8,9,10}
skip_missing_interpreters = true
skipsdist = true

[testenv]
envdir = {toxinidir}/.env
skip_install = true

setenv =
    CFLAGS = -march=native -O2 -g -DNDEBUG
    CXXFLAGS = {env:CFLAGS:-march=native -O2 -g -DNDEBUG}
    LDFLAGS = {env:CFLAGS:-march=native -O2 -g -DNDEBUG -Wl,-O1 -Wl,--as-needed}
    DEBUG = {env:DEBUG:}
    CC = {env:CC:gcc}
    CXX = {env:CXX:g++}
    CCC = {env:CXX:g++}
    LD = {env:CXX:g++}

passenv =
    pythonLocation
    CC
    CXX
    LD
    AR
    AS
    NM
    RANLIB
    STRIP
    OBJCOPY
    PYTHON
    DISPLAY
    XAUTHORITY
    HOME
    USERNAME
    USER
    CI
    XDG_*
    GITHUB*
    PIP_DOWNLOAD_CACHE

whitelist_externals =
    {build,clang,lint,clean,changes}: bash

deps =
    {build,clang,lint,clean}: pip>=19.0.1
    {build,clang}: this_cli
    changes: git+https://github.com/sarnold/gitchangelog.git@master
    lint: cpplint
    lint: beautysh

commands =
    {build,clang}: bash -c 'make -j1 CCC=$CXX CC=$CC cccc'
    {build,clang}: bash	-c 'make -j1 CCC=$CXX test 2>&1 | tail -n5'
    lint: bash -c 'cpplint --output=gsed {toxinidir}/cccc/*'
    changes: bash -c 'gitchangelog {posargs} > CHANGELOG.md'
    clean: bash -c 'make reallyclean'
