Skip to content

FIX: Resolve parsing issue where functions were not correctly identif… #42

FIX: Resolve parsing issue where functions were not correctly identif…

FIX: Resolve parsing issue where functions were not correctly identif… #42

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
ci:
strategy:
fail-fast: false
matrix:
python-version: [3.8]
poetry-version: [1.1.13]
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint pytest pytest-cov black
- name: Install Calligraphy
run: |
pip install .
- name: Lint code
run: |
pylint calligraphy_scripting
- name: Run tests
run: |
pytest --cov=calligraphy_scripting --cov-report=xml --cov-fail-under=95 -W ignore::DeprecationWarning
- name: Get coverage
run: |
COVERAGE=$(cat coverage.xml | grep "name=\".\"" | awk '{print $3}')
echo "${COVERAGE}"
if [[ "${COVERAGE}" == 'line-rate="1"' ]]; then
WHOLE="100"
DECIMAL="00"
COLOR="brightgreen"
echo "100.00% coverage"
else
WHOLE=$(echo "${COVERAGE}" | cut -c14-15)
DECIMAL=$(echo "${COVERAGE}" | cut -c16-17)
echo "${WHOLE}.${DECIMAL}% coverage"
if [ "${WHOLE}" -gt "80" ]; then
COLOR="green"
elif [ "${WHOLE}" -gt "60" ]; then
COLOR="yellowgreen"
elif [ "${WHOLE}" -gt "40" ]; then
COLOR="yellow"
elif [ "${WHOLE}" -gt "20" ]; then
COLOR="orange"
else
COLOR="red"
fi
fi
echo "Color is ${COLOR}"
echo "COVERAGE=$(echo ${WHOLE}.${DECIMAL}%)" >> $GITHUB_ENV
echo "COLOR=$(echo ${COLOR})" >> $GITHUB_ENV
REF=${{ github.ref }}
echo "github.ref: $REF"
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo $BRANCH_NAME
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- name: Create Coverage Badge
uses: schneegans/dynamic-badges-action@v1.0.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: a5b95abd1dc360c13da66165ff482d5e
filename: calligraphy__${{ env.BRANCH }}.json
label: Test Coverage
message: ${{ env.COVERAGE }}
color: ${{ env.COLOR }}
namedLogo: pytest