Skip to content

Bump kittycad from 0.7.2 to 0.7.4 #620

Bump kittycad from 0.7.2 to 0.7.4

Bump kittycad from 0.7.2 to 0.7.4 #620

Workflow file for this run

name: build & test
permissions:
contents: write
on:
push:
branches: main
paths:
- 'go.mod'
- 'go.sum'
- '**.py'
- '**.go'
- '**.js'
- '**.ts'
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'ORIGINALVOXEL-3.obj'
- .github/workflows/build-test.yml
- requirements.txt
- package.json
pull_request:
paths:
- 'go.mod'
- 'go.sum'
- '**.py'
- '**.go'
- '**.js'
- '**.ts'
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'ORIGINALVOXEL-3.obj'
- .github/workflows/build-test.yml
- requirements.txt
- package.json
workflow_dispatch:
inputs:
jobs:
build-test-go-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [1.18]
test-path:
- ./tutorials/conversion_obj_step
- ./tutorials/conversion_obj_stl
- ./tutorials/get_mass_volume
- ./samples/convert_file
- ./samples/file_density
- ./samples/file_mass
- ./samples/file_volume
- ./samples/file_center_of_mass
- ./samples/file_surface_area
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Go ${{ matrix.go-version }}
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}
- name: Run scripts
shell: bash
run: |
FILE=$(find ${{ matrix.test-path }} -name "*.go")
go run $FILE
env:
ZOO_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
build-test-python-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
test-path:
- ./tutorials/conversion_obj_step
- ./tutorials/conversion_obj_stl
- ./tutorials/get_mass_volume
- ./tutorials/getting_started
- ./tutorials/beginner_tutorial
- ./tutorials/websocket_tutorial
- ./tutorials/text-to-cad
- ./samples/convert_file
- ./samples/file_density
- ./samples/file_mass
- ./samples/file_volume
- ./samples/file_center_of_mass
- ./samples/file_surface_area
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
- name: Install deps
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install -r requirements.txt
- name: Run scripts
shell: bash
run: |
p=${{ matrix.test-path }}
for f in $(find "$p" -name "*.*.*" | sed 's/.*[0-9]*_\(.*\)\.part/\1/' | sort -u | uniq);
do
cd "$p";
cat $(ls *$f.part | sort -g) > "$f";
cd -;
done
FILE=$(find ${{ matrix.test-path }} -name "*.py")
python $FILE
env:
ZOO_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
build-test-js-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [20]
test-path:
- ./tutorials/beginner_tutorial
- ./samples/convert_file
- ./samples/file_density
- ./samples/file_mass
- ./samples/file_volume
- ./samples/file_center_of_mass
- ./samples/file_surface_area
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up node ${{ matrix.python-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- run: yarn install
- name: Run scripts
shell: bash
run: |
FILE=$(find ${{ matrix.test-path }} -name "*.js")
node $FILE
env:
ZOO_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
build-test-rs-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-path:
- ./tutorials/websocket_tutorial/draw_cube_rust
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up node ${{ matrix.python-version }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Run sources
shell: bash
run: |
cd ${{ matrix.test-path }}
cargo run
env:
ZOO_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
commit-script-outputs:
# Using the python script to commit the output of the scripts
# The go scripts should have the same output
# This implicitly makes python the source of truth for the outputs
needs: [build-test-python-versions]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
- name: Install deps
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install -r requirements.txt
- name: remove previous outputs
shell: bash
run: |
rm -rf tutorials/**/*output.{stl,obj,step,json}
rm -rf samples/**/*output.{stl,obj,step,json}
- name: test outputs
run: |
files=( "./tutorials/conversion_obj_step"
"./tutorials/conversion_obj_stl"
"./tutorials/get_mass_volume"
"./tutorials/getting_started"
"./tutorials/websocket_tutorial"
"./samples/convert_file"
"./samples/file_density"
"./samples/file_mass"
"./samples/file_volume"
"./samples/file_center_of_mass"
"./samples/file_surface_area"
)
for FILE in "${files[@]}"
do
FULL_FILE=$(find $FILE -name "*.py")
python $FULL_FILE
mv output.* $FILE || true
OUTPUT_FILE=$(find $FILE -name output.*)
if [[ $OUTPUT_FILE == *.step ]]
# current date is added to step file, meaning there will always be a diff, clamping this to a consistent date to prevent this
then
sed -i 's/20..-..-..T..:..:../2022-00-00T00:00:00/g' $OUTPUT_FILE
fi
if [ $(find $FILE -maxdepth 2 -name 'output.*' -print -quit ) ]; then
echo "$FILE output was created."
else
echo "better luck next time $FILE output was NOT created"
exit 1
fi
echo "done $FILE"
done
echo "all done"
env:
ZOO_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
- name: stage outputs
run: |
git add "tutorials/**/*output.*"
git add "tutorials/**/*.png"
git add "samples/**/*output.*"
- name: git status
run: git status
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true' && github.actor != 'dependabot[bot]'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
git commit -am "Updating script outputs"
git push origin ${{github.event.pull_request.head.ref }}