From dbad48b16f9a1b3c8b71cd50be60e0e80681f7d6 Mon Sep 17 00:00:00 2001 From: darrylong Date: Wed, 26 Jun 2024 13:33:08 +0800 Subject: [PATCH] clean up package action --- .github/workflows/python-package.yml | 44 +++++++++++++--------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f7b4f3dc..f58e2aba 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -17,14 +17,10 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-13, macos-14] - # python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - versions: - - { python: "3.8", numpy: 1.22.4, scipy: 1.10.1 } - - { python: "3.9", numpy: 1.22.4, scipy: 1.13.1 } - - { python: "3.10", numpy: 1.22.4, scipy: 1.13.1 } - - { python: "3.11", numpy: 1.24.3, scipy: 1.13.1 } - - { python: "3.12", numpy: 1.26.4, scipy: 1.13.1 } - + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + env: + LIMIT_NUMPY_VERSION: 2.0.0 + LIMIT_SCIPY_VERSION: 1.13.1 steps: - name: Get number of CPU cores uses: SimenB/github-actions-cpu-cores@v2 @@ -32,47 +28,47 @@ jobs: - uses: actions/checkout@v4 - - name: Setup Python ${{ matrix.versions.python }} - if: ${{ (matrix.os != 'macos-14') || ((matrix.os == 'macos-14') && (matrix.versions.python != '3.8') && (matrix.versions.python != '3.9')) }} + - name: Setup Python ${{ matrix.python-version }} + if: ${{ (matrix.os != 'macos-14') || ((matrix.os == 'macos-14') && (matrix.python-version != '3.8') && (matrix.python-version != '3.9')) }} uses: actions/setup-python@v5 id: pysetup with: - python-version: ${{ matrix.versions.python }} + python-version: ${{ matrix.python-version }} cache: 'pip' - name: Setup Python 3.8-3.9 - macos-arm - if: ${{ (matrix.os == 'macos-14') && ((matrix.versions.python == '3.8') || (matrix.versions.python == '3.9')) }} + if: ${{ (matrix.os == 'macos-14') && ((matrix.python-version == '3.8') || (matrix.python-version == '3.9')) }} run: | brew update - brew install python@${{ matrix.versions.python }} + brew install python@${{ matrix.python-version }} curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python${{ matrix.versions.python }} get-pip.py + python${{ matrix.python-version }} get-pip.py - name: Create Python alias for Windows if: matrix.os == 'windows-latest' run: | - $newPath = "${{ steps.pysetup.outputs.python-path }}".Replace("python.exe", "python${{ matrix.versions.python }}.exe") + $newPath = "${{ steps.pysetup.outputs.python-path }}".Replace("python.exe", "python${{ matrix.python-version }}.exe") New-Item -ItemType HardLink -Path "$newPath" -Value "${{ steps.pysetup.outputs.python-path }}" - name: Display Python and Pip versions run: | - python${{ matrix.versions.python }} -c "import sys; print(sys.version)" + python${{ matrix.python-version }} -c "import sys; print(sys.version)" pip --version - name: Upgrade pip wheel setuptools - run: python${{ matrix.versions.python }} -m pip install wheel setuptools pip --upgrade + run: python${{ matrix.python-version }} -m pip install wheel setuptools pip --upgrade - name: Install other dependencies - run: python${{ matrix.versions.python }} -m pip install Cython pytest pytest-cov flake8 + run: python${{ matrix.python-version }} -m pip install Cython pytest pytest-cov flake8 - - name: Install pinned dependencies - numpy ${{ matrix.versions.numpy }}, scipy ${{ matrix.versions.scipy }} + - name: Install other dependencies run: | - python${{ matrix.versions.python }} -m pip install "numpy<2.0.0" "scipy<=1.13.1" - python${{ matrix.versions.python }} setup.py build_ext -j${{ steps.cpu-cores.outputs.count }} - python${{ matrix.versions.python }} -m pip install -e .[tests] + python${{ matrix.python-version }} -m pip install Cython pytest pytest-cov flake8 "numpy<${{ env.LIMIT_NUMPY_VERSION }}" "scipy<=${{ env.LIMIT_SCIPY_VERSION }}" + python${{ matrix.python-version }} setup.py build_ext -j${{ steps.cpu-cores.outputs.count }} + python${{ matrix.python-version }} -m pip install -e .[tests] - name: Display numpy version - run: python${{ matrix.versions.python }} -c "import numpy; print(numpy.__version__)" + run: python${{ matrix.python-version }} -c "import numpy; print(numpy.__version__)" - name: Lint with flake8 run: | @@ -83,4 +79,4 @@ jobs: - name: Test with pytest run: | - python${{ matrix.versions.python }} -m pytest --cov=cornac + python${{ matrix.python-version }} -m pytest --cov=cornac