Skip to content

Mypayment extended #364

Mypayment extended

Mypayment extended #364

Workflow file for this run

name: Test
# https://docs.github.com/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python?langId=py#requirements-file
on:
pull_request:
types: [opened, ready_for_review, synchronize]
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
# Add a Redis container
# https://docs.github.com/en/actions/using-containerized-services/creating-redis-service-containers#running-jobs-directly-on-the-runner-machine
# Service containers to run with `runner-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis:7.0-alpine3.17
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
postgres:
# Docker Hub image
image: postgres:15.1-alpine3.17
# Provide the password for postgres
env:
POSTGRES_PASSWORD: "somerealpassword"
POSTGRES_USER: "hyperion"
POSTGRES_DB: "hyperion"
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- name: Check out the code
uses: actions/checkout@v6
- name: Fetch full main branch history # We don't known the the base commit of the PR
run: git fetch origin main --unshallow
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v6
id: setup-python
with:
python-version-file: .python-version
- name: Cache uv folder
id: cache-uv
uses: actions/cache@v4.3.0
with:
path: ~/.cache/uv
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-uv-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/0.9.27/install.sh | sh
- name: Install dependencies
run: uv pip install --system -r requirements-dev.txt
- name: Cache .pytest_cache folder
id: pytest_cache
uses: actions/cache@v4.3.0
with:
path: .pytest_cache
key: pytest_cache-${{ github.head_ref }}
# Run unit tests, run them all when push to main branch
- name: Run all unit tests
run: python tests_script.py --cov --all
if: github.event_name == 'push'
- name: Run unit tests for changed files
run: python tests_script.py --cov
if: github.event_name == 'pull_request'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5.5.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}