Skip to content

Commit

Permalink
initial working version
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Oct 18, 2024
0 parents commit 23debd1
Show file tree
Hide file tree
Showing 23 changed files with 15,243 additions and 0 deletions.
169 changes: 169 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: Build and release to PyPI
on:
workflow_dispatch:
inputs:
reduce-release-tag:
description: Reduce tag to build
required: true
default: v4.14
version-tag:
description: Python package version to release to PyPI (without 'v')
required: true
default: 4.14.post7
dry-run:
description: Dry run
type: boolean
default: false
exclude-types:
description: Commit types to exclude from the changelog
required: false
default: build,docs,style,other

jobs:
build-linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-24.04
target: manylinux_2_17_x86_64.manylinux2014_x86_64
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install uv --user --break-system-packages
uv tool install build
uv tool install wheel
- name: Build app
run: |
bash build_reduce_linux.sh ${{ inputs.reduce-release-tag }}
- name: Build python wheel
run: |
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheel-linux-${{ matrix.platform.target }}
path: build_python/dist/*.whl

build-macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
# Use the oldest version possible to maximize compatibility
- runner: macos-13
target: macosx_10_12_x86_64
target_env: 10.12
- runner: macos-15
target: macosx_11_0_arm64
target_env: 11.0
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
uname -a
pip install uv --break-system-packages
uv tool update-shell
uv tool install build
uv tool install wheel
brew install gnu-sed
- name: Build app
run: |
MACOSX_DEPLOYMENT_TARGET=${{ matrix.platform.target_env }} bash build_reduce_mac.sh ${{ inputs.reduce-release-tag }}
- name: Build python wheel
run: |
export PATH="/Users/runner/.local/bin:$PATH"
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
path: build_python/dist/*.whl
name: wheel-macos-${{ matrix.platform.target }}

test-ubuntu:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
target: [manylinux_2_17_x86_64.manylinux2014_x86_64]
# python-version: ['3.8']
# os: [ubuntu-20.04]
needs: [build-linux]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
name: wheel-linux-${{ matrix.target }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test wheel
run: |
pip install uv --break-system-packages
uv venv
source .venv/bin/activate
uv pip install -r requirements_test.txt
uv pip install dist/*.whl
pytest
test-macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
platform:
- runner: macos-12
target: macosx_10_12_x86_64
- runner: macos-13
target: macosx_10_12_x86_64
- runner: macos-14
target: macosx_11_0_arm64
- runner: macos-15
target: macosx_11_0_arm64
needs: [build-macos]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
name: wheel-macos-${{ matrix.platform.target }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test wheel
run: |
pip install uv --break-system-packages
uv venv
source .venv/bin/activate
uv pip install -r requirements_test.txt
uv pip install dist/*.whl
pytest
commit-changelog-and-release-github:
needs: [test-ubuntu, test-macos]
uses: deargen/workflows/.github/workflows/commit-changelog-and-release.yml@master
with:
version-tag: ${{ github.event.inputs.version-tag }}
dry-run: ${{ github.event.inputs.dry-run == 'true' }}
changelog-path: docs/CHANGELOG.md
exclude-types: ${{ github.event.inputs.exclude-types }}

release-to-pypi:
name: Release to PyPI
if: ${{ github.event.inputs.dry-run == 'false' }}
runs-on: ubuntu-24.04
needs: [commit-changelog-and-release-github]
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: wheel-*
merge-multiple: true
- name: Build and upload to PyPI
run: |
pip install uv --break-system-packages
uv tool install twine
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --non-interactive
180 changes: 180 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
/binary_glibc_dependency.txt
/build/
/build_python/
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python

Loading

0 comments on commit 23debd1

Please sign in to comment.