Unit tests on multiple Python versions #2
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: Unit tests on multiple Python versions | |
on: | |
push: | |
branches: | |
- master | |
- v*-release | |
pull_request: | |
branches: | |
- master | |
- v*-release | |
workflow_dispatch: | |
jobs: | |
test_prompt: | |
name: Run prompt template unit test | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest, windows-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Remove unnecessary files | |
run: | | |
df -h / | |
# Remove software and language runtimes we're not using | |
sudo rm -rf \ | |
"$AGENT_TOOLSDIRECTORY" \ | |
/opt/google/chrome \ | |
/opt/microsoft/msedge \ | |
/opt/microsoft/powershell \ | |
/opt/pipx \ | |
/usr/lib/mono \ | |
/usr/local/julia* \ | |
/usr/local/lib/android \ | |
/usr/local/lib/node_modules \ | |
/usr/local/share/chromium \ | |
/usr/local/share/powershell \ | |
/usr/share/dotnet \ | |
/usr/share/swift | |
df -h / | |
if: runner.os == 'Linux' | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Try to load cached dependencies | |
uses: actions/cache@v4 | |
id: restore-cache | |
with: | |
path: ~/.cache/pip | |
key: python-dependencies-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
python-dependencies-${{ matrix.os }}-${{ matrix.python-version }}- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Run single unit test | |
run: python -m pytest --durations 20 -sv tests/ |