Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

Commit 04f3747

Browse files
committed
Add Solstice CI workflow with per-OS setup scripts
- Introduced `.solstice/workflow.kdl` for defining Solstice CI workflows, including Linux and illumos builds. - Added `setup-linux.sh` and `setup-illumos.sh` scripts for per-OS environment preparation. - Implemented `job.sh` as a legacy script hook for additional build steps.
1 parent e1ce390 commit 04f3747

4 files changed

Lines changed: 156 additions & 0 deletions

File tree

.solstice/job.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
# Solstice CI legacy job script.
4+
# NOTE: All environment and package setup is handled by per-OS setup scripts
5+
# referenced in .solstice/workflow.kdl and executed by the workflow runner.
6+
# This script intentionally contains no setup logic.
7+
8+
log() { printf "[job] %s\n" "$*" >&2; }
9+
10+
main() {
11+
# Keep a minimal representative build as a legacy hook. The workflow steps
12+
# already perform fmt/clippy/build/test; this is safe to remove later.
13+
log "building workflow-runner"
14+
cargo build --release || cargo build
15+
log "done"
16+
}
17+
18+
main "$@"

.solstice/setup-illumos.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
# Solstice CI per-OS environment prepare (illumos / SunOS)
4+
# Installs baseline tools (curl, git, gtar, compilers, rust) where possible.
5+
6+
log() { printf "[setup-illumos] %s\n" "$*" >&2; }
7+
8+
install_packages() {
9+
if command -v pkg >/dev/null 2>&1; then
10+
# OpenIndiana / IPS
11+
sudo pkg refresh || true
12+
# Prefer GNU tar (gtar) to match runner expectations
13+
sudo pkg install -v \
14+
web/curl \
15+
developer/build/gnu-make \
16+
developer/gcc-13 \
17+
developer/protobuf \
18+
developer/clang \
19+
archiver/gnu-tar \
20+
developer/rustc || true
21+
# CA certs where package exists
22+
sudo pkg install -v web/ca-certificates || true
23+
# mozilla-rootcerts when available
24+
if command -v mozilla-rootcerts >/dev/null 2>&1; then
25+
sudo mozilla-rootcerts install || true
26+
fi
27+
elif command -v pkgin >/dev/null 2>&1; then
28+
# SmartOS/NetBSD pkgin
29+
sudo pkgin -y update || true
30+
sudo pkgin -y install curl gmake gcc protobuf clang gtar rust || true
31+
sudo pkgin -y install mozilla-rootcerts || true
32+
if command -v mozilla-rootcerts >/dev/null 2>&1; then
33+
sudo mozilla-rootcerts install || true
34+
fi
35+
else
36+
log "no known package manager found (pkg/pkgin); skipping installs"
37+
fi
38+
}
39+
40+
main() {
41+
install_packages
42+
# Prefer GNU tar on PATH when available
43+
if command -v gtar >/dev/null 2>&1 && ! command -v tar >/dev/null 2>&1; then
44+
ln -sf "$(command -v gtar)" "$HOME/bin/tar" 2>/dev/null || true
45+
fi
46+
}
47+
48+
main "$@"

.solstice/setup-linux.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
# Solstice CI per-OS environment prepare (Linux)
4+
# Installs baseline tools needed by the workflow runner and builds.
5+
6+
log() { printf "[setup-linux] %s\n" "$*" >&2; }
7+
8+
export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-noninteractive}
9+
10+
detect_pm() {
11+
if command -v apt-get >/dev/null 2>&1; then echo apt; return; fi
12+
if command -v dnf >/dev/null 2>&1; then echo dnf; return; fi
13+
if command -v yum >/dev/null 2>&1; then echo yum; return; fi
14+
if command -v zypper >/dev/null 2>&1; then echo zypper; return; fi
15+
if command -v apk >/dev/null 2>&1; then echo apk; return; fi
16+
if command -v pacman >/dev/null 2>&1; then echo pacman; return; fi
17+
echo none
18+
}
19+
20+
install_packages() {
21+
local pm; pm=$(detect_pm)
22+
case "$pm" in
23+
apt)
24+
sudo -n true 2>/dev/null || true
25+
sudo apt-get update -y || apt-get update -y || true
26+
sudo apt-get install -y --no-install-recommends \
27+
curl ca-certificates git build-essential pkg-config libssl-dev \
28+
protobuf-compiler cmake clang libclang-dev || true
29+
;;
30+
dnf)
31+
sudo dnf install -y curl ca-certificates git gcc gcc-c++ make pkgconf-pkg-config openssl-devel protobuf-compiler clang clang-libs || true
32+
;;
33+
yum)
34+
sudo yum install -y curl ca-certificates git gcc gcc-c++ make pkgconfig openssl-devel protobuf-compiler clang clang-libs || true
35+
;;
36+
zypper)
37+
sudo zypper --non-interactive install curl ca-certificates git gcc gcc-c++ make pkg-config libopenssl-devel protobuf clang || true
38+
;;
39+
apk)
40+
sudo apk add --no-cache curl ca-certificates git build-base pkgconfig openssl-dev protoc clang clang-libs || true
41+
;;
42+
pacman)
43+
sudo pacman -Sy --noconfirm curl ca-certificates git base-devel pkgconf openssl protobuf clang || true
44+
;;
45+
*)
46+
log "unknown package manager ($pm); skipping package install"
47+
;;
48+
esac
49+
}
50+
51+
ensure_rust() {
52+
if command -v cargo >/dev/null 2>&1; then return 0; fi
53+
log "installing Rust toolchain with rustup"
54+
curl -fsSL https://sh.rustup.rs | sh -s -- -y
55+
# shellcheck disable=SC1091
56+
if [ -f "$HOME/.cargo/env" ]; then . "$HOME/.cargo/env"; else export PATH="$HOME/.cargo/bin:$PATH"; fi
57+
}
58+
59+
main() {
60+
install_packages
61+
ensure_rust
62+
if ! command -v protoc >/dev/null 2>&1; then
63+
log "WARNING: protoc not found; prost/tonic builds may fail"
64+
fi
65+
}
66+
67+
main "$@"

.solstice/workflow.kdl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
workflow name="Solstice CI for solstice-ci" {
2+
// Linux build and test on Ubuntu 22.04 runner
3+
job id="linux-build" runs_on="ubuntu-22.04" {
4+
setup path=".solstice/setup-linux.sh"
5+
step name="Show toolchain" run="rustc -Vv && cargo -V"
6+
step name="Format" run="cargo fmt --check"
7+
step name="Clippy" run="cargo clippy --workspace --all-targets --all-features -- -D warnings"
8+
step name="Build" run="cargo build --workspace"
9+
step name="Test" run="cargo test --workspace --all-targets"
10+
// Legacy script hook (runs after all other tests)
11+
step name="Legacy job.sh" run=".solstice/job.sh"
12+
}
13+
14+
// Illumos build (bhyve zone). Keep steps minimal; clippy/format may vary per toolchain.
15+
job id="illumos-build" runs_on="illumos-latest" {
16+
setup path=".solstice/setup-illumos.sh"
17+
step name="Show toolchain" run="rustc -Vv && cargo -V"
18+
step name="Build" run="cargo build --workspace"
19+
step name="Test" run="cargo test --workspace --all-targets"
20+
// Legacy script hook (runs after all other tests)
21+
step name="Legacy job.sh" run=".solstice/job.sh"
22+
}
23+
}

0 commit comments

Comments
 (0)