MeshChatX/.github/actions/setup-dev-environment/action.yml

110 lines
3.8 KiB
YAML

name: Set up development environment
description: Python/UV, Node/pnpm, and full project dependencies for CI jobs
inputs:
python-version:
description: Python version
required: true
uv-version:
description: UV version installed from PyPI
required: false
default: "0.11.15"
node-version:
description: Node.js version
required: true
pnpm-version:
description: pnpm version activated through corepack
required: false
default: "11.1.2"
task-version:
description: go-task version installed from GitHub releases
required: false
default: "3.49.1"
install-task:
description: Install go-task for Taskfile.yml targets
required: false
default: "true"
skip_tree_verify:
description: Set to true to skip meshchatx.rsm byte-level verify
required: false
default: "false"
runs:
using: composite
steps:
# Best-effort integrity check before dependency installs that may rewrite tracked files.
# Tree verify warns by default and does not fail the job.
- name: Ensure rnid for tree verify
if: inputs.skip_tree_verify != 'true'
shell: bash
run: |
set -u
if command -v rnid >/dev/null 2>&1; then
exit 0
fi
if [ -x .venv/bin/rnid ]; then
exit 0
fi
echo "Installing rns tools for tree verify (best effort)"
py=python3
if command -v python >/dev/null 2>&1; then
py=python
fi
if "$py" -m pip install --user 'rns>=1.4.1' 2>/dev/null; then
:
elif "$py" -m pip install --user --break-system-packages 'rns>=1.4.1' 2>/dev/null; then
:
else
echo "WARNING: could not install rnid via pip (tree verify may be skipped)" >&2
exit 0
fi
# Unix user scripts
if [ -d "$HOME/.local/bin" ]; then
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
fi
# Windows user Scripts (GitHub-hosted runners)
if [ -n "${APPDATA:-}" ]; then
for scripts_dir in "$APPDATA"/Python/Python*/Scripts; do
if [ -d "$scripts_dir" ]; then
echo "$scripts_dir" >> "$GITHUB_PATH"
fi
done
fi
if [ -n "${LOCALAPPDATA:-}" ]; then
for scripts_dir in "$LOCALAPPDATA"/Programs/Python/Python*/Scripts; do
if [ -d "$scripts_dir" ]; then
echo "$scripts_dir" >> "$GITHUB_PATH"
fi
done
fi
- name: Verify tree RSM
if: inputs.skip_tree_verify != 'true'
shell: bash
env:
RNS_REQUIRED_SIGNER: e46112d44649266d71fe2193e00a4710
RNS_INVENTORY_OUT: ${{ runner.temp }}/meshchatx-tree-inventory.txt
run: sh scripts/ci/verify-tree-rsm.sh
- name: Set up Python and UV
uses: ./.github/actions/setup-python-uv
with:
python-version: ${{ inputs.python-version }}
uv-version: ${{ inputs.uv-version }}
- name: Set up Node and pnpm
uses: ./.github/actions/setup-node-pnpm
with:
node-version: ${{ inputs.node-version }}
pnpm-version: ${{ inputs.pnpm-version }}
- name: Install dependencies
shell: bash
run: bash scripts/ci/github-install-deps.sh
- name: Setup Task
if: inputs.install-task == 'true'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: sh scripts/ci/setup-task.sh "${{ inputs.task-version }}"