Skip to content

fix: update CodeQL to v3 and fix security scan upload #3

fix: update CodeQL to v3 and fix security scan upload

fix: update CodeQL to v3 and fix security scan upload #3

Workflow file for this run

name: Run Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test-product-service:
name: Test Product Service
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
working-directory: ./product-service
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov httpx
- name: Run tests
working-directory: ./product-service
run: |
pytest --cov=. --cov-report=xml --cov-report=term || echo "No tests found, skipping"
- name: Lint with flake8
working-directory: ./product-service
run: |
pip install flake8
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
test-order-service:
name: Test Order Service
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
working-directory: ./order-service
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov httpx
- name: Run tests
working-directory: ./order-service
run: |
pytest --cov=. --cov-report=xml --cov-report=term || echo "No tests found, skipping"
- name: Lint with flake8
working-directory: ./order-service
run: |
pip install flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
docker-build-test:
name: Docker Build Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Product Service (test)
uses: docker/build-push-action@v5
with:
context: ./product-service
push: false
tags: product-service:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Order Service (test)
uses: docker/build-push-action@v5
with:
context: ./order-service
push: false
tags: order-service:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test images
run: |
echo "Docker images built successfully"