diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d9e49ea..915da5f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,55 +7,53 @@ env: libarchive_tag: v3.6.1 jobs: - deploy: - strategy: - matrix: - python_version: [3.8, 3.9, 3.10] - - name: Deploy to PyPI - if: startsWith(github.ref, 'refs/tags') + build_wheels: + name: Build wheels on runs-on: ubuntu-latest - container: quay.io/pypa/manylinux2014_x86_64 - steps: - - name: Install dependencies - run: | - 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 - - - name: Setup Python - uses: actions/setup-python@v2 + steps: + - 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: ${{ matrix.python_version }} - - name: Install python tools - run: | - python3 -m pip install auditwheel + path: ./wheelhouse/*.whl - - name: Build libarchive C sources - run: | - cd /tmp - git clone https://github.com/libarchive/libarchive.git libarchive-src - cd libarchive-src; git checkout ${{ env.libarchive_tag }} - mkdir build-libarchive; cd build-libarchive - cmake ../ - make -j$(nproc); make install - cd $GITHUB_WORKSPACE + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 - - name: Check out code - uses: actions/checkout@v3 + - name: Build sdist + run: pipx run build --sdist - - name: SWIG and Compile python modules - run: | - touch libarchive/_libarchive.i - make PYVER=${{ matrix.python_version }} + - uses: actions/upload-artifact@v3 + with: + path: dist/*.tar.gz - - name: Build wheels - run: | - python3 -m pip wheel --wheel-dir dist/ . - auditwheel repair dist/*.whl + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + # upload to PyPI on every tag starting with 'v' + if: github.event_name == 'push' && startsWith(github.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@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 }} - packages_dir: wheelhouse/ \ No newline at end of file +