Skip to content

Commit f6c782e

Browse files
committed
Add Makefile
1 parent 42aba54 commit f6c782e

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

.github/workflows/build.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build and commit 3mfs
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '*.scad'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Render in OpenSCAD
16+
run: |
17+
set -euxo pipefail
18+
docker run --rm -v $PWD:/work -w /work openscad/openscad:dev \
19+
bash -c 'apt-get install -y make && make all'
20+
- name: Commit changes
21+
run: |
22+
set -euxo pipefail
23+
git config --global user.name "GitHub Actions"
24+
git config --global user.email "githubactions@github.com"
25+
git add -f stls/
26+
git commit -m "Render 3mfs"
27+
git push origin HEAD:master

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.env
2+
stls

Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
OPENSCAD ?= openscad
2+
3+
.PHONY: all clean
4+
5+
clean:
6+
rm -rf stls/
7+
8+
all: \
9+
$(patsubst %,stls/concave_R%.3mf,$(shell seq 1 30)) \
10+
$(patsubst %,stls/convex_R%.3mf,$(shell seq 1 30))
11+
12+
stls/concave_R%.3mf: concave.scad
13+
@mkdir ./stls/ 2>/dev/null || true
14+
# Run openscad and assert that stderr contains "Objects:\s+2"
15+
$(OPENSCAD) -o $@ --enable lazy-union -D 'RADIUS=$*' $< 2>&1 | tee /dev/stderr | grep -qP 'Objects:\s+2'
16+
17+
stls/convex_R%.3mf: convex.scad
18+
@mkdir ./stls/ 2>/dev/null || true
19+
# Run openscad and assert that stderr contains "Objects:\s+2"
20+
$(OPENSCAD) -o $@ --enable lazy-union -D 'RADIUS=$*' $< 2>&1 | tee /dev/stderr | grep -qP 'Objects:\s+2'

0 commit comments

Comments
 (0)