n°6 #39
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
name: Python CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout repository with submodules | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# Step 2: Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
# Step 3: Install build tools and dependencies | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel setuptools_scm build | |
# Step 4: Install pybind11 and system dependencies (e.g., jansson) | |
- name: Install pybind11 and system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libjansson-dev | |
pip install pybind11 | |
# Step 5: Patch pyproject.toml for libbdsg | |
- name: Patch pyproject.toml for libbdsg | |
run: | | |
git clone --recursive https://github.com/vgteam/libbdsg.git | |
cd libbdsg | |
echo "[build-system]" > pyproject.toml | |
echo "requires = ['setuptools', 'wheel', 'setuptools_scm']" >> pyproject.toml | |
echo "build-backend = 'setuptools.build_meta'" >> pyproject.toml | |
echo "[tool.setuptools_scm]" >> pyproject.toml | |
echo "version_scheme = 'guess-next-dev'" >> pyproject.toml | |
echo "local_scheme = 'node-and-date'" >> pyproject.toml | |
cd .. | |
# Step 6: Clean up the libbdsg directory to avoid git clone errors | |
- name: Clean up libbdsg directory if it exists | |
run: | | |
if [ -d "libbdsg" ]; then | |
rm -rf libbdsg | |
fi | |
# Step 7: Build and install libbdsg | |
- name: Build and install libbdsg | |
run: | | |
git clone --recursive https://github.com/vgteam/libbdsg.git | |
cd libbdsg | |
python -m build # Use modern build process | |
pip install dist/*.whl # Install the built wheel | |
cd .. | |
# Step 8: Install other dependencies | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
# Step 9: Run tests | |
- name: Run tests | |
run: pytest |