diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9d49b69..ce15ca8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,24 +3,54 @@ on: push: tags: - '*' +env: + libarchive_tag: v3.6.1 jobs: - deploy: - name: Deploy to PyPI - if: startsWith(github.ref, 'refs/tags') + build_wheels: + name: Build wheels runs-on: ubuntu-latest steps: - - name: Setup python - uses: actions/setup-python@v4 + - uses: actions/checkout@v3 + - name: Build wheels + uses: pypa/cibuildwheel@v2.9.0 + env: + CIBW_ENVIRONMENT: INCLUDE=/usr/local/include LIBARCHIVE_PREFIX=/usr/local + CIBW_PYTHON_VERSIONS: 3.8,3.9,3.10 + CIBW_BEFORE_ALL: bash -x build-libarchive-lib.sh centos ${{ env.libarchive_tag }} + + + - uses: actions/upload-artifact@v3 with: - python-version: '3.8' + path: ./wheelhouse/*.whl - - name: Check out code - uses: actions/checkout@v3 + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 - - name: Build the library - run: python3 setup.py sdist + - name: Build sdist + run: pipx run build --sdist - - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} + - uses: actions/upload-artifact@v3 + with: + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/download-artifact@v3 + with: + # unpacks default artifact into dist/ + # if `name: artifact` is omitted, the action will create extra parent dir + name: artifact + path: dist + + - name: Deploy wheels to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + diff --git a/build-libarchive-lib.sh b/build-libarchive-lib.sh new file mode 100644 index 0000000..6965d5f --- /dev/null +++ b/build-libarchive-lib.sh @@ -0,0 +1,36 @@ +#!/usr/bin/bash + +function build_libarchive() { + tag=$1 + + dd=$PWD + cd /tmp + git clone https://github.com/libarchive/libarchive.git libarchive-src + cd libarchive-src; git checkout $tag + cd /tmp + mkdir build-libarchive; cd build-libarchive + cmake ../libarchive-src + make -j$(nproc); make install + cd $dd + +} + +function install_deps_centos() { + + yum install -y epel-release libxml2-devel libzstd-devel xz-devel bzip2-devel + yum install -y libacl-devel lz4-devel e2fsprogs-devel libb2-devel lzo-devel openssl-devel + yum install -y librichacl-devel swig strace cmake +} + +function install_deps_ubuntu() { + + apt-get install -y libxml2-dev libzstd-dev xz-dev bzip2-dev + apt-get install -y libacl1-dev liblz4-dev libext2fs-dev libb2-dev lzo-dev libssl-dev + apt-get install -y swig strace cmake +} + +os=$1 +tag=$2 +install_deps_$os +build_libarchive $tag +