Bump kittycad from 0.2.46 to 0.2.60 in /tutorials/websocket_tutorial/draw_cube_rust #313
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build & test | |
on: | |
push: | |
branches: main | |
paths: | |
- '**.py' | |
- '**.go' | |
- '**.js' | |
- '**.ts' | |
- '**.rs' | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
- 'ORIGINALVOXEL-3.obj' | |
- .github/workflows/build-test.yml | |
- requirements.txt | |
- package.json | |
pull_request: | |
paths: | |
- '**.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: | |
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: | |
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
build-test-python-versions: | |
runs-on: ubuntu-latest | |
strategy: | |
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 dependencies | |
shell: bash | |
run: | | |
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: | |
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
build-test-js-versions: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [16, 18] | |
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: | |
KITTYCAD_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
build-test-rs-versions: | |
runs-on: ubuntu-latest | |
strategy: | |
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: | |
KITTYCAD_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: | |
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 dependencies | |
shell: bash | |
run: | | |
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" | |
"./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 | |
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: | |
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
- name: stage outputs | |
run: | | |
git add "tutorials/**/*output.*" | |
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 }} |