include:
    -   project: 'beebryte/cicd/python-venv'
        ref: 'python_venv@0.2.1'
        file: 'python_venv.yml'

python_venv:
    rules:
        -   when: never

pytest_venv:
    extends: python_venv
    stage: build
    variables:
        PYTHON_SETUP: 'pip install pytest'
        VENV_ARTIFACT_NAME: 'pytest_venv'
    rules:
        -   when: null

pytest:
    variables:
        IMAGE_NAME: 'python'
        IMAGE_TAG: 'latest'
        IMAGE: '$IMAGE_NAME:$IMAGE_TAG'
        PROJECT_CHECK: '.'
    image: $IMAGE
    stage: test
    before_script:
        - source venv/bin/activate
    script:
        - pytest $PROJECT_PATH
    needs:
        -   job: pytest_venv
            artifacts: true