Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ jobs:
group: [1, 2, 3, 4]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 1

- name: Set up uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v10.0.0
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: Set up Python
run: uv python install 3.12

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev
- name: Set up MPI
uses: mpi4py/setup-mpi@v1.4.4
with:
mpi: openmpi

- name: Install dependencies
run: uv sync --extra dev
Expand Down Expand Up @@ -206,14 +208,14 @@ jobs:

- name: Upload results artifact
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7.0.1
with:
name: notebook-results-group-${{ matrix.group }}
path: results/group-${{ matrix.group }}-results.txt

- name: Upload executed notebooks
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7.0.1
with:
name: executed-notebooks-group-${{ matrix.group }}
path: executed-notebooks/**/*.ipynb
Expand All @@ -228,7 +230,7 @@ jobs:
if: always()
steps:
- name: Download all results
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8.0.1
with:
pattern: notebook-results-group-*
merge-multiple: true
Expand Down Expand Up @@ -284,12 +286,12 @@ jobs:
name: "Build Documentation"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0 # Required for setuptools_scm version calculation

- name: Set up uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v10.0.0
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
Expand All @@ -301,7 +303,7 @@ jobs:
run: uv sync --extra doc

- name: Download executed notebooks
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8.0.1
with:
pattern: executed-notebooks-group-*
path: downloaded-notebooks
Expand Down Expand Up @@ -332,7 +334,7 @@ jobs:
mv xopt-examples.zip ./site/assets/

- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v5.0.0
with:
path: ./site

Expand All @@ -350,4 +352,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5.0.0
11 changes: 4 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,22 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 1

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v10.0.0
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Set up Python 3.13
run: uv python install 3.13

- name: Install dependencies
run: uv sync --extra dev

- name: Install pre-commit
run: uv pip install pre-commit

- name: List Python package versions
run: uv pip list

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v1
uses: actions/setup-python@v7.0.0
with:
python-version: 3.11
- name: Install pypa/build
Expand All @@ -31,6 +31,6 @@ jobs:
--outdir dist/
.
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@v1.14.2
with:
password: ${{ secrets.PYPI_API_TOKEN }}
14 changes: 8 additions & 6 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ jobs:
group: [1, 2, 3, 4]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7.0.1

- name: Set up uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v10.0.0
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: Set up Python
run: uv python install 3.12

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev
- name: Set up MPI
uses: mpi4py/setup-mpi@v1.4.4
with:
mpi: openmpi

- name: Install dependencies
run: uv sync --extra dev
Expand Down Expand Up @@ -202,7 +204,7 @@ jobs:

- name: Upload results artifact
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7.0.1
with:
name: results-group-${{ matrix.group }}
path: results/group-${{ matrix.group }}-results.txt
Expand All @@ -214,7 +216,7 @@ jobs:
if: always()
steps:
- name: Download all results
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8.0.1
with:
pattern: results-group-*
merge-multiple: true
Expand Down
53 changes: 44 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,75 @@ jobs:
max-deletions: 3

test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
mpi: [openmpi]
include:
- os: macos-latest
python-version: "3.13"
mpi: openmpi
- os: windows-latest
python-version: "3.13"
mpi: msmpi

name: Python ${{ matrix.python-version }}
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 1

- name: Set up uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v10.0.0
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev
- name: Set up MPI
uses: mpi4py/setup-mpi@v1.4.4
with:
mpi: ${{ matrix.mpi }}

- name: Install dependencies
run: uv sync --extra dev

- name: List Python package versions
run: uv pip list

- name: Run tests
- name: Run tests (Linux and macOS)
if: runner.os != 'Windows'
env:
COVERAGE_FILE: ${{ runner.temp }}/.coverage
run: uv run pytest -n auto --cov --cov-branch --cov-report=xml

- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
COVERAGE_FILE: ${{ runner.temp }}/.coverage
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -products * `
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
-property installationPath

if (-not $vsPath) {
throw "MSVC installation not found"
}

$devShell = Join-Path $vsPath "Common7\Tools\Launch-VsDevShell.ps1"
& $devShell -Arch amd64 -HostArch amd64 -SkipAutomaticLocation
Get-Command cl -ErrorAction Stop

uv run pytest -n auto --cov --cov-branch --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions xopt/tests/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_set_handler_with_logger_file():
logger.info("file test message")
handler.flush()
logger.removeHandler(handler)
handler.close()
with open(tmp.name) as f:
contents = f.read()
assert "file test message" in contents
Expand Down
Loading