-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (73 loc) · 2.82 KB
/
backports.zstd.yml
File metadata and controls
81 lines (73 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: build (backports.zstd)
on:
workflow_dispatch:
inputs:
version:
default: 'latest'
description: 'Package version'
type: string
required: true
schedule:
- cron: '0 17 * * *'
jobs:
build_wheels:
name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
arch: [ 'loongarch64' ]
build: [ "manylinux_", "musllinux_" ]
steps:
- name: Get Source Code
run: |
package=backports.zstd
if [ "${{ github.event_name }}" = "schedule" ]; then
version="latest"
else
version=${{ github.event.inputs.version }}
fi
if [ "$version" = "latest" ]; then
version=$(curl -sSL "https://pypi.org/pypi/${package}/json" | jq -r '.info.version')
fi
echo "Building package: ${package} version: ${version}"
echo "PIP_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/65746188/packages/pypi/simple" >> $GITHUB_ENV
check_file="${package/./_}-${version}-.*-${{ matrix.build }}.*_${{ matrix.arch }}.whl"
if curl "https://gitlab.com/api/v4/projects/65746188/packages/pypi/simple/${package/./-}" | grep -oP '(?<=>)[^<]+\.whl' | grep -q "${check_file}"; then
echo "Package ${package} ${version} already exists"
echo "BUILD=false" >> $GITHUB_ENV
exit 0
fi
full_json=$(curl -sSL "https://pypi.org/pypi/${package}/${version}/json")
download_url=$(echo "$full_json" | jq -r '.urls[] | select(.packagetype=="sdist").url')
if [ -z "$download_url" ]; then
echo "No source found for package ${package} version ${version}"
exit 1
fi
wget -O - "$download_url" | tar xz --strip-components=1
- name: Setup QEMU
if: env.BUILD != 'false'
uses: docker/setup-qemu-action@v3
- name: Build wheels
if: env.BUILD != 'false'
uses: loong64/cibuildwheel@v3.2.1
env:
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_BUILD: "*-${{ matrix.build }}${{ matrix.arch }}"
CIBW_ENABLE: "cpython-freethreading"
CIBW_ENVIRONMENT_PASS_LINUX: PIP_EXTRA_INDEX_URL RUNNER_ARCH
- name: Check wheel
run: |
ls -al wheelhouse/*.whl || exit 0
echo "upload=true" >> $GITHUB_ENV
- name: Upload wheels
if: env.upload == 'true'
run: |
pip install twine==6.0.1
for file in wheelhouse/*.whl; do
twine upload --repository-url https://gitlab.com/api/v4/projects/65746188/packages/pypi $file || true
done
env:
TWINE_USERNAME: ${{ github.repository_owner }}
TWINE_PASSWORD: ${{ secrets.GL_TOKEN }}