updated cores in pytest workflow #1296
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package tests | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
schedule: | |
- cron: "0 12 * * 1" | |
pull_request_target: | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache pytest | |
uses: actions/cache@v3 | |
with: | |
path: .pytest_cache | |
key: ${{ runner.os }}-pytest-${{ hashFiles('**/pytest.ini') }} | |
restore-keys: | | |
${{ runner.os }}-pytest- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
# Install the package with dev dependencies | |
pip install -e ".[dev]" | |
# Install test dependencies | |
pip install pytest pytest-cov pytest-profiling pytest-xdist | |
- name: Set up environment | |
run: | | |
echo "HF_TOKEN=${{ vars.HF_TOKEN }}" > .env | |
- name: Run tests | |
run: | | |
pytest -vv \ | |
--durations=10 \ | |
--profile \ | |
--profile-svg \ | |
-n auto \ | |
--cov=quartz_solar_forecast \ | |
--cov-report=xml \ | |
--cov-report=term-missing | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: | | |
coverage.xml | |
.coverage | |
prof/ | |
- name: Upload profiling results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: profiling-results | |
path: | | |
*.prof | |
*.svg |