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
58 changes: 58 additions & 0 deletions .github/actions/setup-openscad/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Setup OpenSCAD Action

Composite GitHub Action that installs OpenSCAD, system dependencies, and libraries via [scadm](../../../cmd/scadm/README.md) — with caching.

> ⚠️ Requires `ubuntu` runners (uses `apt` for system dependencies).

## Why

Setting up OpenSCAD in CI requires installing system packages, downloading binaries, and managing library dependencies. This action handles all of that in a single step, with caching for fast subsequent runs.

## Usage

### Cross-repository

```yaml
steps:
- uses: actions/checkout@v6

- name: Setup OpenSCAD
uses: kellerlabs/homeracker/.github/actions/setup-openscad@setup-openscad-v1
```

> Requires a `scadm.json` in the repo root. See [scadm docs](../../../cmd/scadm/README.md) for config format.

### Within homeracker

```yaml
steps:
- uses: actions/checkout@v6

- name: Setup OpenSCAD
uses: ./.github/actions/setup-openscad
with:
scadm-source: cmd/scadm
```

## Inputs

| Input | Description | Default |
|---|---|---|
| `scadm-version` | Pinned scadm PyPI version. Also used in the cache key. | See [action.yml](action.yml) |
| `scadm-source` | Local path for editable scadm install. Overrides PyPI version and re-runs `scadm install`. | _(empty)_ |

## What it does

1. Sets up Python 3.x
2. Installs system dependencies (`xvfb`, `libglu1-mesa`, `libfuse2`, `libegl1`, `libxcb-cursor0`)
3. Caches `bin/openscad/` keyed on runner OS, scadm version, `scadm.json`, and local source hash (when `scadm-source` is set)
4. Installs [scadm](../../../cmd/scadm/README.md) — pinned from PyPI, or from a local path if `scadm-source` is set
5. Runs `scadm install` to download OpenSCAD and libraries

## Versioning

This action is independently versioned via [release-please](https://github.com/googleapis/release-please). Use a pinned tag:

```yaml
uses: kellerlabs/homeracker/.github/actions/setup-openscad@setup-openscad-v1.0.0
```
25 changes: 20 additions & 5 deletions .github/actions/setup-openscad/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---
name: Setup OpenSCAD
description: Install system dependencies, OpenSCAD, and libraries with caching
description: >
Install system dependencies, OpenSCAD, and libraries with caching.
Requires ubuntu runners.

inputs:
scadm-version:
description: Pinned scadm PyPI version. Also used in the cache key.
required: false
default: '0.4.10'
scadm-source:
description: >
Local path to install scadm from (editable install).
When set, overrides the PyPI version and re-runs scadm install.
required: false

runs:
using: composite
Expand All @@ -9,8 +22,6 @@ runs:
uses: actions/setup-python@v6
with:
python-version: '3.x'
cache: 'pip'
cache-dependency-path: cmd/scadm/pyproject.toml

- name: Install system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.6.0
Expand All @@ -21,10 +32,14 @@ runs:
uses: actions/cache@v5
with:
path: bin/openscad
key: openscad-${{ runner.os }}-${{ hashFiles('scadm.json', 'cmd/scadm/scadm/constants.py') }}
key: openscad-${{ runner.os }}-${{ inputs.scadm-version }}-${{ hashFiles('scadm.json', inputs.scadm-source && format('{0}/**/constants.py', inputs.scadm-source) || 'scadm.json') }}

- name: Install OpenSCAD and dependencies
shell: bash
run: |
pip install -e cmd/scadm
if [[ -n "${{ inputs.scadm-source }}" ]]; then
pip install -e "${{ inputs.scadm-source }}"
else
pip install scadm==${{ inputs.scadm-version }}
fi
scadm install
3 changes: 2 additions & 1 deletion .github/config/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
".": "1.8.0",
"cmd/scadm": "0.4.11"
"cmd/scadm": "0.4.11",
".github/actions/setup-openscad": "0.0.0"
}
6 changes: 6 additions & 0 deletions .github/config/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"release-type": "python",
"package-name": "scadm",
"component": "scadm"
},
".github/actions/setup-openscad": {
"release-type": "simple",
"package-name": "setup-openscad",
"component": "setup-openscad",
"bump-minor-pre-major": false
}
}
}
4 changes: 3 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ Before terminal operations, consider running these steps (use best judgement):
5. **Make the change** and immediately test it - do NOT announce completion before testing
6. **Update** existing documentation (.md files) and create new ones where applicable
7. **Run pre-commit hooks** to catch formatting/linting issues before commit. Fix any issues found (no ignores allowed).
8. **On errors**: Step back, check docs, ask user if stuck—don't iterate blindly
8. **Code review**: Review ALL changes made in the session — check for consistency, missed edge cases, and unintended side effects before presenting to the user.
9. **Creating PRs**: Use the **GitHub MCP Server** (never `gh` CLI). Read `.github/pull_request_template.md` and fill in every section. Keep it brief per project conventions.
10. **On errors**: Step back, check docs, ask user if stuck—don't iterate blindly

## OpenSCAD Guidelines
- Use BOSL2 for complex geometry
Expand Down
4 changes: 2 additions & 2 deletions .github/hooks/session-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ if [[ ! -d .venv ]]; then
python3 -m venv .venv
fi

# Determine venv paths based on OS
if [[ "${OS:-}" == "Windows_NT" ]]; then
# Determine venv paths based on actual venv layout
if [[ -d .venv/Scripts ]]; then
PIP=".venv/Scripts/pip"
SCADM=".venv/Scripts/scadm"
else
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:

- name: Setup OpenSCAD
uses: ./.github/actions/setup-openscad
with:
scadm-source: cmd/scadm

- name: Make scripts executable
run: chmod +x cmd/export/export-core-models.sh .githooks/makerworld-export
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/validate-models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:

- name: Setup OpenSCAD
uses: ./.github/actions/setup-openscad
with:
scadm-source: cmd/scadm

- name: Validate models
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
# Keep in sync with .github/config/release-please-config.json changelog-sections
types: |
feat
feat!
fix
fix!
deps
docs
ci
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ HomeRacker includes custom tooling to streamline development:
- Install: `pip install scadm` → `scadm`
- Manages dependencies from `scadm.json`

- **[Setup OpenSCAD Action](.github/actions/setup-openscad/README.md)** - Reusable GitHub Action for CI
- Installs OpenSCAD, system dependencies, and libraries in one step
- Uses scadm under the hood, with caching for fast runs
- Usage: `uses: kellerlabs/homeracker/.github/actions/setup-openscad@setup-openscad-v1`

- **[Renovate Preset](renovate-dependencies.json)** - Automated dependency updates
- Tracks OpenSCAD versions, GitHub releases, and Python packages
- Custom rules for this project's specific needs
Expand Down
Loading