Skip to content

nj inplace (#2158) #115

nj inplace (#2158)

nj inplace (#2158) #115

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
paths-ignore: ["web/**", "**.md", "README.rst"]
pull_request:
branches: [ main ]
paths-ignore: ["web/**", "**.md", "README.rst"]
env:
latest_python: "3.13"
supported_pythons: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'
miniforge_version: "23.11.0-0"
miniforge_variant: "Mambaforge"
jobs:
conf:
# This job is needed to route the global environment variables into
# a context that's available for matrix (and name, but that's unimportant)
name: Prepare Test Plan
runs-on: ubuntu-latest
outputs:
latest_python: ${{ steps.set-vars.outputs.latest_python }}
supported_pythons: ${{ steps.set-vars.outputs.supported_pythons }}
steps:
- name: Report Plan
id: set-vars
run: |
echo "latest_python=$latest_python" >> $GITHUB_OUTPUT
echo "supported_pythons=$supported_pythons" >> $GITHUB_OUTPUT
lint:
name: Lint code (${{ needs.conf.outputs.latest_python }}, ubuntu-latest)
needs: conf
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
run: |
pip install -r ci/requirements.lint.txt
conda list
- name: Run Ruff
run: |
ruff check --output-format=github .
doc:
name: Build Documentation (${{ needs.conf.outputs.latest_python }}, ubuntu-latest)
needs: ["conf", "lint"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
run: |
pip install -r ci/requirements.doc.txt
pip install .
conda list
- name: Make documentation
run: make doc
# save built documentation (HTML) for deployment
- name: Modify documentation
if: github.event_name == 'push'
run: |
python doc/suburl.py
python doc/metatag.py
python doc/editmap.py
- name: Save documentation
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: docpack
path: doc/build/html/
# full-scale test with latest Python
test-latest:
name: Test (${{ needs.conf.outputs.latest_python }}, ${{ matrix.os }})
needs: conf
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
# macos-14 and on uses Apple silicon chips (ARM-based).
# macos-13 is the last version that uses Intel chips. See:
# https://docs.github.com/en/actions/using-github-hosted-runners/
# about-github-hosted-runners/about-github-hosted-runners#standard-
# github-hosted-runners-for-public-repositories
matrix:
os: ["ubuntu-latest", "macos-13", "macos-14", "windows-latest"]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
run: |
pip install .
conda list
- name: Run unit tests
env:
WITH_COVERAGE: "TRUE"
run: make test
# upload coverage reports to Codecov (only under Linux)
- name: Generate coverage reports
if: runner.os == 'Linux'
run: |
cd ci && coverage lcov --rcfile ../.coveragerc
- name: Upload coverage reports to Codecov
if: runner.os == 'Linux'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: scikit-bio/scikit-bio
# test under AArch64 (ARM64) architecture
test-aarch64:
name: Test (${{ needs.conf.outputs.latest_python }}, qemu::aarch64-centos)
needs: conf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# setup-buildx-action uses the git context directly
# but checklist wants the .git directory
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and test for linux-aarch64
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
# ^ to use the local checkout, not the git context
file: aarch64.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
PYTHON_VERSION=${{ env.latest_python }}
# test under all combinations of environments (Python versions, operating systems, PyPI vs Conda)
test-all:
name: Test (${{ matrix.python_version }}, ${{ matrix.os }}, ${{ fromJSON('["pypi", "conda"]')[matrix.use_conda] }})
runs-on: ${{ matrix.os }}
needs: ["conf", "test-latest", "lint"]
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python_version: ${{ fromJSON(needs.conf.outputs.supported_pythons) }}
use_conda: [true, false]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python_version }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies (conda)
if: ${{ matrix.use_conda }}
run: |
conda install -q --yes -c conda-forge --file ci/conda_requirements.txt
pip install . --no-deps
conda list
- name: Install dependencies
if: ${{ !matrix.use_conda }}
run: |
pip install .
conda list
- name: Run unit tests
env:
WITH_COVERAGE: "TRUE"
run: make test
# deploy the current development documentation to the website
# only when event is push and all tests have passed
deploy-doc:
name: Deploy documentation
if: github.event_name == 'push'
needs: ["doc", "test-all", "test-aarch64"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
# load documentation built by job "doc"
- name: Load documentation
uses: actions/download-artifact@v4
with:
name: docpack
path: docpack
# checkout website repo
- name: Check out website
uses: actions/checkout@v4
with:
repository: scikit-bio/scikit-bio.github.io
path: website
ssh-key: ${{ secrets.SSH_DEPLOY_KEY }}
# synchronize documentation to website's docs/dev directory
- name: Update documentation
run: rsync -av --delete docpack/ website/docs/dev
# push website back to repo
- name: Push website
run: |
cd website
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git add -A
git commit -m "Update from ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
git push