Skip to content
Snippets Groups Projects
Unverified Commit cbdc8f24 authored by Tuan Truong's avatar Tuan Truong Committed by GitHub
Browse files

Add more build platforms in GitHub Actions (#612)

parent 335d4a60
No related branches found
No related tags found
No related merge requests found
......@@ -16,47 +16,63 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
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 }
- { python: "3.9", numpy: 1.22.4 }
- { python: "3.10", numpy: 1.22.4 }
- { python: "3.11", numpy: 1.24.3 }
- { python: "3.12", numpy: 1.26.4 }
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- 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')) }}
uses: actions/setup-python@v5
id: pysetup
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.versions.python }}
cache: 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Upgrade pip wheel setuptools
run: python -m pip install wheel setuptools pip --upgrade
- name: Setup Python 3.8-3.9 - macos-arm
if: ${{ (matrix.os == 'macos-14') && ((matrix.versions.python == '3.8') || (matrix.versions.python == '3.9')) }}
run: |
brew update
brew install python@${{ matrix.versions.python }}
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.versions.python }} get-pip.py
- name: Install numpy for Python 3.8
if: matrix.python-version == '3.8'
run: python -m pip install numpy==1.20.3
- name: Install numpy for Python 3.9
if: matrix.python-version == '3.9'
run: python -m pip install numpy==1.20.3
- 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")
New-Item -ItemType HardLink -Path "$newPath" -Value "${{ steps.pysetup.outputs.python-path }}"
- name: Install numpy for Python 3.10
if: matrix.python-version == '3.10'
run: python -m pip install numpy==1.22.4
- name: Display Python and Pip versions
run: |
python${{ matrix.versions.python }} -c "import sys; print(sys.version)"
pip --version
- name: Install numpy for Python 3.11
if: matrix.python-version == '3.11'
run: python -m pip install numpy==1.24.3
- name: Upgrade pip wheel setuptools
run: pip install wheel setuptools pip --upgrade
- name: Install numpy ${{ matrix.versions.numpy }}
run: pip install numpy==${{ matrix.versions.numpy }}
- name: Display numpy version
run: python -c "import numpy; print(numpy.__version__)"
run: python${{ matrix.versions.python }} -c "import numpy; print(numpy.__version__)"
- name: Install other dependencies
run: |
python -m pip install scipy Cython pytest pytest-cov flake8
python -m pip install -e .[tests]
pip install scipy Cython pytest pytest-cov flake8
python${{ matrix.versions.python }} setup.py build_ext -j${{ steps.cpu-cores.outputs.count }}
pip install -e .[tests]
- name: Lint with flake8
run: |
......@@ -67,4 +83,4 @@ jobs:
- name: Test with pytest
run: |
python -m pytest --cov=cornac
pytest --cov=cornac
......@@ -19,48 +19,62 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
os: [windows-latest, ubuntu-latest, macos-13, macos-14]
versions:
- { python: "3.8", numpy: 1.22.4 }
- { python: "3.9", numpy: 1.22.4 }
- { python: "3.10", numpy: 1.22.4 }
- { python: "3.11", numpy: 1.24.3 }
- { python: "3.12", numpy: 1.26.4 }
- name: Set up Python
uses: actions/setup-python@v2
steps:
- 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')) }}
uses: actions/setup-python@v5
id: pysetup
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.versions.python }}
cache: 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install numpy for Python 3.8
if: matrix.python-version == '3.8'
run: python -m pip install numpy==1.20.3
- name: Install numpy for Python 3.9
if: matrix.python-version == '3.9'
run: python -m pip install numpy==1.20.3
- name: Setup Python 3.8-3.9 - macos-arm
if: ${{ (matrix.os == 'macos-14') && ((matrix.versions.python == '3.8') || (matrix.versions.python == '3.9')) }}
run: |
brew update
brew install python@${{ matrix.versions.python }}
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.versions.python }} get-pip.py
- name: Install numpy for Python 3.10
if: matrix.python-version == '3.10'
run: python -m pip install numpy==1.22.4
- 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")
New-Item -ItemType HardLink -Path "$newPath" -Value "${{ steps.pysetup.outputs.python-path }}"
- name: Install numpy for Python 3.11
if: matrix.python-version == '3.11'
run: python -m pip install numpy==1.24.3
- name: Display Python and Pip versions
run: |
python${{ matrix.versions.python }} -c "import sys; print(sys.version)"
pip --version
- name: Upgrade pip wheel setuptools
run: pip install wheel setuptools pip --upgrade
- name: Install numpy ${{ matrix.versions.numpy }}
run: pip install numpy==${{ matrix.versions.numpy }}
- name: Display numpy version
run: python -c "import numpy; print(numpy.__version__)"
run: python${{ matrix.versions.python }} -c "import numpy; print(numpy.__version__)"
- name: Install other dependencies
run: |
python -m pip install scipy Cython wheel
pip install scipy Cython wheel
- name: Build wheels
run: python setup.py bdist_wheel
run: python${{ matrix.versions.python }} setup.py bdist_wheel
- name: Rename Linux wheels to supported platform of PyPI
if: matrix.os == 'ubuntu-20.04'
if: matrix.os == 'ubuntu-latest'
run: for f in dist/*.whl; do mv "$f" "$(echo "$f" | sed s/linux/manylinux1/)"; done
- name: Publish wheels to GitHub artifacts
......@@ -72,9 +86,9 @@ jobs:
publish-pypi:
needs: [build-wheels]
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/download-artifact@v2
with:
......@@ -82,7 +96,7 @@ jobs:
path: dist/
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"
......
......@@ -357,6 +357,7 @@ setup(
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment