-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: fixed build and test, polished them, prepare for publishing #20
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a4222ad
elide the unnecessary lifetimes
wey-gu 02d15f8
ci: fix test workflow
wey-gu 6df1af3
fix ci to run pyo3 build within venv
wey-gu 328ecd0
polish pyproject.toml
wey-gu 0bd1ee2
add missing dep for test
wey-gu cc05556
fix build with setuptools
wey-gu 8f9e64c
refine ci workflow
wey-gu 5011f66
chore: badges of ci and discussions
wey-gu 991ae56
refine package.yml
wey-gu 2b6e0e9
better build and packaging ci
wey-gu 3133acb
use manylinux container for pyo3 build
wey-gu 8b3237a
ensure verification of built artifacts
wey-gu 96937f6
fix main and service build tests
wey-gu f8a1016
final fixes
wey-gu 9f88d1f
fix verify install steps... again
wey-gu 1ede2ca
final polishment
wey-gu 5e91cb6
fixed pyo3 build whl upload
wey-gu 0cb6f18
chore: update contribution doc
wey-gu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,288 @@ | ||
name: Package | ||
|
||
# This workflow handles: | ||
# 1. Code quality checks for both Rust and Python | ||
# 2. Building the main Python package | ||
# 3. Building Rust service extensions (memory, s3) | ||
# 4. Verifying package installation and imports | ||
# Future: PyPI publishing on tags | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**/*.md' | ||
- '**/*.rst' | ||
- 'docs/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**/*.md' | ||
- '**/*.rst' | ||
- 'docs/**' | ||
|
||
jobs: | ||
check-rust: | ||
name: Rust Checks | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache Rust dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Check format | ||
run: cargo fmt --all -- --check | ||
|
||
- name: Check clippy | ||
run: cargo clippy --all-targets --all-features -- -D warnings | ||
|
||
check-python: | ||
name: Python Checks | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dev dependencies | ||
run: pip install -e ".[dev]" | ||
|
||
- name: Check format | ||
run: ruff format . --check | ||
|
||
- name: Check style | ||
run: ruff check . | ||
|
||
build-main: | ||
name: Build Main Package | ||
needs: [check-rust, check-python] | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Create dist directory | ||
run: mkdir -p dist | ||
|
||
- name: Build main package | ||
run: | | ||
python -m pip install --upgrade pip build | ||
python -m build --outdir dist/ | ||
|
||
- name: List dist contents | ||
run: ls -la dist/ | ||
|
||
- name: Upload main artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist-main | ||
path: dist/* | ||
if-no-files-found: error | ||
|
||
build-services: | ||
name: Build Service Packages | ||
needs: [build-main] | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-24.04] | ||
target: [x86_64] | ||
service: [memory, s3] | ||
exclude: | ||
- os: ubuntu-24.04 | ||
target: aarch64 | ||
include: | ||
- os: ubuntu-24.04 | ||
target: x86_64 | ||
platform: manylinux2014 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install build dependencies | ||
run: pip install maturin | ||
|
||
- name: Build service package | ||
id: build-service | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
manylinux: ${{ matrix.platform }} | ||
container: quay.io/pypa/manylinux2014_x86_64 | ||
args: --release --out dist --interpreter python3.11 | ||
command: build | ||
working-directory: crates/service-${{ matrix.service }} | ||
|
||
- name: List all wheels | ||
run: | | ||
echo "=== All wheel locations ===" | ||
find . -name "*.whl" -exec ls -l {} \; | ||
echo "=== Service directory contents ===" | ||
ls -la crates/service-${{ matrix.service }}/dist/ | ||
|
||
- name: Upload service artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.service }} | ||
path: crates/service-${{ matrix.service }}/dist/*.whl | ||
if-no-files-found: error | ||
|
||
verify-install: | ||
name: Verify Installation | ||
needs: [build-services] | ||
runs-on: ubuntu-24.04 | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Download all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: dist | ||
|
||
- name: List downloaded artifacts | ||
run: | | ||
echo "=== All artifacts ===" | ||
find dist -type f | ||
echo "=== Service artifacts ===" | ||
find dist/dist-ubuntu-24.04-x86_64-memory dist/dist-ubuntu-24.04-x86_64-s3 -type f | ||
|
||
- name: Prepare dist directory | ||
run: | | ||
mkdir -p dist_combined | ||
# Copy service wheels first (only cp311 wheels) | ||
cp dist/dist-ubuntu-24.04-x86_64-memory/*cp311*.whl dist_combined/ | ||
cp dist/dist-ubuntu-24.04-x86_64-s3/*cp311*.whl dist_combined/ | ||
# Copy main package | ||
cp dist/dist-main/*.whl dist_combined/ | ||
cp dist/dist-main/*.tar.gz dist_combined/ | ||
echo "=== Contents of dist_combined ===" | ||
ls -la dist_combined/ | ||
|
||
- name: Install packages in correct order | ||
run: | | ||
python -m pip install --upgrade pip | ||
echo "=== Installing service packages ===" | ||
# Install memory service (only cp311 wheels) | ||
for whl in dist_combined/opendalfs_service_memory*cp311*.whl; do | ||
if [ -f "$whl" ]; then | ||
echo "Installing memory service: $whl" | ||
pip install "$whl" | ||
fi | ||
done | ||
# Install s3 service (only cp311 wheels) | ||
for whl in dist_combined/opendalfs_service_s3*cp311*.whl; do | ||
if [ -f "$whl" ]; then | ||
echo "Installing s3 service: $whl" | ||
pip install "$whl" | ||
fi | ||
done | ||
echo "=== Installing main package ===" | ||
pip install dist_combined/opendalfs-*.whl | ||
|
||
- name: Verify imports | ||
run: | | ||
echo "=== Installed packages ===" | ||
pip list | grep opendalfs | ||
echo "=== Verifying imports ===" | ||
python -c "import opendalfs" | ||
python -c "import opendalfs_service_memory" | ||
python -c "import opendalfs_service_s3" | ||
|
||
- name: Test full installation | ||
run: | | ||
# Clean previous installation | ||
pip uninstall -y opendalfs opendalfs_service_memory opendalfs_service_s3 | ||
# Install with all extras (use exact filename) | ||
echo "=== Installing with all extras ===" | ||
# First install service packages | ||
for whl in dist_combined/opendalfs_service_*manylinux_2_17*.whl; do | ||
if [ -f "$whl" ]; then | ||
echo "Installing service: $whl" | ||
pip install "$whl" | ||
fi | ||
done | ||
# Then install main package with all extras | ||
MAIN_WHEEL=$(find dist_combined -name "opendalfs-*.whl") | ||
echo "Installing main package with extras: $MAIN_WHEEL" | ||
pip install "$MAIN_WHEEL[all]" | ||
# Verify imports | ||
echo "=== Verifying imports ===" | ||
python -c "import opendalfs" | ||
python -c "import opendalfs_service_memory" | ||
python -c "import opendalfs_service_s3" | ||
|
||
- name: Cleanup | ||
if: always() | ||
run: | | ||
pip uninstall -y opendalfs opendalfs_service_memory opendalfs_service_s3 || true | ||
rm -rf dist dist_combined | ||
|
||
# PyPI publishing job (commented out for future use) | ||
# publish: | ||
# name: Publish to PyPI | ||
# needs: verify-install | ||
# runs-on: ubuntu-24.04 | ||
# # Only run on tags | ||
# if: startsWith(github.ref, 'refs/tags/') | ||
# | ||
# steps: | ||
# - name: Download all artifacts | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# path: dist | ||
# | ||
# - name: Prepare dist directory | ||
# run: | | ||
# mkdir -p dist_combined | ||
# cp -r dist/*/* dist_combined/ | ||
# | ||
# - name: Publish to PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# password: ${{ secrets.PYPI_API_TOKEN }} | ||
# packages-dir: dist_combined/ | ||
# | ||
# Required secrets for PyPI publishing: | ||
# - PYPI_API_TOKEN: API token from PyPI | ||
# Get it from: https://pypi.org/manage/account/token/ | ||
# Add it to: https://github.com/fsspec/opendalfs/settings/secrets/actions |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use github OIDC for package uploads (so we don't need static tokens): https://github.com/apache/opendal/blob/6ca3eabc0cc5ad2b5e123acc215b62329bbdbf18/.github/workflows/release_python.yml#L105-L130
We can also upload to https://test.pypi.org/legacy/ to test and verify.
But I believe they are good to have in the future and not a blocker of merging this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracked at #21