diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77e3c21..e4845f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: - main tags: - "*" - # pull_request: + pull_request: workflow_dispatch: inputs: prerelease: @@ -26,24 +26,19 @@ jobs: fail-fast: false matrix: os: - - "ubuntu-22.04" - - "macos-13" - - "macos-14" - # - "windows-latest" + - "ubuntu-latest" + - "macos-latest" steps: - uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 - - name: Set up macOS-13 - run: brew unlink gfortran && brew link --overwrite gfortran - if: ${{ matrix.os == 'macos-13' }} - - name: Set up macOS-14 + - name: Set up macOS run: echo "FC=gfortran-13" >> "$GITHUB_ENV" - if: ${{ matrix.os == 'macos-14' }} + if: ${{ matrix.os == 'macos-latest' }} - uses: pypa/cibuildwheel@v2.23.3 env: - MACOSX_DEPLOYMENT_TARGET: "${{ matrix.os == 'macos-13' && '13.0' || '14.0' }}" + MACOSX_DEPLOYMENT_TARGET: "14.0" - uses: actions/upload-artifact@v4 with: name: binary-${{ matrix.os }} @@ -57,17 +52,12 @@ jobs: with: submodules: true fetch-depth: 0 - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U build twine + - name: Set up uv + uses: astral-sh/setup-uv@v6 - name: Build sdist - run: python -m build --sdist . + run: uv build --sdist - name: Check the sdist - run: python -m twine check dist/*.tar.gz + run: uv run --with twine twine check dist/*.tar.gz - uses: actions/upload-artifact@v4 with: name: sdist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 275eef5..00df3ae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,67 +10,51 @@ concurrency: jobs: tests: - name: "py${{ matrix.python-version }} / ${{ matrix.os }} / ${{ matrix.nox-session }}" + name: "py${{ matrix.python-version }} / ${{ matrix.os }}${{ matrix.with-options && ' / options' || '' }}" runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - python-version: ["3.9", "3.11"] + python-version: ["3.10", "3.13"] os: [ubuntu-latest] - nox-session: ["tests"] + with-options: [false] include: - - os: macos-13 - python-version: "3.11" - nox-session: "tests" - os: macos-14 - python-version: "3.11" - nox-session: "tests" + python-version: "3.12" + with-options: false - os: ubuntu-latest python-version: "3.11" - nox-session: "options" + with-options: true steps: - name: Clone the repo uses: actions/checkout@v4 with: fetch-depth: 0 submodules: recursive - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - # if: ${{ runner.os != 'Windows' }} + - name: Set up uv + uses: astral-sh/setup-uv@v6 - name: Set up Linux run: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install -y gcc g++ gfortran if: ${{ runner.os == 'Linux' }} - - name: Set up macOS-13 - run: brew unlink gfortran && brew link --overwrite gfortran - if: ${{ matrix.os == 'macos-13' }} - name: Set up macOS-14 run: echo "FC=gfortran-13" >> "$GITHUB_ENV" if: ${{ matrix.os == 'macos-14' }} - - name: Cache pip packages - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ matrix.os }}-pip-${{ matrix.python-version }}-${{ matrix.nox-session }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/noxfile.py') }} - restore-keys: | - ${{ matrix.os }}-pip-${{ matrix.python-version }}-${{ matrix.nox-session }}-${{ hashFiles('**/pyproject.toml') }}- - ${{ matrix.os }}-pip-${{ matrix.python-version }}-${{ matrix.nox-session }}- - - name: Cache nox session files - uses: actions/cache@v4 - with: - path: .nox - key: ${{ matrix.os }}-nox-${{ matrix.python-version }}-${{ matrix.nox-session }}-${{ hashFiles('**/noxfile.py') }} - restore-keys: | - ${{ matrix.os }}-nox-${{ matrix.python-version }}-${{ matrix.nox-session }}- - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U nox + - name: Run simple test + run: uv run --extra test --python ${{ matrix.python-version }} tests/simple.py + env: + SPS_HOME: ${{ github.workspace }}/src/fsps/libfsps + if: ${{ !matrix.with-options }} + - name: Run tests + run: uv run --extra test --python ${{ matrix.python-version }} pytest -n 2 --durations=0 tests/tests.py + env: + SPS_HOME: ${{ github.workspace }}/src/fsps/libfsps + if: ${{ !matrix.with-options }} - name: Run tests - run: python -m nox --non-interactive --no-error-on-missing-interpreters -s ${{ matrix.nox-session }}-${{ matrix.python-version }} + run: uv run --extra test --python ${{ matrix.python-version }} tests/options.py env: SPS_HOME: ${{ github.workspace }}/src/fsps/libfsps + FFLAGS: "-DMIST=0 -DPADOVA=1 -DMILES=0 -DBASEL=1" + if: ${{ matrix.with-options }} diff --git a/noxfile.py b/noxfile.py deleted file mode 100644 index 4da3dba..0000000 --- a/noxfile.py +++ /dev/null @@ -1,38 +0,0 @@ -import os -from pathlib import Path - -import nox - -ALL_PYTHON_VS = ["3.8", "3.9", "3.10", "3.11"] - - -def _run_with_sps_home(session: nox.Session, *args, **kwargs): - sps_home = os.environ.get( - "SPS_HOME", Path(__file__).parent / "src" / "fsps" / "libfsps" - ) - kwargs["env"] = dict(kwargs.get("env", {}), SPS_HOME=str(sps_home)) - return session.run(*args, **kwargs, external=True) - - -@nox.session(python=ALL_PYTHON_VS) -def tests(session): - session.install(".[test]") - _run_with_sps_home(session, "python", "tests/simple.py") - _run_with_sps_home( - session, - "python", - "-m", - "pytest", - "-n", - "2", - "--durations=0", - "tests/tests.py", - ) - - -@nox.session(python=ALL_PYTHON_VS) -def options(session): - session.install( - ".[test]", env={"FFLAGS": "-DMIST=0 -DPADOVA=1 -DMILES=0 -DBASEL=1"} - ) - _run_with_sps_home(session, "python", "tests/options.py")