Skip to content

Commit edb4239

Browse files
authored
Refreshing the lib slightly. (#52)
* Refreshing the lib slightly. * Update audit check. * Default action. * Installing openssl * Apt-get ? * ? * okk. * Monkey * Build ? * ? * Libatomic. * Big endian. * Libatomic dev? * .. * Free threaded fixes ?
1 parent 94dc76b commit edb4239

File tree

7 files changed

+767
-498
lines changed

7 files changed

+767
-498
lines changed

.github/workflows/CI.yml

Lines changed: 114 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is autogenerated by maturin v1.4.0
1+
# This file is autogenerated by maturin v1.7.8
22
# To update, run
33
#
44
# maturin generate-ci github
@@ -20,128 +20,168 @@ permissions:
2020

2121
jobs:
2222
linux:
23-
runs-on: ubuntu-latest
23+
runs-on: ${{ matrix.platform.runner }}
2424
strategy:
2525
matrix:
26-
# target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
27-
target: [x86_64, x86]
26+
platform:
27+
- runner: ubuntu-22.04
28+
target: x86_64
29+
- runner: ubuntu-22.04
30+
target: x86
31+
- runner: ubuntu-22.04
32+
target: aarch64
33+
- runner: ubuntu-22.04
34+
target: armv7
35+
# - runner: ubuntu-22.04
36+
# target: s390x
37+
- runner: ubuntu-22.04
38+
target: ppc64le
2839
steps:
2940
- uses: actions/checkout@v4
3041
- uses: actions/setup-python@v5
3142
with:
32-
python-version: '3.10'
43+
python-version: 3.x
3344
- name: Build wheels
3445
uses: PyO3/maturin-action@v1
3546
with:
36-
target: ${{ matrix.target }}
37-
args: --release --out dist --find-interpreter
47+
target: ${{ matrix.platform.target }}
48+
args: --release --out dist
49+
sccache: 'true'
50+
manylinux: auto
51+
before-script-linux: |
52+
if command -v apt-get &> /dev/null; then
53+
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
54+
elif command -v yum &> /dev/null; then
55+
yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y
56+
else
57+
echo "Neither apt-get nor yum is installed. Please install a package manager."
58+
exit 1
59+
fi
60+
- name: Build free-threaded wheels
61+
uses: PyO3/maturin-action@v1
62+
with:
63+
target: ${{ matrix.platform.target }}
64+
args: --release --out dist -i python3.13t
3865
sccache: 'true'
3966
manylinux: auto
40-
before-script-linux: "yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y"
67+
before-script-linux: |
68+
if command -v apt-get &> /dev/null; then
69+
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
70+
elif command -v yum &> /dev/null; then
71+
yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y
72+
else
73+
echo "Neither apt-get nor yum is installed. Please install a package manager."
74+
exit 1
75+
fi
4176
- name: Upload wheels
4277
uses: actions/upload-artifact@v4
4378
with:
44-
name: "wheels-linux-${{ matrix.target }}"
79+
name: wheels-linux-${{ matrix.platform.target }}
4580
path: dist
4681

47-
linux2:
48-
runs-on: ubuntu-latest
82+
musllinux:
83+
runs-on: ${{ matrix.platform.runner }}
4984
strategy:
5085
matrix:
51-
# target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
52-
target: [aarch64, armv7, ppc64le]
86+
platform:
87+
- runner: ubuntu-22.04
88+
target: x86_64
89+
- runner: ubuntu-22.04
90+
target: x86
91+
- runner: ubuntu-22.04
92+
target: aarch64
93+
- runner: ubuntu-22.04
94+
target: armv7
5395
steps:
5496
- uses: actions/checkout@v4
5597
- uses: actions/setup-python@v5
5698
with:
57-
python-version: '3.10'
99+
python-version: 3.x
58100
- name: Build wheels
59101
uses: PyO3/maturin-action@v1
60102
with:
61-
target: ${{ matrix.target }}
62-
args: --release --out dist -i python3.7 -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12
103+
target: ${{ matrix.platform.target }}
104+
args: --release --out dist
63105
sccache: 'true'
64-
manylinux: auto
65-
before-script-linux: "apt-get update && apt-get install libssl-dev -y"
106+
manylinux: musllinux_1_2
107+
- name: Build free-threaded wheels
108+
uses: PyO3/maturin-action@v1
109+
with:
110+
target: ${{ matrix.platform.target }}
111+
args: --release --out dist -i python3.13t
112+
sccache: 'true'
113+
manylinux: musllinux_1_2
66114
- name: Upload wheels
67115
uses: actions/upload-artifact@v4
68116
with:
69-
name: "wheels-linux2-${{ matrix.target }}"
117+
name: wheels-musllinux-${{ matrix.platform.target }}
70118
path: dist
71119

72120
windows:
73-
runs-on: windows-latest
121+
runs-on: ${{ matrix.platform.runner }}
74122
strategy:
75123
matrix:
76-
target: [x64, x86]
124+
platform:
125+
- runner: windows-latest
126+
target: x64
127+
- runner: windows-latest
128+
target: x86
77129
steps:
78130
- uses: actions/checkout@v4
79131
- uses: actions/setup-python@v5
80132
with:
81-
python-version: '3.10'
82-
architecture: ${{ matrix.target }}
133+
python-version: 3.x
134+
architecture: ${{ matrix.platform.target }}
83135
- name: Build wheels
84136
uses: PyO3/maturin-action@v1
85137
with:
86-
target: ${{ matrix.target }}
87-
args: --release --out dist --find-interpreter
138+
target: ${{ matrix.platform.target }}
139+
args: --release --out dist
88140
sccache: 'true'
141+
# - name: Build free-threaded wheels
142+
# uses: PyO3/maturin-action@v1
143+
# with:
144+
# target: ${{ matrix.platform.target }}
145+
# args: --release --out dist -i python3.13t
146+
# sccache: 'true'
89147
- name: Upload wheels
90148
uses: actions/upload-artifact@v4
91149
with:
92-
name: "wheels-windows-${{ matrix.target }}"
150+
name: wheels-windows-${{ matrix.platform.target }}
93151
path: dist
94152

95153
macos:
96-
runs-on: macos-latest
154+
runs-on: ${{ matrix.platform.runner }}
97155
strategy:
98156
matrix:
99-
target: [x86_64, aarch64]
157+
platform:
158+
- runner: macos-13
159+
target: x86_64
160+
- runner: macos-14
161+
target: aarch64
100162
steps:
101163
- uses: actions/checkout@v4
102164
- uses: actions/setup-python@v5
103165
with:
104-
python-version: '3.10'
166+
python-version: 3.x
105167
- name: Build wheels
106168
uses: PyO3/maturin-action@v1
107169
with:
108-
target: ${{ matrix.target }}
109-
args: --release --out dist --find-interpreter
170+
target: ${{ matrix.platform.target }}
171+
args: --release --out dist
172+
sccache: 'true'
173+
- name: Build free-threaded wheels
174+
uses: PyO3/maturin-action@v1
175+
with:
176+
target: ${{ matrix.platform.target }}
177+
args: --release --out dist -i python3.13t
110178
sccache: 'true'
111179
- name: Upload wheels
112180
uses: actions/upload-artifact@v4
113181
with:
114-
name: "wheels-macos-${{ matrix.target }}"
182+
name: wheels-macos-${{ matrix.platform.target }}
115183
path: dist
116184

117-
tests:
118-
runs-on: ubuntu-latest
119-
steps:
120-
- uses: actions/checkout@v4
121-
- uses: actions/checkout@v4
122-
with:
123-
repository: huggingface/huggingface_hub
124-
path: huggingface_hub
125-
- uses: actions/setup-python@v5
126-
with:
127-
python-version: '3.10'
128-
- name: Create venv
129-
run: python3 -m venv .venv
130-
- name: Build wheels
131-
uses: PyO3/maturin-action@v1
132-
with:
133-
command: develop
134-
sccache: 'true'
135-
- name: Install huggingface_hub dependencies
136-
run: |
137-
source .venv/bin/activate
138-
python3 -m pip install -e 'huggingface_hub[testing]'
139-
- name: Run tests
140-
run: |
141-
source .venv/bin/activate
142-
HF_HUB_ENABLE_HF_TRANSFER=1 pytest huggingface_hub/tests/test_file_download.py
143-
HF_HUB_ENABLE_HF_TRANSFER=1 pytest huggingface_hub/tests/test_hf_api.py -k 'test_upload_lfs_file_multipart'
144-
145185
sdist:
146186
runs-on: ubuntu-latest
147187
steps:
@@ -160,53 +200,26 @@ jobs:
160200
release:
161201
name: Release
162202
runs-on: ubuntu-latest
163-
if: "startsWith(github.ref, 'refs/tags/')"
164-
needs: [linux, windows, macos, sdist]
203+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
204+
needs: [linux, musllinux, windows, macos, sdist]
205+
permissions:
206+
# Use to sign the release artifacts
207+
id-token: write
208+
# Used to upload release artifacts
209+
contents: write
210+
# Used to generate artifact attestation
211+
attestations: write
165212
steps:
166213
- uses: actions/download-artifact@v4
167-
name: download linux x86_64 artifacts
168-
with:
169-
name: wheels-linux-x86_64
170-
- uses: actions/download-artifact@v4
171-
name: download linux x86 artifacts
172-
with:
173-
name: wheels-linux-x86
174-
- uses: actions/download-artifact@v4
175-
name: download linux2 aarch64 artifacts
176-
with:
177-
name: wheels-linux2-aarch64
178-
- uses: actions/download-artifact@v4
179-
name: download linux2 armv7 artifacts
180-
with:
181-
name: wheels-linux2-armv7
182-
- uses: actions/download-artifact@v4
183-
name: download linux2 ppc64le artifacts
214+
- name: Generate artifact attestation
215+
uses: actions/attest-build-provenance@v1
184216
with:
185-
name: wheels-linux2-ppc64le
186-
- uses: actions/download-artifact@v4
187-
name: download macos x86_64 artifacts
188-
with:
189-
name: wheels-macos-x86_64
190-
- uses: actions/download-artifact@v4
191-
name: download macos aarch64 artifacts
192-
with:
193-
name: wheels-macos-aarch64
194-
- uses: actions/download-artifact@v4
195-
name: download windows x64 artifacts
196-
with:
197-
name: wheels-windows-x64
198-
- uses: actions/download-artifact@v4
199-
name: download windows x86 artifacts
200-
with:
201-
name: wheels-windows-x86
202-
- uses: actions/download-artifact@v4
203-
name: download sdist artifacts
204-
with:
205-
name: wheels-sdist
217+
subject-path: 'wheels-*/*'
206218
- name: Publish to PyPI
219+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
207220
uses: PyO3/maturin-action@v1
208221
env:
209222
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
210223
with:
211224
command: upload
212-
args: --non-interactive --skip-existing *
225+
args: --non-interactive --skip-existing wheels-*/*

.github/workflows/audit.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1-
name: Audit
2-
on: push
1+
name: "Audit Dependencies"
2+
on:
3+
push:
4+
paths:
5+
# Run if workflow changes
6+
- '.github/workflows/audit.yml'
7+
# Run on changed dependencies
8+
- '**/Cargo.toml'
9+
- '**/Cargo.lock'
10+
# Run if the configuration file changes
11+
- '**/audit.toml'
12+
# Rerun periodicly to pick up new advisories
13+
schedule:
14+
- cron: '0 0 * * *'
15+
# Run manually
16+
workflow_dispatch:
17+
318
jobs:
4-
build:
19+
audit:
520
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
issues: write
624
steps:
7-
- uses: actions/checkout@v3
8-
- name: Audit
9-
uses: actions-rs/cargo@v1
10-
with:
11-
command: audit
25+
- uses: actions/checkout@v4
26+
- uses: actions-rust-lang/audit@v1
27+
name: Audit Rust Dependencies

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
tags:
9+
- '*'
10+
pull_request:
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
tests:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v4
22+
with:
23+
repository: huggingface/huggingface_hub
24+
path: huggingface_hub
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.10'
28+
- name: Create venv
29+
run: python3 -m venv .venv
30+
- name: Build wheels
31+
uses: PyO3/maturin-action@v1
32+
with:
33+
command: develop
34+
sccache: 'true'
35+
- name: Install huggingface_hub dependencies
36+
run: |
37+
source .venv/bin/activate
38+
python3 -m pip install -e 'huggingface_hub[testing]'
39+
- name: Run tests
40+
run: |
41+
source .venv/bin/activate
42+
HF_HUB_ENABLE_HF_TRANSFER=1 pytest huggingface_hub/tests/test_file_download.py
43+
HF_HUB_ENABLE_HF_TRANSFER=1 pytest huggingface_hub/tests/test_hf_api.py -k 'test_upload_lfs_file_multipart'

0 commit comments

Comments
 (0)