Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
53 changes: 53 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Reusable workflow for cibuildwheel

on:
workflow_call:
inputs:
operating-systems:
default: >-
["ubuntu"]
type: string
required: true
system-versions:
default: >-
["latest"]
type: string
required: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}-${{ matrix.version }}
runs-on: ${{ matrix.os }}-${{ matrix.version }}
strategy:
matrix:
os: ${{ fromJson(inputs.operating-systems) }}
version: ${{ fromJson(inputs.system-versions) }}
env:
CIBW_SKIP: cp37-macosx_x86_64
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "export MACOSX_DEPLOYMENT_TARGET=${{ matrix.version }}.0; delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"

steps:
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v5

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- name: Analyse
if: always()
run: sh analyse.sh

- uses: actions/upload-artifact@v4
with:
name: khoca.tar
path: /Users/runner/work/khoca/khoca.tar
if: always()

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
23 changes: 23 additions & 0 deletions .github/workflows/build_wheels_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build wheels Linux

on:
push:
tags:
- "*" # Push events of new tags
workflow_dispatch:
# Allow to run manually

jobs:
build_wheels:
uses: ./.github/workflows/build_wheels.yml
with:
operating-systems: >-
["ubuntu"]
system-versions: >-
["latest"]

pypi-publish:
name: Upload wheels to PyPI
needs: build_wheels
uses: ./.github/workflows/publish_pypi.yml
secrets: inherit
41 changes: 41 additions & 0 deletions .github/workflows/build_wheels_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build wheels MacOS

on:
push:
tags:
- "*" # Push events of new tags
workflow_dispatch:
# Allow to run manually

jobs:
build_wheels:
uses: ./.github/workflows/build_wheels.yml
with:
operating-systems: >-
["macos"]
system-versions: >-
["13", "14"]

pypi-publish:
# https://github.com/pypa/gh-action-pypi-publish
name: Upload wheels to PyPI
needs: build_wheels
runs-on: ubuntu-latest
env:
CAN_DEPLOY: ${{ secrets.PYPI_TOCKEN_KHOCA != '' }}
steps:

- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels*
path: wheelhouse
merge-multiple: true

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN_KHOCA }}
packages_dir: wheelhouse/
skip_existing: true
verbose: true
58 changes: 58 additions & 0 deletions .github/workflows/build_wheels_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build wheels Windows

on:
push:
tags:
- "*" # Push events of new tags
workflow_dispatch:
# Allow to run manually

jobs:
build_wheels:
name: Build Windows wheels for 64 bit Python
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install a Python to use for building
with:
python-version: '3.12'

- uses: msys2/setup-msys2@v2
name: Setup an msys2 environment
with:
msystem: UCRT64
release: false
install: >-
base-devel
m4
bison
make
patch
sed
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-gmp
pacboy: gcc:p
path-type: inherit

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.20.0

- name: Build many wheels
run: |
python -m cibuildwheel --output-dir wheelhouse

- name: Analyse
if: always()
run: sh analyse.sh

- uses: actions/upload-artifact@v4
name: Save the wheels as artifacts
with:
path: ./wheelhouse/*.whl
25 changes: 25 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Reusable workflow to publish to PyPI

on:
workflow_call:

jobs:
pypi-publish:
# https://github.com/pypa/gh-action-pypi-publish
name: Upload wheels to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels*
path: wheelhouse
merge-multiple: true

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN_KHOCA }}
packages_dir: wheelhouse/
skip_existing: true
verbose: true
26 changes: 26 additions & 0 deletions .github/workflows/publish_source_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish sources to PyPI

on:
workflow_dispatch:

jobs:
publish-sources:
name: Upload source distro to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v5
- name: Prepare
run: |
python -m pip install --upgrade pip
pip install cython setuptools
- name: Create distribution
run: python3 setup.py sdist
- name: Publish distro to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN_KHOCA }}
packages_dir: dist/
verbose: true
5 changes: 4 additions & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ jobs:
- name: Run Test
id: run_test
run: |
./khoca.py 0 0.0 0 braidaBaB calc0 | grep -c "t^-2q^4 + t^-1q^2 + t^0q^0 + t^1q^-2 + t^2q^-4"
RES=$(./khoca.py 0 0.0 0 braidaBaB calc0)
echo "RES: $RES"
echo $RES | grep -c "t^-2q^4 + t^-1q^2 + t^0q^0 + t^1q^-2 + t^2q^-4"
echo $RES | grep -c "t^-2q^5 + t^-1q^1 + t^0q^-1 + t^0q^1 + t^1q^-1 + t^2q^-5 + t^-1q^3\[2\] + t^2q^-3\[2\]"
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ ENV LANG C.UTF-8
ENV SHELL /bin/bash
# install prerequisites
RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends git g++ make libgmp-dev pari-gp2c python3 python3-dev python3-pip \
&& apt-get -qq install -y --no-install-recommends git g++ make libgmp-dev pari-gp2c python3 python3-dev pipx python-is-python3\
&& apt-get -qq clean \
&& rm -r /var/lib/apt/lists/* \
&& pip install cython \
&& pipx install cython \
&& pipx ensurepath \
&& export PATH="$PATH:/root/.local/bin" \
&& git clone https://github.com/soehms/khoca.git \
&& cd khoca/ \
&& make
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include data/ src/*/*.h src/*.h src/*/*.cpp src/*/*.pyx
Loading