Skip to content

Update title of Python Mastery Roadmap #2

Update title of Python Mastery Roadmap

Update title of Python Mastery Roadmap #2

Workflow file for this run

name: Python CI

Check failure on line 1 in .github/workflows/python-ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/python-ci.yml

Invalid workflow file

(Line: 65, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_TOKEN, (Line: 71, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_TOKEN
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
lint_and_format:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install tools
run: |
python -m pip install --upgrade pip
pip install black isort flake8
- name: Check formatting with black
run: |
black --check . || (echo "Run 'black .' to fix formatting" && exit 1)
- name: Check import order with isort
run: |
isort --check-only . || (echo "Run 'isort -rc .' to fix imports" && exit 1)
- name: Lint with flake8
run: |
flake8 . --max-line-length=88
unit_tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.10, 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 -r requirements-dev.txt
- name: Run tests with pytest
run: |
pytest -q --maxfail=1
build_docker:
name: Build Docker Image (optional)
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_TOKEN
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_TOKEN
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/python-mastery-roadmap:latest
security_scan:
name: Dependency & Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install safety and pip-audit
run: |
python -m pip install --upgrade pip
pip install pip-audit safety
- name: Run pip-audit
run: |
pip-audit || true
- name: Run safety check
run: |
safety check || true