lxml #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lxml | |
on: | |
workflow_dispatch: | |
inputs: | |
app_version: | |
description: 'Build version' | |
required: true | |
default: 'latest' | |
build_manylinux: | |
description: 'Build manylinux' | |
required: true | |
default: 'cp3{9,10,11,12,13}-manylinux_*' | |
build_requires: | |
description: 'Build requires' | |
required: true | |
default: 'ccache' | |
env: | |
app_name: lxml | |
app_repo: lxml/lxml | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
run: | | |
version="${{ github.event.inputs.app_version }}" | |
if [ "${{ github.event.inputs.app_version }}" == "latest" ]; then | |
version=$(curl -s https://api.github.com/repos/${{ env.app_repo }}/releases/latest | jq -r '.tag_name') | |
if [ -z "${version}" ] || [ "${version}" == "null" ]; then | |
exit 1 | |
fi | |
fi | |
version="${version/lxml-/}" | |
wget -O - https://github.com/${{ env.app_repo }}/releases/download/${{ env.app_name }}-${version}/${{ env.app_name }}-${version}.tar.gz | tar -xz --strip-components=1 | |
- name: Cache build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
/home/runner/data/cache | |
key: ${{ runner.os }}-${{ env.app_name }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.app_name }} | |
- name: Setup Cache | |
run: | | |
sudo mkdir -p /home/runner/data/cache/.cache /home/runner/data/cache/dnf | |
sudo chown -R root:docker /home/runner/data/cache | |
sudo mkdir -p /tmp/pip | |
sudo wget -O /tmp/pip/pip.conf https://github.com/loong64/buildwheel/raw/refs/heads/master/pip.conf | |
- name: Setup QEMU | |
run: docker run --rm --privileged ghcr.io/loong64/qemu-user-static --reset -p yes | |
- name: Build wheels | |
uses: loong64/cibuildwheel@main | |
env: | |
CIBW_MANYLINUX_LOONGARCH64_IMAGE: manylinux_2_38 | |
CIBW_ARCHS: loongarch64 | |
CIBW_BUILD: ${{ github.event.inputs.build_manylinux }} | |
CIBW_TEST_SKIP: "*" | |
CIBW_BEFORE_ALL_LINUX: > | |
mv /host/tmp/pip /root/.pip && | |
ln -sf /host/home/runner/data/cache/.cache /root/.cache && | |
ln -sf /host/home/runner/data/cache/dnf /var/cache/dnf && | |
yum install -y ${{ github.event.inputs.build_requires }} | |
CIBW_ENVIRONMENT_LINUX: USE_CCACHE=1 PATH="/usr/lib/ccache:${PATH}" | |
- name: Upload wheels | |
run: | | |
pip install twine | |
twine upload --repository-url https://gitlab.com/api/v4/projects/65746188/packages/pypi wheelhouse/*.whl | |
env: | |
TWINE_USERNAME: ${{ github.repository_owner }} | |
TWINE_PASSWORD: ${{ secrets.GL_TOKEN }} | |
- name: Cache permissions | |
run: | | |
sudo chown -R runner:docker /home/runner/data/cache |