Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Set default behaviour to automatically normalize line endings.
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is
# accessed in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is
# accessed in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf
32 changes: 28 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ jobs:
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]
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v2
with:
fetch-depth: 0
Expand All @@ -31,12 +37,28 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Add requirements
- name: Add pip requirements
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions

- name: apt helper action
- name: Install macos deps with brew
if: runner.os == 'macOS'
run: |
brew install ninja

- name: Prepare compiler environment for ${{ matrix.os }}
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Set have package true for ${{ matrix.os }}
if: runner.os == 'Linux'
run: |
echo "HAVE_LIBDATRIE_PKG=TRUE" >> $GITHUB_ENV

- name: Install deps with apt helper action
if: runner.os == 'Linux'
uses: ryankurte/action-apt@v0.2.0
with:
Expand All @@ -45,6 +67,8 @@ jobs:
packages: libdatrie-dev pybind11-dev ninja-build

- name: Test in place
# windows does not like build_ext -i or removing previous build
if: runner.os != 'Windows'
run: |
tox -e py

Expand Down
143 changes: 143 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Release

on:
push:
# release on tag push
tags:
- '*'

jobs:
cibw_wheels:
name: Build wheels on ${{ matrix.os }} for Python
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]

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

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

- name: Prepare compiler environment for Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

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

- name: Build wheels
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"
CIBW_BEFORE_ALL_LINUX: >
yum -y -q --enablerepo=extras install epel-release
&& yum install -y ninja-build
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel show {wheel} && auditwheel repair -w {dest_dir} {wheel}"
CIBW_BEFORE_ALL_MACOS: >
brew install 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}"
CIBW_TEST_COMMAND: python -c "import datrie"
run: |
python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

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

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

- name: Build sdist
run: |
pip install pep517
python -m pep517.build -s .

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

create_release:
needs: [cibw_wheels, sdist]
runs-on: ubuntu-20.04

steps:
- name: Get version
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}

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

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

# download all artifacts to project dir
- uses: actions/download-artifact@v2

- name: Install gitchangelog
run: |
python -m pip install https://github.com/freepn/gitchangelog/archive/3.0.5.tar.gz

- name: Generate changes file
run: |
export GITCHANGELOG_CONFIG_FILENAME=$(get-rcpath)
bash -c 'gitchangelog $(git tag --sort=taggerdate | tail -n2 | head -n1)..${{ env.VERSION }} > CHANGES.md'

- name: Create draft release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body_path: CHANGES.md
draft: true
prerelease: true
# uncomment below to upload wheels to github releases
files: wheels/datrie*.whl

#upload_pypi:
#needs: [cibw_wheels, sdist]
#runs-on: ubuntu-latest
## upload to PyPI on every tag starting with 'v'
#if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
## alternatively, to publish when a GitHub Release is created, use the following rule:
## if: github.event_name == 'release' && github.event.action == 'published'
#steps:
#- uses: actions/download-artifact@v2
#with:
#name: artifact
#path: dist

#- uses: pypa/gh-action-pypi-publish@master
#with:
#user: __token__
#password: ${{ secrets.pypi_password }}

10 changes: 0 additions & 10 deletions .github/workflows/vs_env.bat

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/wheel-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -euxo pipefail

EXPECTED_WHEEL_COUNT=$1

if ! [ -n $EXPECTED_WHEEL_COUNT ]; then
exit 0
fi

WHEELS=$(find . -maxdepth 3 -name \*.whl)
if [ $(echo $WHEELS | wc -w) -ne $EXPECTED_WHEEL_COUNT ]; then
echo "Error: Expected $EXPECTED_WHEEL_COUNT wheels"
exit 1
else
exit 0
fi
92 changes: 92 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Wheels

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

jobs:
cibw_wheels:
name: Build wheels on ${{ matrix.os }} for Python
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]

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

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

- name: Prepare compiler environment for Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

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

- name: Build wheels
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"
CIBW_BEFORE_ALL_LINUX: >
yum -y -q --enablerepo=extras install epel-release
&& yum install -y ninja-build
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel show {wheel} && auditwheel repair -w {dest_dir} {wheel}"
CIBW_BEFORE_ALL_MACOS: >
brew install 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}"
CIBW_TEST_COMMAND: python -c "import datrie"
run: |
python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse/*.whl

check_artifacts:
name: Check artifacts are correct
needs: [cibw_wheels]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: wheels

- name: Check number of downloaded artifacts
run: .github/workflows/wheel-check.sh 24

#upload_pypi:
#needs: [cibw_wheels, sdist]
#runs-on: ubuntu-latest
## upload to PyPI on every tag starting with 'v'
#if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
## alternatively, to publish when a GitHub Release is created, use the following rule:
## if: github.event_name == 'release' && github.event.action == 'published'
#steps:
#- uses: actions/download-artifact@v2
#with:
#name: artifact
#path: dist

#- uses: pypa/gh-action-pypi-publish@master
#with:
#user: __token__
#password: ${{ secrets.pypi_password }}

3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

Loading