Skip to content

Commit

Permalink
CI fix for artifacts (#447)
Browse files Browse the repository at this point in the history
* Use different names in uploading artifacts

* Add missing dollar signs for github variables and test release

* Test unzip to a given directory

* Always download

* Escape for unzip

* Download in a separate folder

* Bump version to 0.8.0b3

* Link with C++

* Build Linux only

* CI fix

* Reenable macOS

* Update build-and-test.yaml

* Reenable PyPI publish
  • Loading branch information
lexiforest authored Nov 29, 2024
1 parent a446fe7 commit 7d6b43a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 48 deletions.
107 changes: 60 additions & 47 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,82 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: |
pip install mypy ruff
make lint
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: |
pip install mypy ruff
make lint
sdist:
name: Build sdist wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: build sdist
run: |
make preprocess
pip install build
python -m build --sdist
pip install ./dist/*.tar.gz
- name: build sdist
run: |
make preprocess
pip install build
python -m build --sdist
pip install ./dist/*.tar.gz
- name: upload artifacts
uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact/issues/478
with:
path: ./dist/*.tar.gz
overwrite: true
- name: upload artifacts
uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact/issues/478
with:
name: curl_cffi-${{ github.sha }}-sdist.zip
path: ./dist/*.tar.gz

bdist:
name: Build bdist wheels and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12, macos-14, windows-2019]
# os: [ubuntu-22.04, macos-12, macos-14, windows-2019]
os: [ubuntu-22.04, macos-12, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all

- if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
# macOS make is too old
- if: runner.os == 'macOS'
run: |
brew install make automake libtool
# macOS make is too old
- if: runner.os == 'macOS'
run: |
brew install make automake libtool
- name: Build and test wheels
uses: pypa/[email protected]

- name: Build and test wheels
uses: pypa/[email protected]
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact/issues/478
with:
name: curl_cffi-${{ github.sha }}-${{ matrix.os }}.zip
path: ./wheelhouse/*.whl

- uses: actions/[email protected] # https://github.com/actions/upload-artifact/issues/478
with:
pattern: curl_cffi-*
path: download

# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- run: |
ls download
unzip download/\*.zip -d download
ls -al download
- uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact/issues/478
with:
path: ./wheelhouse/*.whl
overwrite: true
upload_all:
needs: [bdist, sdist]
Expand All @@ -91,18 +103,19 @@ jobs:
- uses: actions/[email protected] # https://github.com/actions/upload-artifact/issues/478
if: startsWith(github.ref, 'refs/tags/')
with:
name: artifact
path: dist
pattern: curl_cffi-*
path: download

- uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: download/

- name: Upload release files
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
./dist/*.whl
./dist/*.tar.gz
./download/*.whl
./download/*.tar.gz
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "curl_cffi"
version = "0.8.0b2"
version = "0.8.0b3"
authors = [{ name = "Lyonnet", email = "[email protected]" }]
description = "libcurl ffi bindings for Python, with impersonation support."
license = { file = "LICENSE" }
Expand Down
1 change: 1 addition & 0 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def get_curl_libraries():
str(root_dir / "ffi/shim.c"),
],
extra_compile_args=(["-Wno-implicit-function-declaration"] if system == "Darwin" else []),
extra_link_args=(["-lstdc++"]),
)

with open(root_dir / "ffi/cdef.c") as f:
Expand Down

0 comments on commit 7d6b43a

Please sign in to comment.