Modernize Build System: Migrate from setup.py to CMake + scikit-build-core (#126) #31
This file contains hidden or 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
| # This workflow will install Python dependencies, build simuPOP, and run tests | |
| # across multiple platforms (Linux, macOS, Windows) and Python versions. | |
| name: simuPOP CI | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y swig zlib1g-dev cmake ninja-build | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build scikit-build-core cmake ninja | |
| pip install -r requirements.txt | |
| - name: Build and install simuPOP | |
| run: pip install -v . | |
| - name: Run tests (short allele type) | |
| run: python ./test/run_tests.py short -j2 | |
| - name: Run tests (binary allele type) | |
| run: python ./test/run_tests.py binary -j2 | |
| build-macos: | |
| runs-on: macos-latest | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install system dependencies | |
| run: | | |
| brew install swig libomp cmake ninja | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build scikit-build-core cmake ninja | |
| pip install -r requirements.txt | |
| - name: Build and install simuPOP | |
| env: | |
| # Help CMake find libomp on macOS | |
| OpenMP_ROOT: /opt/homebrew/opt/libomp | |
| run: pip install -v . | |
| - name: Run tests (short allele type) | |
| run: python ./test/run_tests.py short -j2 | |
| - name: Run tests (binary allele type) | |
| run: python ./test/run_tests.py binary -j2 | |
| build-windows: | |
| runs-on: windows-latest | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install SWIG | |
| run: choco install swig -y | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build scikit-build-core cmake ninja | |
| pip install -r requirements.txt | |
| - name: Build and install simuPOP | |
| run: pip install -v . | |
| - name: Run tests (short allele type) | |
| run: python ./test/run_tests.py short -j2 | |
| - name: Run tests (binary allele type) | |
| run: python ./test/run_tests.py binary -j2 | |
| # Full test suite on Linux (all allele types) | |
| full-tests-linux: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| needs: build-linux | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y swig zlib1g-dev cmake ninja-build | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build scikit-build-core cmake ninja | |
| pip install -r requirements.txt | |
| - name: Build and install simuPOP | |
| run: pip install -v . | |
| - name: Run all tests | |
| run: python ./test/run_tests.py |