Use pytest.ini to configure pytest options like test paths and markers.
Manage environments and secrets in GitHub Actions using secrets and environment variables.
Example python-pytest.yml workflow config:
name: Python PyTest
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run PyTest
run: |
pytest --junitxml=results.xml
- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: pytest-results
path: results.xml