adding some documentation and a python requirements.txt for ease of u… #509
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: Render 3D Designs | |
on: | |
push: | |
pull_request: | |
jobs: | |
render-3d: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up outputs directory | |
run: mkdir -p 3d/build/outputs | |
- name: Install dependencies | |
run: ./3d/scripts/dependencies.sh | |
- name: 'Generate 2d output :: 52 flap :: generic' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python -u 3d/scripts/generate_2d.py --no-connectors --calculate-dimensions --render-raster | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-52.svg | |
cp 3d/build/laser_parts/raster.png 3d/build/outputs/3d_laser_raster-52.png | |
./scripts/annotate_image.sh 3d/build/outputs/3d_laser_raster-52.png | |
cp 3d/build/laser_parts/combined_module_dimensions.svg 3d/build/outputs/3d_laser_vector-52-module_dimensions.svg | |
- name: 'Generate 2d output :: 52 flap :: Ponoko 3mm MDF)' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --calculate-dimensions --kerf-preset ponoko-3mm-mdf | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-52-ponoko-3mm-mdf_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-52-ponoko-3mm-mdf_1x_dimensions.svg | |
- name: 'Generate 2d output :: 52 flap :: Ponoko 3mm Acrylic' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --calculate-dimensions --kerf-preset ponoko-3mm-acrylic | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-52-ponoko-3mm-acrylic_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-52-ponoko-3mm-acrylic_1x_dimensions.svg | |
- name: 'Generate 2d output :: 52 flap :: Elecrow 3mm Wood' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --kerf-preset elecrow-3mm-wood --render-elecrow | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-52-elecrow-3mm-wood_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-52-elecrow-3mm-wood_1x_dimensions.svg | |
cp 3d/build/laser_parts/elecrow.zip 3d/build/outputs/3d_laser_vector-52-elecrow-3mm-wood_1x.zip | |
- name: 'Generate 2d output :: 52 flap :: Elecrow 3mm Acrylic' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --kerf-preset elecrow-3mm-acrylic --render-elecrow | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-52-elecrow-3mm-acrylic_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-52-elecrow-3mm-acrylic_1x_dimensions.svg | |
cp 3d/build/laser_parts/elecrow.zip 3d/build/outputs/3d_laser_vector-52-elecrow-3mm-acrylic_1x.zip | |
- name: 'Generate 2d output :: 40 flap :: generic' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python -u 3d/scripts/generate_2d.py --no-connectors --calculate-dimensions --render-raster --num-flaps 40 | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-40.svg | |
cp 3d/build/laser_parts/raster.png 3d/build/outputs/3d_laser_raster-40.png | |
./scripts/annotate_image.sh 3d/build/outputs/3d_laser_raster-40.png | |
cp 3d/build/laser_parts/combined_module_dimensions.svg 3d/build/outputs/3d_laser_vector-40-module_dimensions.svg | |
- name: 'Generate 2d output :: 40 flap :: Ponoko 3mm MDF)' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --calculate-dimensions --kerf-preset ponoko-3mm-mdf --num-flaps 40 | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-40-ponoko-3mm-mdf_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-40-ponoko-3mm-mdf_1x_dimensions.svg | |
- name: 'Generate 2d output :: 40 flap :: Ponoko 3mm Acrylic' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --calculate-dimensions --kerf-preset ponoko-3mm-acrylic --num-flaps 40 | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-40-ponoko-3mm-acrylic_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-40-ponoko-3mm-acrylic_1x_dimensions.svg | |
- name: 'Generate 2d output :: 40 flap :: Elecrow 3mm Wood' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --kerf-preset elecrow-3mm-wood --render-elecrow --num-flaps 40 | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-40-elecrow-3mm-wood_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-40-elecrow-3mm-wood_1x_dimensions.svg | |
cp 3d/build/laser_parts/elecrow.zip 3d/build/outputs/3d_laser_vector-40-elecrow-3mm-wood_1x.zip | |
- name: 'Generate 2d output :: 40 flap :: Elecrow 3mm Acrylic' | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_2d.py --no-connectors --kerf-preset elecrow-3mm-acrylic --render-elecrow --num-flaps 40 | |
cp 3d/build/laser_parts/combined.svg 3d/build/outputs/3d_laser_vector-40-elecrow-3mm-acrylic_1x.svg | |
cp 3d/build/laser_parts/combined_panel_dimensions.svg 3d/build/outputs/3d_laser_vector-40-elecrow-3mm-acrylic_1x_dimensions.svg | |
cp 3d/build/laser_parts/elecrow.zip 3d/build/outputs/3d_laser_vector-40-elecrow-3mm-acrylic_1x.zip | |
- name: Generate animated gif | |
run: | | |
xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" python3 -u 3d/scripts/generate_gif.py | |
cp 3d/build/animation/animation.gif 3d/build/outputs/3d_animation.gif | |
cp 3d/build/animation/all_flaps.gif 3d/build/outputs/all_flaps.gif | |
- name: Generate STLs for web viewer | |
run: | | |
python -u 3d/scripts/generate_stl.py | |
cp -r 3d/build/colored_stl 3d/build/outputs/3d_colored_stl | |
gzip 3d/build/outputs/3d_colored_stl/*.stl | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: 3d | |
path: | | |
3d/build | |
- name: Configure AWS Credentials | |
if: github.event_name == 'push' && github.repository_owner == 'scottbez1' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Sync artifacts to S3 | |
if: github.event_name == 'push' && github.repository_owner == 'scottbez1' | |
run: | | |
aws s3 sync 3d/build/outputs s3://splitflap-artifacts/${GITHUB_REF#refs/heads/}/3d --exclude '3d_colored_stl/*.stl.gz' --delete --acl public-read --cache-control max-age=0,no-cache | |
aws s3 sync 3d/build/outputs s3://splitflap-artifacts/${GITHUB_REF#refs/heads/}/3d --exclude '*' --include '3d_colored_stl/*.stl.gz' --delete --content-encoding gzip --acl public-read --cache-control max-age=0,no-cache |