Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more build platforms in GitHub Actions #612

Merged
merged 43 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
66f963c
add more build platforms
tqtg Apr 2, 2024
338b18c
fix python version checking
tqtg Apr 2, 2024
bbc3ee2
reverse back to using matrix.python-version
tqtg Apr 2, 2024
396aa63
pin numpy==1.26.4 for Python 3.12
tqtg Apr 2, 2024
8fa2031
use macos-12 for Python 3.8-3.9
tqtg Apr 2, 2024
5ead663
update build matrix for python-publish action
tqtg Apr 2, 2024
5065fc0
build the Cython modules in parallel
tqtg Apr 2, 2024
c592566
Removed unused matrix attributes
darrylong Apr 3, 2024
66a125a
install python and pip manually for macos-arm py38-39
tqtg Apr 3, 2024
2c9ba99
fix default condition
tqtg Apr 3, 2024
d8a4bb5
brew link python
tqtg Apr 3, 2024
9418cc7
test brew link python
tqtg Apr 3, 2024
27f3300
use alias for homebrew python
tqtg Apr 3, 2024
f4e36ce
export PATH
tqtg Apr 3, 2024
465fe02
brew uninstall python3
tqtg Apr 3, 2024
b25ef6a
brew uninstall --ignore-dependencies python3
tqtg Apr 3, 2024
8b2aa5f
try action/python-verions
tqtg Apr 3, 2024
c5e539c
fix typo
tqtg Apr 3, 2024
5d179b1
setup-python with python-versions
tqtg Apr 3, 2024
68764f9
macos-11_arm64
tqtg Apr 3, 2024
825dea2
downgrade setup-python/v4
tqtg Apr 3, 2024
8eb92b9
pin specific version
tqtg Apr 3, 2024
6cb4dd1
ignore py3.8-3.9 for macos-arm
tqtg Apr 3, 2024
506a362
Update matrix os and python-version
darrylong Apr 3, 2024
03ec088
Use pypy 3.8, 3.9 for macos-arm64
darrylong Apr 3, 2024
2a80ab4
Add numpy install dependency for pypy arm64 versions
darrylong Apr 3, 2024
2173ce7
Add pypy-dev for arm64 pypy versions
darrylong Apr 3, 2024
6df9c23
use pip to install numpy for pypy
tqtg Apr 3, 2024
43d0ade
test using pip directly to install packages
tqtg Apr 3, 2024
004527a
bump numpy to 1.22 for py38-39
tqtg Apr 3, 2024
7f5f1e9
test numpy version
tqtg Apr 3, 2024
0e95430
update build matrix
tqtg Apr 3, 2024
c64d959
update publish action
tqtg Apr 3, 2024
ed986b4
create python alias for windows
tqtg Apr 3, 2024
af2da90
use mklink
tqtg Apr 3, 2024
7a3f0a3
use Set-Alias
tqtg Apr 3, 2024
a6d8ab3
fix mklink path
tqtg Apr 3, 2024
502369e
fix syntax
tqtg Apr 3, 2024
b354eb2
test HardLink
tqtg Apr 3, 2024
254b01f
add other OS
tqtg Apr 3, 2024
fd32573
add Python 3.12
tqtg Apr 3, 2024
a791059
Simplify install numpy steps
darrylong Apr 4, 2024
69eff2f
Simplify numpy step in publish
darrylong Apr 4, 2024
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
76 changes: 46 additions & 30 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -67,4 +83,4 @@ jobs:

- name: Test with pytest
run: |
python -m pytest --cov=cornac
pytest --cov=cornac
76 changes: 45 additions & 31 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -72,17 +86,17 @@ 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:
name: wheels
path: dist/

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ def run(self):
"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",
Expand Down
Loading