Skip to content

refactor: linting and isort #5

refactor: linting and isort

refactor: linting and isort #5

Workflow file for this run

name: Ignition RAG CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run unit tests with coverage
run: |
pytest tests/unit --cov=. --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 isort
- name: Run lint checks
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
black --check .
isort --check-only --profile black .
docker:
needs: [test, lint]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/ignition-rag:latest
${{ secrets.DOCKER_HUB_USERNAME }}/ignition-rag:${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/ignition-rag:latest
cache-to: type=inline