Skip to content

Update README.md

Update README.md #8

Workflow file for this run

# This workflow will installs Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This workflow should be changed according to the project's needs.
# This workflow will installs Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This workflow should be changed according to the project's needs.
name: tests
on:
pull_request:
branches:
- main
- develop
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==23.1.0 ruff==0.0.256
- name: Reformat code with Black
run: black .
- name: Lint code with Ruff
run: ruff .
# Check if there are changes and commit them
- name: Check for changes
run: |
if [[ `git status --porcelain` ]]; then
git config --global user.name "lemosd-ppb"
git config --global user.email "[email protected]"
git add .
git commit -m "Reformat code with Black and fix lint issues with Ruff"
git push
else
echo "No changes to commit"
fi
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.11]
steps:
- uses: actions/checkout@v4
- 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 .[test] # This installs your package with test dependencies
- name: Set up Django environment
run: |
export PYTHONPATH=$PYTHONPATH:$PWD
export DJANGO_SETTINGS_MODULE=testapp.settings
- name: Run tests and generate coverage report
run: |
pytest --ds=testapp.settings --cov=sbomrepo --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true