Skip to content

Commit

Permalink
Install from wheels (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Oct 24, 2023
1 parent c3f4fc7 commit f6e00d3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 83 deletions.
78 changes: 0 additions & 78 deletions .github/workflows/build-python-package.yml

This file was deleted.

79 changes: 77 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,45 @@ concurrency:
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheels for ${{ matrix.platform-id }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
platform-id: manylinux_x86_64
- os: windows-2019
platform-id: win_amd64
- os: macos-latest
platform-id: macosx_x86_64
- os: macos-latest
platform-id: macosx_arm64

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp38-${{ matrix.platform-id }}
CIBW_ARCHS: all
CIBW_TEST_SKIP: '*-macosx_arm64'

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
retention-days: 1

run-tests:
needs: [build_wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Clone repo
uses: actions/checkout@v3
Expand All @@ -34,8 +66,51 @@ jobs:
create-args: python=${{ matrix.python-version }}
cache-environment: true

- name: Download wheels
uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Install the library
run: pip install --no-build-isolation -v .
run: pip install --no-index --find-links dist coreforecast

- name: Run tests
run: pytest --benchmark-group-by=param:scaler_name --benchmark-sort=fullname

build_sdist:
name: Build sdist
if: github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build sdist
run: |
python -m pip install build scikit-build-core
python -m build --sdist --outdir dist
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz

upload_to_pypi:
name: 'Upload to PyPI'
if: github.repository == 'Nixtla/coreforecast' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "coreforecast"
version = "0.0.1"
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"importlib_resources ; python_version < '3.10'",
"numpy",
Expand All @@ -12,7 +12,6 @@ classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -41,7 +40,7 @@ sdist.exclude = ["tests", "*.yml"]
sdist.reproducible = true
wheel.install-dir = ["coreforecast"]
wheel.packages = ["coreforecast"]
wheel.py-api = "cp37"
wheel.py-api = "py3"

[tool.cibuildwheel]
test-requires = "pytest"
Expand Down

0 comments on commit f6e00d3

Please sign in to comment.