Skip to content

SUKU octv added to workflow #200

SUKU octv added to workflow

SUKU octv added to workflow #200

name: mechanical_components
on:
workflow_dispatch:
push:
paths:
- '.github/workflows/mechanical_components.yml'
- '.github/workflows/deploy_nightly_release.yml'
- '.github/workflows/freecad_export.py'
- '.github/workflows/openscad_preview.sh'
- 'Mechanical/Design/**'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
generate-artifacts:
name: freecad export
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component:
- 'INSERT-FADER'
- 'INSERT-M1.6x2.5x3'
- 'INSERT-M1.6x2.5x4'
- 'KNOB-TEK2'
- 'MAGNET-D3x14'
- 'MAGNET-SQ3'
- 'THT-BUTTON'
- 'THT-HALL-SWITCH'
- 'THT-ENC'
- 'THT-ENDLESSPOT'
- 'THT-FADER'
- 'THT-LONGFADER'
- 'THT-POT'
- 'SMT-VSN1-DISPLAY'
- 'SMT-CONN-POGO'
- 'SMT-CONN-BATTERY'
- 'PLASTIC-CANVAS'
- 'PLASTIC-CAP-BUTTON'
- 'PLASTIC-CAP-FADER'
- 'PLASTIC-KNOB-ENC'
- 'PLASTIC-KNOB-POT'
- 'PLASTIC-LIGHTPIPE'
- 'PLASTIC-LOW-PROFILE-KEYCAP'
- 'PLASTIC-MAGNET-COVER'
- 'PLASTIC-MAPMODE'
- 'PLASTIC-VSN1-BUTTON'
- 'PLASTIC-VSN1-DISPLAY-INTERFACE'
- 'PLASTIC-TEK2-KNOB-INTERFACE'
- 'PLASTIC-OCTV-KEY'
- 'RUBBER-FOOT'
- 'SCREW-M1.6x5-C'
- 'SCREW-M1.6x8'
- 'SCREW-M1.6x16'
- 'SPACER'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb x11vnc
sudo apt-get install snapd
sudo snap install freecad
sudo apt-get install -y openscad
Xvfb :99 -screen 0 1920x1080x24 > /dev/null 2>&1 &
sleep 10 # Give Xvfb some time to start
x11vnc -display :99 -nopw -listen localhost -xkb -ncache 10 -ncache_cr -forever > /dev/null 2>&1 &
- name: Run GUI application
continue-on-error: true
run: |
ls
export DISPLAY=:99
timeout 1m freecad --hidden ./Mechanical/Design/${{ matrix.component }}/${{ matrix.component }}.FCStd ./.github/workflows/freecad_export.py step pdf || true
- name: Install conda, create env with pythonocc-core
run: |
CONDA_INSTALL_DIR="$HOME/miniconda3"
# Install Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p "$CONDA_INSTALL_DIR"
rm miniconda.sh
# Add Conda to PATH
export PATH="$CONDA_INSTALL_DIR/bin:$PATH"
source "$CONDA_INSTALL_DIR/etc/profile.d/conda.sh"
# Create environment and activate it
conda create -n occenv python=3.10 pythonocc-core=7.7.2 -c conda-forge --yes
conda activate occenv
# Run your Python script inside the environment
python ./.github/workflows/pythonocc_step_to_stl.py
- name: Generate Preview PNG
run: |
./.github/workflows/openscad_preview.sh
- name: Stop x11vnc
run: pkill x11vnc
- name: Set Date
run: echo "action_date=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_ENV
- name: Copy reference files
run: |
find Mechanical/Design/${{ matrix.component }}/ -maxdepth 1 -name "${{ matrix.component }}*" ! -name "*.FCStd" ! -name "*.FCBak" -exec cp {} temp/ \; || true
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "result_${{ matrix.component }}_${{ env.action_date }}"
path: temp/${{ matrix.component }}*.*
deploy-results:
needs: generate-artifacts
if: github.ref == 'refs/heads/master'
uses: ./.github/workflows/deploy_nightly_release.yml
with:
release_name: "Nightly Mechanical"
tag_name: "nightly-mechanical"
secrets: inherit