Update to cross-platform-actions/action v1.1-style usage #590
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
| name: CI | |
| on: [push, pull_request] | |
| jobs: | |
| direct: | |
| runs-on: ${{ matrix.os }}-latest | |
| strategy: | |
| matrix: | |
| os: [ubuntu, macos] | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] | |
| exclude: | |
| # Avoid spurious "upgrade pip" error annotation | |
| - os: macos | |
| python-version: 3.8 | |
| steps: | |
| - name: Checkout pysam | |
| uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install prerequisite Python libraries | |
| run: pip install Cython mypy pytest setuptools | |
| - name: Install Linux build prerequisites | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -q --no-install-recommends --no-install-suggests libbz2-dev libcurl4-openssl-dev liblzma-dev | |
| - name: Update macOS build prerequisites | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew unlink xz || true # Remove brewed liblzma as it is not multiarch | |
| - name: Build (directly from checkout) | |
| run: python setup.py build | |
| - name: Install test prerequisites | |
| run: | | |
| case $RUNNER_OS in | |
| Linux) | |
| sudo apt-get install -q --no-install-recommends --no-install-suggests samtools bcftools tabix | |
| ;; | |
| macOS) | |
| brew install -q samtools bcftools | |
| ;; | |
| esac | |
| - name: Run tests | |
| run: | | |
| export PYTHONPATH=$(echo $GITHUB_WORKSPACE/build/lib.*) | |
| export REF_PATH=':' | |
| pytest | |
| - name: Install documentation prerequisites | |
| id: doc_prereqs | |
| if: runner.os == 'linux' && matrix.python-version == '3.14' | |
| run: pip install sphinx sphinx-rtd-theme | |
| - name: Build documentation (on selected configurations) | |
| id: doc_build | |
| if: steps.doc_prereqs.outcome == 'success' | |
| run: make -C doc html | |
| - name: Upload documentation artifact | |
| if: steps.doc_build.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: htmldocs | |
| path: doc/_build/html | |
| retention-days: 7 | |
| system: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: freebsd | |
| version: "15.0" | |
| python-version: "3.11" | |
| - os: netbsd | |
| version: "10.1" | |
| python-version: "3.14" | |
| defaults: | |
| run: | |
| shell: cpa.sh {0} # Run shell steps on the BSD VM | |
| env: | |
| MAKE: "gmake" | |
| PYSAM_FIX_CFLAGS: "1" | |
| python: "python${{ matrix.python-version }}" | |
| pytest: "pytest-${{ matrix.python-version }}" | |
| steps: | |
| - name: Checkout pysam | |
| uses: actions/checkout@v6 | |
| - name: Build and test on ${{ matrix.os }} | |
| uses: cross-platform-actions/action@v1 | |
| with: | |
| operating_system: ${{ matrix.os }} | |
| version: ${{ matrix.version }} | |
| environment_variables: MAKE PYSAM_FIX_CFLAGS python pytest | |
| - name: Install prerequisites | |
| run: sudo devtools/install-prerequisites.sh $PWD/devtools/emulate-tools.py /usr/local/bin | |
| - name: Build (directly from checkout) | |
| run: $python setup.py build | |
| - name: Run tests | |
| run: PYTHONPATH="$(echo $PWD/build/lib.*)" REF_PATH=":" $pytest | |
| sdist: | |
| runs-on: ${{ matrix.os }}-latest | |
| strategy: | |
| matrix: | |
| os: [ubuntu, macos] | |
| python-version: ['3.14'] | |
| steps: | |
| - name: Checkout pysam | |
| uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install prerequisite Python libraries | |
| run: pip install Cython mypy pytest setuptools | |
| - name: Install build prerequisites | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -q --no-install-recommends --no-install-suggests libbz2-dev libcurl4-openssl-dev liblzma-dev | |
| - name: Create source distribution | |
| run: python setup.py sdist --owner=root --group=root | |
| - name: Build (via sdist tarball) | |
| run: pip install --verbose --no-deps --no-binary=':all:' pysam-*.tar.gz | |
| working-directory: dist | |
| - name: Install test prerequisites | |
| run: | | |
| case $RUNNER_OS in | |
| Linux) | |
| sudo apt-get install -q --no-install-recommends --no-install-suggests samtools bcftools tabix | |
| ;; | |
| macOS) | |
| brew install -q samtools bcftools | |
| ;; | |
| esac | |
| - name: Run tests | |
| run: REF_PATH=':' pytest | |
| - name: Upload sdist tarball | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sdist | |
| path: dist/pysam-*.tar.gz | |
| retention-days: 14 | |
| conda: | |
| timeout-minutes: 20 | |
| runs-on: ${{ matrix.os }}-latest | |
| strategy: | |
| matrix: | |
| os: [ubuntu] | |
| python-version: ['3.13'] | |
| defaults: | |
| run: | |
| shell: bash -el {0} # needed for conda activation | |
| env: | |
| HTSLIB_CONFIGURE_OPTIONS: "--disable-libcurl" | |
| steps: | |
| - name: Checkout pysam | |
| uses: actions/checkout@v6 | |
| - name: Set up Conda and Python ${{ matrix.python-version }} | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| channels: conda-forge,bioconda | |
| channel-priority: strict | |
| conda-remove-defaults: true | |
| python-version: ${{ matrix.python-version }} | |
| environment-file: devtools/environment-dev.yaml | |
| - name: Build (directly from checkout) | |
| run: python setup.py install | |
| - name: Install test prerequisites via Conda | |
| run: conda install "samtools>=1.11" "bcftools>=1.11" "htslib>=1.11" pytest | |
| - name: Run tests | |
| run: REF_PATH=':' pytest |