Skip to content

Documentation Improvement #335

Documentation Improvement

Documentation Improvement #335

Workflow file for this run

name: lint-and-test
on:
# Trigger the workflow on push or pull request,
# but only for the main branch and development-main
push:
branches:
- main
- development-main
pull_request:
branches:
- main
- development-main
jobs:
test:
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12"]
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.in-project true
poetry install
- name: Testing with coverage
run: |
poetry run pytest kielmat/test/ --cov=kielmat --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml
fail_ci_if_error: true # Optional: specify if CI should fail when Codecov runs into errors.
run-linters:
name: Run linters
runs-on: windows-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install Python dependencies
run: pip install black
- name: Run Black code formatter and commit changes
run: |
black .
if [[ -n $(git diff --name-only) ]]; then
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add -u
git commit -m "Apply Black Formatting"
git push
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}