Skip to content

Commit

Permalink
Merge pull request #47 from sarnold/py-cleanup
Browse files Browse the repository at this point in the history
CI, python, and cmake cleanup
  • Loading branch information
andreasvc committed Sep 10, 2024
2 parents 76cdec7 + ae58b0b commit 00ff29d
Show file tree
Hide file tree
Showing 19 changed files with 405 additions and 306 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,34 @@ name: Smoke
on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
python_wheels:
name: Python wheels for ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
PYTHONIOENCODING: utf-8
PIP_DOWNLOAD_CACHE: ${{ github.workspace }}/../.pip_download_cache
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-22.04]
python-version: [3.9, '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -35,21 +40,16 @@ jobs:
pip install tox tox-gh-actions
- name: Install Ubuntu build deps
if: runner.os == 'Linux'
run: |
sudo apt-get -qq update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y -s ppa:nerdboy/embedded
sudo apt-get install -y pybind11-dev libre2-dev ninja-build
sudo apt-get install -y libre2-dev
- name: Test in place
- name: Test using pip install
run: |
tox -e dev
tox
env:
PLATFORM: ${{ matrix.os }}

- name: Build dist pkgs
- name: Build sdist and wheel pkgs
run: |
tox -e deploy
- name: Check wheel
run: |
tox -e check
tox -e build,check
68 changes: 68 additions & 0 deletions .github/workflows/conda-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CondaDev

on:
workflow_dispatch:
push:
branches:
- master
pull_request:

jobs:
build:
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-22.04', 'macos-13']
python-version: ['3.9', '3.10', '3.11', '3.12']
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
PYTHONIOENCODING: utf-8

steps:
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
env:
PY_VER: ${{ matrix.python-version }}
with:
activate-environment: pyre2
channels: conda-forge
allow-softlinks: true
channel-priority: flexible
show-channel-urls: true

- name: Cache conda packages
id: cache
uses: actions/cache@v4
env:
# Increase this value to reset cache and rebuild the env during the PR
CACHE_NUMBER: 0
with:
path: /home/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('environment.devenv.yml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Configure condadev environment
shell: bash -el {0}
env:
PY_VER: ${{ matrix.python-version }}
run: |
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda install conda-devenv
conda devenv
- name: Build and test
shell: bash -el {0}
env:
PY_VER: ${{ matrix.python-version }}
run: |
source activate pyre2
python -m pip install .[test] -vv
python -m pytest -v .
55 changes: 0 additions & 55 deletions .github/workflows/conda.yml

This file was deleted.

105 changes: 60 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,96 +3,111 @@ name: Build
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
#push:
#branches:
#- master

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} for Python
cibw_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
include:
- os: "ubuntu-22.04"
arch: "x86_64"
- os: "ubuntu-22.04"
arch: "aarch64"
- os: "macos-13"
arch: "x86_64"
macosx_deployment_target: "13.0"
- os: "macos-14"
arch: "arm64"
macosx_deployment_target: "14.0"
- os: "windows-latest"
arch: "auto64"
triplet: "x64-windows"
- os: "windows-latest"
arch: "auto32"
triplet: "x86-windows"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

- name: Prepare compiler environment for Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
arch: amd64

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-cibw.txt
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.20
env:
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2010_x86_64:latest
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2010_i686:latest
CIBW_BUILD: cp36-* cp37-* cp38-* cp39-*
CIBW_SKIP: "*-win32"
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones, plus cross-compile on macos
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_SKIP: "*_arm64 *universal2:arm64 *linux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2010
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*musllinux* *i686"
CIBW_BEFORE_ALL_LINUX: >
yum -y -q --enablerepo=extras install epel-release
&& yum install -y re2-devel ninja-build
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel show {wheel} && auditwheel repair -w {dest_dir} {wheel}"
yum -y update && yum -y install epel-release && yum install -y re2-devel ninja-build
CIBW_BEFORE_ALL_MACOS: >
brew install re2 pybind11 ninja
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.09
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "pip uninstall -y delocate && pip install git+https://github.com/Chia-Network/delocate.git && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}"
brew install re2 pybind11
# macos target should be at least 10.13 to get full c++17
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=${{ matrix.macosx_deployment_target }}
CIBW_BEFORE_ALL_WINDOWS: >
vcpkg install re2:x64-windows
vcpkg install pkgconf:${{ matrix.triplet }} re2:${{ matrix.triplet }}
&& vcpkg integrate install
CIBW_ENVIRONMENT_WINDOWS: 'CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake'
CIBW_TEST_COMMAND: python -c "import re2"
run: |
python -m cibuildwheel --output-dir wheelhouse
CIBW_TEST_REQUIRES: ""
CIBW_TEST_COMMAND: ""

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.7'
python-version: '3.9'

- name: Build sdist
run: |
pip install pep517
python -m pep517.build -s .
pip install build
python -m build -s .
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz

check_artifacts:
needs: [build_sdist, build_wheels]
needs: [build_sdist, cibw_wheels]
defaults:
run:
shell: bash
name: Check artifacts are correct
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
path: artifacts

# note wheels should be in subdirectory <upload_name>
# note wheels should be in subdirectories named <artifact_name>
- name: Check number of downloaded artifacts
run: ls -R
run: ls -l artifacts/*
Loading

0 comments on commit 00ff29d

Please sign in to comment.