Update eslint.yml #190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python CI/CD Workflow | |
on: | |
push: | |
branches: [ master, main ] | |
pull_request: | |
branches: [ master, main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.9-slim', '3.10-slim', '3.11-slim'] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
${{ runner.os }}-pip- | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install coverage flake8 | |
- name: Set Environment Variables | |
run: echo "DJANGO_SETTINGS_MODULE=dropship_project.settings" >> $GITHUB_ENV | |
- name: Run Tests | |
run: python manage.py test | |
- name: Generate Coverage Report | |
run: | | |
coverage run --source='.' manage.py test | |
coverage report | |
coverage xml -o coverage.xml | |
if: always() | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
fail_ci_if_error: false | |
verbose: true | |
if: always() | |
- name: Lint Code with Flake8 | |
run: flake8 . | |
- name: Cleanup Pip Cache | |
run: python -m pip cache purge | |
if: always() | |