Skip to content

Fix f-string nonsense, test for compo/proxy str() #48

Fix f-string nonsense, test for compo/proxy str()

Fix f-string nonsense, test for compo/proxy str() #48

name: Test-Lint-Check
on:
push:
branches: [ "joss", "main", "fixes" ]
pull_request:
branches: [ "joss", "main", "fixes" ]
permissions:
contents: read
jobs:
py310:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: pip deps
run: |
pip install -e .
pip install -r requirements.txt
- name: tests
id: tests
run: |
python -m unittest && {
echo 'badge_msg=Tests Passing' >> $GITHUB_OUTPUT
echo 'badge_val=100' >> $GITHUB_OUTPUT
} || {
echo 'badge_msg=Tests Failing' >> $GITHUB_OUTPUT
echo 'badge_val=0' >> $GITHUB_OUTPUT
}
outputs:
badge_tests_msg: ${{ steps.tests.outputs.badge_msg }}
badge_tests_val: ${{ steps.tests.outputs.badge_val }}
py311:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: pip deps
run: |
pip install -e .
pip install -r requirements.txt
- name: tests
id: tests
run: |
python -m unittest && {
echo 'badge_msg=Tests Passing' >> $GITHUB_OUTPUT
echo 'badge_val=100' >> $GITHUB_OUTPUT
} || {
echo 'badge_msg=Tests Failing' >> $GITHUB_OUTPUT
echo 'badge_val=0' >> $GITHUB_OUTPUT
}
outputs:
badge_tests_msg: ${{ steps.tests.outputs.badge_msg }}
badge_tests_val: ${{ steps.tests.outputs.badge_val }}
py312:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get python
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: apt deps
run: sudo apt install jq
- name: pip deps
run: |
pip install mypy coverage ruff
pip install -e .
pip install -r requirements.txt
- name: tests
id: tests
run: |
python -m unittest && {
echo 'badge_msg=Tests Passing' >> $GITHUB_OUTPUT
echo 'badge_val=100' >> $GITHUB_OUTPUT
} || {
echo 'badge_msg=Tests Failing' >> $GITHUB_OUTPUT
echo 'badge_val=0' >> $GITHUB_OUTPUT
}
- name: Test with mypy
id: mypy
run: |
mypy --strict src/raimad && {
echo 'badge_msg=No Issues' >> $GITHUB_OUTPUT
echo 'badge_val=100' >> $GITHUB_OUTPUT
} || {
echo 'badge_msg=Issues Found' >> $GITHUB_OUTPUT
echo 'badge_val=0' >> $GITHUB_OUTPUT
}
- name: Get test coverage
id: coverage
run: |
coverage run -m unittest && {
coverage_percent=$(coverage json -q -o /dev/stdout -i | jq '.totals.percent_covered_display' -r)
echo "badge_msg=$coverage_percent%" >> $GITHUB_OUTPUT
echo "badge_val=$coverage_percent" >> $GITHUB_OUTPUT
} || {
echo "badge_msg=Error" >> $GITHUB_OUTPUT
echo "badge_val=0" >> $GITHUB_OUTPUT
}
- name: Count number of TODOs and FIXMEs in codebase
id: todo
run: |
num_todos=$(find src tests -name '__pycache__' -prune -o -type f -exec grep -Eo "TODO|FIXME" {} \; | wc -l)
echo "badge_msg=$num_todos" >> $GITHUB_OUTPUT
echo "badge_val=$num_todos" >> $GITHUB_OUTPUT
- name: Run RUFF
id: ruff
run: |
ruff check -o ruff-output.txt && {
echo "badge_msg=No Issues" >> $GITHUB_OUTPUT
echo "badge_val=0" >> $GITHUB_OUTPUT
} || {
ruff_issues=$(grep Found ruff-output.txt | tr -cd [0-9])
echo "badge_msg=$ruff_issues Issues" >> $GITHUB_OUTPUT
echo "badge_val=$ruff_issues" >> $GITHUB_OUTPUT
}
outputs:
badge_tests_msg: ${{ steps.tests.outputs.badge_msg }}
badge_tests_val: ${{ steps.tests.outputs.badge_val }}
badge_mypy_msg: ${{ steps.mypy.outputs.badge_msg }}
badge_mypy_val: ${{ steps.mypy.outputs.badge_val }}
badge_coverage_msg: ${{ steps.coverage.outputs.badge_msg }}
badge_coverage_val: ${{ steps.coverage.outputs.badge_val }}
badge_todo_msg: ${{ steps.todo.outputs.badge_msg }}
badge_todo_val: ${{ steps.todo.outputs.badge_val }}
badge_ruff_msg: ${{ steps.ruff.outputs.badge_msg }}
badge_ruff_val: ${{ steps.ruff.outputs.badge_val }}
badges:
runs-on: ubuntu-latest
needs: [ py310, py311, py312 ]
steps:
- name: Create test 3.12 Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: tests312.svg
label: Python 3.12
message: ${{ needs.py312.outputs.badge_tests_msg }}
valColorRange: ${{ needs.py312.outputs.badge_tests_val }}
maxColorRange: 100
minColorRange: 0
- name: Create test 3.11 Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: tests311.svg
label: Python 3.11
message: ${{ needs.py311.outputs.badge_tests_msg }}
valColorRange: ${{ needs.py311.outputs.badge_tests_val }}
maxColorRange: 100
minColorRange: 0
- name: Create test 3.10 Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: tests310.svg
label: Python 3.10
message: ${{ needs.py310.outputs.badge_tests_msg }}
valColorRange: ${{ needs.py310.outputs.badge_tests_val }}
maxColorRange: 100
minColorRange: 0
- name: Create mypy Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: mypy.svg
label: mypy --strict
message: ${{ needs.py312.outputs.badge_mypy_msg }}
valColorRange: ${{ needs.py312.outputs.badge_mypy_val }}
maxColorRange: 100
minColorRange: 0
- name: Create coverage Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: coverage.svg
label: Test Coverage
message: ${{ needs.py312.outputs.badge_coverage_msg }}
valColorRange: ${{ needs.py312.outputs.badge_coverage_val }}
maxColorRange: 100
minColorRange: 0
- name: Create todo Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: todo.svg
label: "TODOs and FIXMEs"
message: ${{ needs.py312.outputs.badge_todo_msg }}
valColorRange: ${{ needs.py312.outputs.badge_todo_val }}
maxColorRange: 50
minColorRange: 0
invertColorRange: true
- name: Create ruff Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 767d80027892395f1cc61e4829810985
filename: ruff.svg
label: "Ruff"
message: ${{ needs.py312.outputs.badge_ruff_msg }}
valColorRange: ${{ needs.py312.outputs.badge_ruff_val }}
maxColorRange: 70
minColorRange: 0
invertColorRange: true