name: Run Python tests (through Pytest)

on:
  push:
    paths-ignore: ["README.md", ".gitignore", "LICENSE", "ruff.toml"]

jobs:
  Test:
    runs-on: ubuntu-latest
    container:
      image: node:21-bookworm
    steps:
      - name: Setting up Python ${{ env.PYTHON_VERSION }} for ${{runner.arch}} ${{runner.os}}
        run: |
           apt-get update
           apt-get install -y python3 python3-pip
      - name: Check out repository code
        if: success()
        uses: actions/checkout@v3
      - name: Installing Python Dependencies
        if: success()
        run: python3 -m pip install --upgrade pip setuptools wheel build twine pytest pytest-cov --break-system-packages
      - name: Installing Python Test Dependencies
        if: success() && hashFiles('requirements_test.txt') != ''
        run: python3 -m pip install --upgrade -r requirements_test.txt --break-system-packages
      - name: Installing package
        if: success()
        run: python3 -m pip install .[test]  --break-system-packages
      - name: Test Python Code
        if: success()
        run: python3 -m pytest test --cov=secret_loader --cov-report html:htmlcov --cov-fail-under=100