Skip to content

CI: fixed build and test, polished them, prepare for publishing #10

CI: fixed build and test, polished them, prepare for publishing

CI: fixed build and test, polished them, prepare for publishing #10

Workflow file for this run

name: Package
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
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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
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 tools
run: pip install ruff build twine
- 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: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04]
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: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-latest]
target: [x86_64, aarch64]
service: [memory, s3]
exclude:
- os: macos-latest
target: aarch64
include:
- os: ubuntu-24.04
target: x86_64
platform: manylinux2014
container: quay.io/pypa/manylinux2014_x86_64
- os: ubuntu-24.04
target: aarch64
platform: manylinux2014
container: quay.io/pypa/manylinux2014_aarch64
- os: macos-latest
target: x86_64
platform: native
container: ''
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
if: matrix.target == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- 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: Download main package
uses: actions/download-artifact@v3
with:
name: dist-main
path: dist/
- name: Build service package
id: build-service
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.platform }}
container: ${{ matrix.container }}
args: --release --out dist --interpreter python3.11
command: build
working-directory: crates/service-${{ matrix.service }}
- name: List dist contents
run: ls -la dist/
- name: Upload service artifact
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.service }}
path: dist/*.whl
if-no-files-found: error
verify-install:
name: Verify Installation
needs: [build-services]
runs-on: ubuntu-24.04
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: |
find dist -type f
- name: Prepare dist directory
run: |
mkdir -p dist_combined
# First copy service packages
cp -r dist/dist-${{ matrix.os }}-x86_64-memory/* dist_combined/
cp -r dist/dist-${{ matrix.os }}-x86_64-s3/* dist_combined/
# Then copy main package
cp -r dist/dist-${{ matrix.os }}-x86_64-memory/*.tar.gz dist_combined/ || true
ls -la dist_combined/
- name: Install packages in correct order
run: |
python -m pip install --upgrade pip
# First install service packages
pip install dist_combined/*service_memory*.whl
pip install dist_combined/*service_s3*.whl
# Then install main package
pip install dist_combined/opendalfs*.whl
- name: Verify imports
run: |
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
pip install dist_combined/opendalfs*.whl[all]
# Verify again
python -c "import opendalfs"
python -c "import opendalfs_service_memory"
python -c "import opendalfs_service_s3"
# 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