Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ FROM ghcr.io/astral-sh/uv:latest AS uv

FROM mcr.microsoft.com/devcontainers/base:ubuntu26.04

# install needed packages
COPY tools/packages/apt.txt tools/packages/apt-mpi.txt /tmp/packages/

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install \
&& sed -e 's/#.*//' -e 's/[[:space:]]*$//' /tmp/packages/*.txt \
| grep -v '^$' \
| xargs apt-get -y install \
clang \
clang-tidy \
clang-format \
Expand All @@ -17,12 +20,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
lcov \
ninja-build \
python3 \
openmpi-bin \
libboost-dev \
libboost-test-dev \
libhwloc-dev \
libmsgpack-cxx-dev \
libopenmpi-dev \
&& rm -rf /tmp/packages \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
Expand Down
77 changes: 77 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Set up a monoprop CI environment
description: >-
Install just, uv, and the packages listed in tools/packages/. Installs tools,
not commands: anything a developer also runs belongs in the justfile.

inputs:
python-version:
description: Python version handed to setup-uv.
required: false
default: "3.11"
cache-suffix:
description: >-
setup-uv cache key suffix. Must differ per build configuration, or a
restored cache carries a wheel built for another one.
required: true
mpi:
description: Install an MPI implementation ("on" or "off").
required: false
default: "off"

runs:
using: composite
steps:
- name: Install just
uses: extractions/setup-just@v4.0.0

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
cache-suffix: ${{ inputs.cache-suffix }}
python-version: ${{ inputs.python-version }}

- name: Install system dependencies
shell: bash
env:
MPI: ${{ inputs.mpi }}
run: |
set -euo pipefail

# macOS runners still ship bash 3.2, so no mapfile and no ${var,,}.
packages=()
add_list() {
while IFS= read -r package; do
packages+=("$package")
done < <(sed -e 's/#.*//' -e 's/[[:space:]]*$//' "$1" | grep -v '^$' || true)
}

if [[ "$RUNNER_OS" == "macOS" ]]; then
prefix=tools/packages/brew
else
prefix=tools/packages/apt
fi

add_list "$prefix.txt"
if [[ "$(printf '%s' "$MPI" | tr '[:upper:]' '[:lower:]')" =~ ^(on|true|yes|1)$ ]]; then
add_list "$prefix-mpi.txt"
fi

# Derive the package from CXX, so a matrix lane needs no list of its own.
if [[ -n "${CXX:-}" ]] && ! command -v "$CXX" > /dev/null; then
case "$CXX" in
clang++*) packages+=("clang${CXX#clang++}") ;;
g++*) packages+=("g++${CXX#g++}") ;;
*)
echo "CXX=$CXX is not installed and no package name can be derived from it" >&2
exit 2
;;
esac
fi

if [[ "$RUNNER_OS" == "macOS" ]]; then
brew install "${packages[@]}"
else
sudo apt-get update
sudo apt-get install -y "${packages[@]}"
fi
14 changes: 3 additions & 11 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,15 @@ jobs:
with:
fetch-depth: 0

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y just libopenmpi-dev openmpi-bin libboost-dev libhwloc-dev

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v10.0.1
- name: Set up the build environment
uses: ./.github/actions/setup
with:
enable-cache: true
cache-suffix: benchmark
python-version: "3.11"

- name: Install package
env:
SKBUILD_CMAKE_DEFINE: monoprop_ENABLE_CXX_UNIT_TESTS=OFF
run: |
uv sync --no-progress --group bench --all-extras -v
run: just build --group bench

- name: Run benchmarks
env:
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,11 @@ jobs:
with:
fetch-depth: 0

- name: Install dependencies from APT
run: |
sudo apt-get update
sudo apt-get install -y just libopenmpi-dev openmpi-bin libboost-dev libboost-test-dev libmsgpack-cxx-dev libhwloc-dev

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v10.0.1
- name: Set up the build environment
uses: ./.github/actions/setup
with:
enable-cache: true
cache-suffix: copilot
python-version: "3.11"
mpi: "on"

- name: Install package
run: |
uv sync --all-groups --all-extras -v
run: just build --all-groups
17 changes: 3 additions & 14 deletions .github/workflows/docpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,10 @@ jobs:
# grab the history of the PR, so setuptools-scm can compute the correct version number
fetch-depth: 0

- name: Install dependencies from APT
run: |
sudo apt-get update
sudo apt-get install -y just libopenmpi-dev openmpi-bin libboost-dev libboost-test-dev libmsgpack-cxx-dev libhwloc-dev

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v10.0.1
- name: Set up the build environment
uses: ./.github/actions/setup
with:
enable-cache: true
cache-suffix: documentation
python-version: "3.11"

- name: Set up Node.js
uses: actions/setup-node@v7.0.0
Expand All @@ -74,11 +67,7 @@ jobs:
- name: Check built docs links (including external)
uses: lycheeverse/lychee-action@v2
with:
args: >-
--config .lychee.postbuild.toml --no-progress
--root-dir ${{ github.workspace }}/docs/out
--fallback-extensions html
'docs/out/**/*.html'
args: "--config .lychee.postbuild.toml 'docs/out/**/*.html'"
fail: true

- name: Setup Pages
Expand Down
Loading
Loading