Skip to content

Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.13.0 in /.github/workflows #26

Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.13.0 in /.github/workflows

Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.13.0 in /.github/workflows #26

Workflow file for this run

name: PyMaSC Pre-build C Sources
on:
push:
branches: [ master, modernize-python-support ]
pull_request:
branches: [ master ]
workflow_dispatch:
workflow_call:
jobs:
prebuild-sources:
name: Generate Pre-built C Sources
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-prebuild-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-prebuild-${{ matrix.python-version }}-
${{ runner.os }}-pip-prebuild-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ make
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
# Python 3.12+ requires setuptools to be explicitly installed
if [ "${{ matrix.python-version }}" = "3.12" ] || [ "${{ matrix.python-version }}" = "3.13" ]; then
pip install setuptools wheel
fi
# Python 3.9 requires numpy<2.0 for Cython compatibility
if [ "${{ matrix.python-version }}" = "3.9" ]; then
pip install "numpy<2.0" cython
else
pip install numpy cython
fi
pip install "pysam>=0.23.2" "pyBigWig>=0.3.18"
- name: Build BitArray library
run: |
cd external/BitArray
make clean
make CC="gcc -fPIC" libbitarr.a
cd ../..
- name: Generate version-specific C sources
env:
PYTHON_VERSION: ${{ matrix.python-version }}
PYTHON_MAJOR_MINOR: ${{ matrix.python-version == '3.8' && '38' || matrix.python-version == '3.9' && '39' || matrix.python-version == '3.10' && '310' || matrix.python-version == '3.11' && '311' || matrix.python-version == '3.12' && '312' || matrix.python-version == '3.13' && '313' }}
CYTHON_VERSION_SUFFIX: _${{ matrix.python-version == '3.8' && '38' || matrix.python-version == '3.9' && '39' || matrix.python-version == '3.10' && '310' || matrix.python-version == '3.11' && '311' || matrix.python-version == '3.12' && '312' || matrix.python-version == '3.13' && '313' }}
BUILD_MODE: versioned
run: |
echo "🐍 Generating C sources for Python ${{ matrix.python-version }}..."
echo "Environment variables:"
echo " PYTHON_VERSION=$PYTHON_VERSION"
echo " PYTHON_MAJOR_MINOR=$PYTHON_MAJOR_MINOR"
echo " CYTHON_VERSION_SUFFIX=$CYTHON_VERSION_SUFFIX"
echo " BUILD_MODE=$BUILD_MODE"
echo ""
# Build using setup.py with version-specific environment variables
python setup.py build_ext --build-temp=build_${{ matrix.python-version }}
echo ""
echo "📁 Generated C sources for Python ${{ matrix.python-version }}:"
find PyMaSC -name "*_$PYTHON_MAJOR_MINOR.c" | sort
echo " Files: $(find PyMaSC -name "*_$PYTHON_MAJOR_MINOR.c" | wc -l)"
- name: Collect generated C sources for artifact
env:
PYTHON_MAJOR_MINOR: ${{ matrix.python-version == '3.8' && '38' || matrix.python-version == '3.9' && '39' || matrix.python-version == '3.10' && '310' || matrix.python-version == '3.11' && '311' || matrix.python-version == '3.12' && '312' || matrix.python-version == '3.13' && '313' }}
run: |
echo "📦 Collecting C sources for Python ${{ matrix.python-version }}..."
mkdir -p artifacts/c-sources-${{ matrix.python-version }}
find PyMaSC -name "*_$PYTHON_MAJOR_MINOR.c" | while read file; do
echo " Copying: $file"
cp "$file" artifacts/c-sources-${{ matrix.python-version }}/
done
echo ""
echo "📊 Artifact contents for Python ${{ matrix.python-version }}:"
ls -la artifacts/c-sources-${{ matrix.python-version }}/
echo "Total files: $(ls artifacts/c-sources-${{ matrix.python-version }}/ | wc -l)"
- name: Upload C sources for Python ${{ matrix.python-version }}
uses: actions/upload-artifact@v4
with:
name: prebuilt-c-sources-py${{ matrix.python-version }}
path: artifacts/c-sources-${{ matrix.python-version }}/
retention-days: 30
compression-level: 6
collect-all-sources:
name: Collect All C Sources
runs-on: ubuntu-latest
needs: prebuild-sources
steps:
- name: Download all C source artifacts
uses: actions/download-artifact@v4
with:
pattern: prebuilt-c-sources-py*
path: downloaded-sources/
merge-multiple: false
- name: Merge all C sources into single artifact
run: |
echo "📁 Merging all C sources into single artifact..."
mkdir -p artifacts/c-sources
for version_dir in downloaded-sources/prebuilt-c-sources-py*/; do
if [ -d "$version_dir" ]; then
echo " Processing: $version_dir"
cp "$version_dir"*.c artifacts/c-sources/ 2>/dev/null || true
fi
done
echo ""
echo "📊 Final merged artifact contents:"
ls -la artifacts/c-sources/
echo "Total files: $(ls artifacts/c-sources/ | wc -l)"
echo ""
echo "🔍 Files by Python version:"
for version in 38 39 310 311 312 313; do
count=$(ls artifacts/c-sources/*_${version}.c 2>/dev/null | wc -l)
echo " Python ${version}: ${count} files"
done
- name: Upload merged pre-built C sources
uses: actions/upload-artifact@v4
with:
name: prebuilt-c-sources
path: artifacts/c-sources/
retention-days: 30
compression-level: 6
- name: Create build summary
run: |
echo "# 🎉 PyMaSC Pre-built C Sources Generation Summary" > build-summary.md
echo "" >> build-summary.md
echo "## 📊 Generated Files by Python Version" >> build-summary.md
for version in 38 39 310 311 312 313; do
count=$(ls artifacts/c-sources/*_${version}.c 2>/dev/null | wc -l)
echo "- **Python ${version}**: ${count} files" >> build-summary.md
done
echo "" >> build-summary.md
echo "## 📁 Available Files" >> build-summary.md
echo '```' >> build-summary.md
ls artifacts/c-sources/ | sort >> build-summary.md
echo '```' >> build-summary.md
echo "" >> build-summary.md
echo "## ⚡ Build System Info" >> build-summary.md
echo "- **Build method**: GitHub Actions matrix with native Python environments" >> build-summary.md
echo "- **Dependencies**: No Docker/Docker Compose required" >> build-summary.md
echo "- **Artifact name**: \`prebuilt-c-sources\`" >> build-summary.md
echo "- **Retention**: 30 days" >> build-summary.md
- name: Upload build summary
uses: actions/upload-artifact@v4
with:
name: build-summary
path: build-summary.md
retention-days: 30