Skip to content

Bump actions/checkout from 6 to 7 #219

Bump actions/checkout from 6 to 7

Bump actions/checkout from 6 to 7 #219

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
jobs:
core:
name: Core (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12"]
defaults:
run:
shell: pwsh
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Create virtual environment
run: |
python -m venv .venv
if ($env:RUNNER_OS -eq "Windows") {
"VENV_PYTHON=.venv\Scripts\python.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
"VENV_PYTHON=.venv/bin/python" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Upgrade pip
run: |
& $env:VENV_PYTHON -m pip install --upgrade pip
- name: Install project with development dependencies
run: |
& $env:VENV_PYTHON -m pip install -e ".[dev]"
- name: Run Ruff
run: |
& $env:VENV_PYTHON -m ruff check .
- name: Run source security lint
run: |
& $env:VENV_PYTHON -m ruff check src --select S
- name: Check Ruff formatting
run: |
& $env:VENV_PYTHON -m ruff format --check .
- name: Run MyPy
run: |
& $env:VENV_PYTHON -m mypy
- name: Run Pyright
run: |
& $env:VENV_PYTHON -m pyright
- name: Run dependency security audit
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
& $env:VENV_PYTHON -m pip_audit --skip-editable
- name: Run tests
run: |
& $env:VENV_PYTHON -m pytest -q
optional-backends:
name: Optional backends (balanced)
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: pwsh
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Create virtual environment
run: |
python -m venv .venv
"VENV_PYTHON=.venv/bin/python" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install balanced optional dependencies
run: |
& $env:VENV_PYTHON -m pip install --upgrade pip
& $env:VENV_PYTHON -m pip install -e ".[dev,planner,tensornetwork,quimb]"
- name: Verify balanced optional modules are importable
run: |
& $env:VENV_PYTHON -c "import importlib; [importlib.import_module(name) for name in ('numpy', 'opt_einsum', 'tensornetwork', 'quimb')]"
- name: Run optional backend tests
run: |
$env:TNE_REQUIRE_OPTIONAL_BACKENDS = "1"
& $env:VENV_PYTHON -m pytest -q -m optional_backend
browser-e2e:
name: Browser E2E (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
defaults:
run:
shell: pwsh
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Create virtual environment
run: |
python -m venv .venv
if ($env:RUNNER_OS -eq "Windows") {
"VENV_PYTHON=.venv\Scripts\python.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
"VENV_PYTHON=.venv/bin/python" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Install browser E2E dependencies
run: |
& $env:VENV_PYTHON -m pip install --upgrade pip
& $env:VENV_PYTHON -m pip install -e ".[dev]"
& $env:VENV_PYTHON -m pip install playwright
if ($env:RUNNER_OS -eq "Linux") {
& $env:VENV_PYTHON -m playwright install --with-deps chromium
} else {
& $env:VENV_PYTHON -m playwright install chromium
}
- name: Run browser E2E tests
run: |
$env:TNE_RUN_BROWSER_E2E = "1"
& $env:VENV_PYTHON -m pytest -q -m browser
package:
name: Package smoke
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: pwsh
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Create build virtual environment
run: |
python -m venv .venv
"VENV_PYTHON=.venv/bin/python" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install build dependencies
run: |
& $env:VENV_PYTHON -m pip install --upgrade pip
& $env:VENV_PYTHON -m pip install -e ".[dev]"
- name: Build distribution artifacts
run: |
& $env:VENV_PYTHON -m build
- name: Validate distribution metadata
run: |
& $env:VENV_PYTHON -m twine check dist/*
- name: Smoke test built wheel in a clean environment
run: |
$wheel = (Get-ChildItem "dist/*.whl" | Select-Object -First 1).FullName
if (-not $wheel) {
throw "No wheel was produced in dist/."
}
python -m venv .wheel-smoke
$smokePython = ".wheel-smoke/bin/python"
& $smokePython -m pip install --upgrade pip
& $smokePython -m pip install pytest $wheel
$env:TNE_WHEEL_UNDER_TEST = $wheel
& $smokePython -m pytest -q tests/test_wheel_smoke.py
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: dist-py3.12
path: dist/
heavy-backends:
name: Heavy backends (manual)
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 45
defaults:
run:
shell: pwsh
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Create virtual environment
run: |
python -m venv .venv
"VENV_PYTHON=.venv/bin/python" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install heavy optional dependencies
run: |
& $env:VENV_PYTHON -m pip install --upgrade pip
& $env:VENV_PYTHON -m pip install -e ".[dev,tensorkrowch]"
- name: Run heavy backend tests
run: |
& $env:VENV_PYTHON -m pytest -q -m heavy_backend