Skip to content

Commit

Permalink
Fresh start over
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPdeS committed Oct 12, 2023
0 parents commit aa05251
Show file tree
Hide file tree
Showing 127 changed files with 11,637 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/actions/install_package_ubuntu/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Install package: Ubuntu-latest"
description: "Installs prebuild ubuntu-latest wheel to current job"

inputs:
python_version:
description: 'Python version to be translated'
required: true

runs:
using: "composite"
steps:
- uses: MartinPdeS/SuPyMode/.github/actions/interpret_python_version@master
with:
python_version: ${{ inputs.python_version }}

- name: "Set-up: Python ${{ env.cp_python_version }}"
uses: actions/setup-python@v4
id: cp310
with:
python-version: "${{ env.dotted_python_version }}"

- name: "Install: Dependencies for headless server"
shell: bash
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-glx xvfb
- name: "Download: wheel"
uses: actions/download-artifact@v3
with:
path: ./dist

- name: "Install package"
shell: bash
run: |
python -m pip install -r requirements-validation.txt
python -m pip install --no-index --find-links './dist/manylinux_wheel_python${{ env.cp_python_version }}/' SuPyMode
24 changes: 24 additions & 0 deletions .github/actions/interpret_python_version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Interpret Python Version"
description: "Interprets python version written with a dot to cp version"

inputs:
python_version:
description: 'Python version to be translated'
required: true

runs:
using: "composite"
steps:
- name: "translate python version to cp"
shell: bash
run: |
echo "Python version to be translated: ${{inputs.python_version}} saved in env.dotted_python_version"
TEMP=${{ inputs.python_version }}
PYTHON_CP_VERSION="cp${TEMP//./}"
echo "PYTHON_CP_VERSION=$PYTHON_CP_VERSION" >> $GITHUB_ENV
echo "dotted_python_version=$TEMP" >> $GITHUB_ENV
echo "cp_python_version=$PYTHON_CP_VERSION" >> $GITHUB_ENV
echo "Python version translated to: $PYTHON_CP_VERSION saved in env.cp_python_version"
133 changes: 133 additions & 0 deletions .github/workflows/build_macos_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: MacOS-Workflow

permissions:
contents: write

on:
workflow_call:
inputs:
update_coverage:
type: boolean
default: false

publish_wheel:
type: boolean
required: false
default: false
python_wheel:
type: string
required: false
default: "['3.7']"
python_twine:
type: string
required: false
default: "3.9"

upload_documentation:
type: boolean
required: false
default: false
python_documentation:
type: string
required: false
default: "3.9"


jobs:
job_create_wheel_arm64:
name: "Python ${{ matrix.python-version[1] }}-arm64"
if: "${{ inputs.publish_wheel == true }}"
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(inputs.python_wheel) }}
steps:

- name: "Checkout repository"
uses: actions/checkout@v3
with:
submodules: 'true'

- name: "Set up Python${{ matrix.python-version[0] }}"
run: |
brew install python@${{ matrix.python-version[0] }}
python${{ matrix.python-version[0] }} -m pip install -U pip pipx setuptools
- name: Install cibuildwheel
run: |
python${{ matrix.python-version[0] }} -m pip install cibuildwheel==2.11.2
- name: Build wheels
run: |
python${{ matrix.python-version[0] }} -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "${{ matrix.python-version[1] }}-macosx_arm64"
CIBW_ARCHS: "arm64"
CIBW_PLATFORM: "macos"
CIBW_BUILD_VERBOSITY: 1
_PYTHON_HOST_PLATFORM: "macosx-10.13-arm64"
CIBW_ENVIRONMENT_MACOS:
PROJ_WHEEL=true
PROJ_NETWORK=ON
MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_TEST_REQUIRES: ""
CIBW_TEST_COMMAND: ''

- name: "Upload: Wheel"
if: ${{ inputs.publish_wheel == true }}"
uses: actions/upload-artifact@v3
with:
name: "macos_arm64_wheel_${{ matrix.python-version[1] }}"
path: ./dist/*


job_create_wheel_universal2:
name: "Python ${{ matrix.python-version[1] }}-universal2"
if: "${{ inputs.publish_wheel == true }}"
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(inputs.python_wheel) }}
steps:

- name: "Checkout repository"
uses: actions/checkout@v3
with:
submodules: 'true'

- name: "Set up Python${{ matrix.python-version[0] }}"
run: |
brew install python@${{ matrix.python-version[0] }}
python${{ matrix.python-version[0] }} -m pip install -U pip pipx setuptools
- name: Install cibuildwheel
run: |
python${{ matrix.python-version[0] }} -m pip install cibuildwheel==2.11.2
- name: Build wheels
run: |
python${{ matrix.python-version[0] }} -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: "${{ matrix.python-version[1] }}-macosx_universal2"
CIBW_ARCHS: "universal2"
CIBW_PLATFORM: "macos"
CIBW_BUILD_VERBOSITY: 1
_PYTHON_HOST_PLATFORM: "macosx-10.13-universal2"
CIBW_ENVIRONMENT_MACOS:
PROJ_WHEEL=true
PROJ_NETWORK=ON
MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_TEST_REQUIRES: ""
CIBW_TEST_COMMAND: ''

- name: "Upload: Wheel"
if: ${{ inputs.publish_wheel == true }}"
uses: actions/upload-artifact@v3
with:
name: "macos_universal2_wheel_${{ matrix.python-version[1] }}"
path: ./dist/*

# -

71 changes: 71 additions & 0 deletions .github/workflows/build_macos_x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: MacOS-x86_64-Workflow

permissions:
contents: write

on:
workflow_call:
inputs:
python_version_list:
type: string
required: false
default: "['3.10']"


jobs:
job_create_wheel:
name: "Python ${{ matrix.python_version }}"
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python_version: ${{ fromJson(inputs.python_version_list) }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
submodules: true

- uses: ./.github/actions/interpret_python_version
with:
python_version: ${{ matrix.python_version }}


- name: "Build: Wheels"
uses: pypa/[email protected]
with:
output-dir: dist
env:
CC: /usr/bin/gcc
CXX: /usr/bin/g++
CIBW_BUILD: "${{ env.PYTHON_CP_VERSION }}-macosx_x86_64"
CIBW_TEST_REQUIRES: ".[dev]"
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: "x86_64"
CIBW_PLATFORM: "macos"
MACOSX_DEPLOYMENT_TARGET: "10.13"
_PYTHON_HOST_PLATFORM: "macosx-10.13-x86_64"
CIBW_TEST_COMMAND: 'pytest -s {project}/tests'
CIBW_ENVIRONMENT_MACOS:
PROJ_WHEEL=true
PROJ_NETWORK=ON
MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_BEFORE_BUILD: |
mkdir build
cd build
cmake -G"Unix Makefiles" -DPYBIND11_PYTHON_VERSION=${{ matrix.python_version }} ./..
make install
cd ..
##### WTF: looks like if y put the requirement-dev before cmake install auditwheel will find too-recent symbols!!! (took me 8h to debug!)
- name: "Upload: Wheel"
uses: actions/upload-artifact@v3
with:
name: "macos_x86_64_wheel_${{ env.PYTHON_CP_VERSION }}"
path: ./dist/*




# -
Loading

0 comments on commit aa05251

Please sign in to comment.