Skip to content

FIX: Heroku Deployment Pipeline #34

FIX: Heroku Deployment Pipeline

FIX: Heroku Deployment Pipeline #34

Workflow file for this run

# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
jobs:
# Run the tests in various configurations
pytest:
runs-on: ubuntu-22.04
strategy:
# Keep running even if one variation of the job fails
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
# actions/setup-python@v5 has built-in functionality for caching and restoring dependencies.
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
env:
AT_USERNAME: "sandbox"
AT_API_KEY: ${{ secrets.AT_API_KEY }}
run: docker-compose up --build -d
- name: Check running containers
run: docker ps -a
- name: Run tests with coverage inside the container
run: docker-compose exec -T api pytest --cov=customer_orders_service --verbose
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Shutdown Docker Compose
if: always() # whether the tests pass or fail
run: docker-compose down