diff --git a/.scripts/neo.py b/.scripts/neo.py index 6084630..b9f8fd6 100644 --- a/.scripts/neo.py +++ b/.scripts/neo.py @@ -1,4 +1,5 @@ import csv +import os import sys from copy import deepcopy from glob import glob @@ -31,8 +32,9 @@ print("bottom Orig: ", bottomOrig) output_dir = deepcopy(pcb_dir) csv_files = glob(output_dir + "/*.csv") +print("CSV Files: ", csv_files) if len(csv_files) < 1: - output_dir = "Fabrication/" + output_dir + output_dir = os.path.join(os.environ.get('CI_PROJECT_DIR', ''), '') + "Fabrication/" + output_dir csv_files = glob(output_dir + "/*.csv") input = next(filter(lambda f: KI_POS_SUFFIX in f, csv_files)) diff --git a/blank.kibot.yaml b/blank.kibot.yaml new file mode 100644 index 0000000..352c8c8 --- /dev/null +++ b/blank.kibot.yaml @@ -0,0 +1,2 @@ +kibot: + version: 1 diff --git a/default.kibot.yaml b/default.kibot.yaml index b71eb39..55b21b3 100644 --- a/default.kibot.yaml +++ b/default.kibot.yaml @@ -2,10 +2,13 @@ kibot: version: 1 +import: + - file: '../kibot.yaml' + preflight: - erc: true - update_xml: true - drc: true + # erc: true + # update_xml: true + # drc: true set_text_variables: - name: 'rev' command: 'if [ $(git describe --tags | wc -w) -gt 0 ]; then git describe --tags | sed -e "s/\([r,R][0-9]\+\)*$//g"; else echo $CI_COMMIT_SHORT_SHA; fi' @@ -31,14 +34,14 @@ outputs: type: pdf_sch_print dir: . options: - output: "%f_%r_%i.%x" + output: "%f%v_%r_%i.%x" - name: 'print_pcb' comment: "Print Top and Bottom Copper+Silk" type: pcb_print dir: . options: - output: "%f_%r_PCB.%x" + output: "%f%v_%r_PCB.%x" pages: - layers: - layer: F.Cu @@ -51,7 +54,7 @@ outputs: - name: '_bom' type: bom - dir: . + dir: /tmp options: columns: - field: Value @@ -70,14 +73,14 @@ outputs: - field: References name: refs exclude_filter: "" - output: "%f_%r_%i.%x" + output: "%f%v_%r_%i.%x" expand_text_vars: true - disable_run_by_default: true - name: 'bom_csv' type: bom dir: . extends: "_bom" + disable_run_by_default: _bom options: csv: separator: ';' @@ -89,6 +92,7 @@ outputs: type: bom dir: . extends: '_bom' + disable_run_by_default: _bom options: xlsx: # this is a relative path unfortunately @@ -108,7 +112,7 @@ outputs: type: step dir: . options: - output: '%f_%r.%x' + output: '%f%v_%r.%x' download: false subst_models: true @@ -124,7 +128,7 @@ outputs: download: false download_lcsc: false orthographic: true - output: 'PCB_%f_%r.%x' + output: 'PCB_%f%v_%r.%x' show_components: 'none' - name: 'pcba_render' @@ -139,14 +143,14 @@ outputs: zoom: -1 download_lcsc: false orthographic: true - output: 'PCBA_%f_%r.%x' + output: 'PCBA_%f%v_%r.%x' show_components: 'all' - name: 'neo_position' comment: "Pick and place" type: position options: - output: '%f_%r_cpl.%x' + output: '%f%v_%r_cpl.%x' format: CSV units: millimeters separate_files_for_front_and_back: false @@ -157,7 +161,7 @@ outputs: type: stencil_3d dir: '3D_Stencil' options: - output: '%f_%r_%i.%x' + output: '%f%v_%r_%i.%x' - name: 'diff_pcb' comment: "Diff for visual comparison" @@ -181,7 +185,7 @@ outputs: type: ibom dir: . options: - output: '%f_%r_%i.%x' + output: '%f%v_%r_%i.%x' dark_mode: true - name: JLCPCB_gerbers @@ -234,7 +238,7 @@ outputs: metric_units: true map: gerber route_mode_for_oval_holes: false - output: "%f%i.%x" + output: "%f%v%i.%x" - name: 'JLCPCB_compress' comment: ZIP file for JLCPCB @@ -245,29 +249,29 @@ outputs: dest: / - from_output: JLCPCB_drill dest: / - output: '%f_%r_JLC.%x' -groups: - - name: pcb - outputs: - - JLCPCB_compress - - neo_position - - print_pcb - - stencil - - interactive_bom - - - name: pcb_panel - outputs: - - JLCPCB_compress - - neo_position - - print_pcb - - step - - interactive_bom - - - name: sch - outputs: - - bom_csv - - bom_xlsx - - print_sch + output: '%f%v_%r_JLC.%x' +# groups: +# - name: pcb +# outputs: +# - JLCPCB_compress +# - neo_position +# - print_pcb +# - stencil +# - interactive_bom +# +# - name: pcb_panel +# outputs: +# - JLCPCB_compress +# - neo_position +# - print_pcb +# - step +# - interactive_bom +# +# - name: sch +# outputs: +# - bom_csv +# - bom_xlsx +# - print_sch ... definitions: _KIBOT_POS_ENABLED: false diff --git a/kibot-ci.yml b/kibot-ci.yml index 30b3155..5f41f43 100644 --- a/kibot-ci.yml +++ b/kibot-ci.yml @@ -20,7 +20,7 @@ stages: - release image: - name: ghcr.io/inti-cmnb/kicad8_auto:1.8.2 + name: ghcr.io/inti-cmnb/kicad8_auto:1.8.4 .main_rules: rules: @@ -82,27 +82,33 @@ image: fi echo ${dir_arr[i-1]} echo ${sch_arr[i-1]} + USER_FILE="$CI_PROJECT_DIR/.gitlab/blank.kibot.yaml" + if [ -f "${dir_arr[i-1]}/kibot.yaml" ]; then + USER_FILE="${dir_arr[i-1]}/kibot.yaml" + fi + cp $USER_FILE $CI_PROJECT_DIR/kibot.yaml python3 $CI_PROJECT_DIR/.gitlab/.scripts/orig.py ${dir_arr[i-1]} - kibot -e ${dir_arr[i-1]}/${sch_arr[i-1]} -c $CI_PROJECT_DIR/.gitlab/default.kibot.yaml -d $CI_PROJECT_DIR/Fabrication/${dir_arr[i-1]} -s $SUFFIX + for CONF in $KIBOT_CONF + do + kibot -e ${dir_arr[i-1]}/${sch_arr[i-1]} -c $CI_PROJECT_DIR/.gitlab/$CONF.kibot.yaml -d $CI_PROJECT_DIR/Fabrication/${dir_arr[i-1]} $VARIANTS + done mv $CI_PROJECT_DIR/Fabrication/${dir_arr[i-1]}/*.zip Fabrication/ 2> /dev/null || true done - cd $CI_PROJECT_DIR - panel: + pre_panel: + - cd $CI_PROJECT_DIR + - mkdir panels - 'SEARCH="_panel.json"' - !reference [.commands, get_dirs] - | - mkdir panels - cd $CI_PROJECT_DIR for d in $DIRS do - echo "found panel" - echo $d + echo "found panel: $d" JSON=$(find $d/*_panel.json) FILE=$(basename "${JSON}") NAME=$(echo "${FILE%.json}") PCB=$(find $d/*.kicad_pcb) - echo "mkdring" mkdir -p panels/$NAME echo "panelising" kikit panelize -p $JSON $PCB panels/$NAME/$NAME.kicad_pcb @@ -110,10 +116,10 @@ image: cp $d/fp-lib-table panels/$NAME/ python3 .gitlab/.scripts/post_panel.py panels/$NAME/$NAME.kicad_pro $PCB done - - cd panels || true - - !reference [.commands, kibot] + - cd panels + + post_panel: - mv panels/* . || true - - rm -rf panels/ || true neo: - 'SEARCH=".kicad_pro"' @@ -231,87 +237,86 @@ image: strip_tag: - TAG=$(echo ${CI_COMMIT_MESSAGE} | tr -d \\n) -output_mech: +outputs_mech: stage: gen_mech + when: always artifacts: when: always paths: - Fabrication/**/* - variables: - SUFF_MECH: erc,drc step pcb_render pcba_render - script: - - !reference [.commands, git_tag] - - SUFFIX=$SUFF_MECH - - !reference [.commands, kibot] - -outputs_dev: - rules: - - !reference [.dev_rules, rules] - stage: gen_fab - artifacts: - when: always - name: "$CI_PROJECT_TITLE-$CI_COMMIT_SHORT_SHA" - paths: - - Fabrication/**/* expire_in: 1 week - variables: - SUFF_SCH: drc sch - SUFF_PCB: erc,update_xml,set_text_variables print_pcb - script: + before_script: - !reference [.commands, git_tag] - - SUFFIX=$SUFF_SCH - - !reference [.commands, kibot] - - SUFFIX=$SUFF_PCB + script: + - VARIANTS="$VARIANTS_MECH" + - KIBOT_CONF="mech" - !reference [.commands, kibot] -outputs_all: - extends: outputs_dev - rules: - - !reference [.main_rules, rules] - variables: - SUFF_SCH: drc sch - SUFF_PCB: erc,update_xml,set_text_variables pcb - SUFF_PANEL: erc,update_xml,set_text_variables pcb_panel + +outputs_dev: + extends: outputs_mech + stage: gen_fab script: - - !reference [.commands, git_tag] - - SUFFIX=$SUFF_SCH + # SCH + - VARIANTS="$VARIANTS_SCH" + - KIBOT_CONF="sch" - !reference [.commands, kibot] - - SUFFIX=$SUFF_PCB + # PCB + - VARIANTS="$VARIANTS_PCB" + - KIBOT_CONF="pcb_dev" + - !reference [.commands, kibot] + +outputs_main: + extends: outputs_dev + script: + # SCH + - VARIANTS="$VARIANTS_SCH" + - KIBOT_CONF="sch" + - !reference [.commands, kibot] + # PCB + - VARIANTS="$VARIANTS_PCB" + - KIBOT_CONF="pcb_main" + - !reference [.commands, kibot] + # Panels + - !reference [.commands, pre_panel] + - KIBOT_CONF="panel" + - !reference [.commands, kibot] + - !reference [.commands, post_panel] + # Pos + - VARIANTS="$VARIANTS_SCH" + - KIBOT_CONF="pos" - !reference [.commands, kibot] - - SUFFIX=$SUFF_PANEL - - !reference [.commands, panel] - !reference [.commands, neo] - - ls Fabrication/ inventree_job_dev: stage: inventree + rules: + - !reference [.dev_rules, rules] needs: - - job: output_mech + - job: outputs_mech artifacts: true - job: outputs_dev artifacts: true - rules: - - !reference [.dev_rules, rules] script: - !reference [.commands, boms] -inventree_job: +inventree_job_main: stage: inventree - needs: - - job: output_mech - artifacts: true - - job: outputs_all - artifacts: true rules: - !reference [.main_rules, rules] + needs: + - job: outputs_mech + artifacts: true + - job: outputs_main + artifacts: true script: - !reference [.commands, boms] upload_job: stage: upload needs: - - job: inventree_job - - job: outputs_all + - job: inventree_job_main + - job: outputs_main artifacts: true rules: - if: $CI_COMMIT_TAG diff --git a/mech.kibot.yaml b/mech.kibot.yaml new file mode 100644 index 0000000..d700e8a --- /dev/null +++ b/mech.kibot.yaml @@ -0,0 +1,13 @@ +# Example KiPlot config file +kibot: + version: 1 + +import: + - file: default.kibot.yaml + outputs: + - step + +preflight: + erc: false + update_xml: false + drc: false diff --git a/panel.kibot.yaml b/panel.kibot.yaml new file mode 100644 index 0000000..6a0c242 --- /dev/null +++ b/panel.kibot.yaml @@ -0,0 +1,17 @@ +# Example KiPlot config file +kibot: + version: 1 + +import: + - file: default.kibot.yaml + outputs: + - JLCPCB_compress + - neo_position + - print_pcb + - step + - interactive_bom + +preflight: + erc: false + update_xml: false + drc: true diff --git a/pcb_dev.kibot.yaml b/pcb_dev.kibot.yaml new file mode 100644 index 0000000..23ef335 --- /dev/null +++ b/pcb_dev.kibot.yaml @@ -0,0 +1,13 @@ +# Example KiPlot config file +kibot: + version: 1 + +import: + - file: default.kibot.yaml + outputs: + - print_pcb + +preflight: + erc: false + update_xml: false + drc: true diff --git a/pcb_main.kibot.yaml b/pcb_main.kibot.yaml new file mode 100644 index 0000000..36bf3f4 --- /dev/null +++ b/pcb_main.kibot.yaml @@ -0,0 +1,18 @@ +# Example KiPlot config file +kibot: + version: 1 + +import: + - file: default.kibot.yaml + outputs: + - JLCPCB_gerbers + - JLCPCB_drill + - JLCPCB_compress + - print_pcb + - stencil + - interactive_bom + +preflight: + erc: false + update_xml: false + drc: true diff --git a/pos.kibot.yaml b/pos.kibot.yaml new file mode 100644 index 0000000..bd2829c --- /dev/null +++ b/pos.kibot.yaml @@ -0,0 +1,13 @@ +# Example KiPlot config file +kibot: + version: 1 + +import: + - file: default.kibot.yaml + outputs: + - neo_position + +preflight: + erc: false + update_xml: false + drc: true diff --git a/sch.kibot.yaml b/sch.kibot.yaml new file mode 100644 index 0000000..6f754a5 --- /dev/null +++ b/sch.kibot.yaml @@ -0,0 +1,15 @@ +kibot: + version: 1 + +import: + - file: default.kibot.yaml + outputs: + - print_sch + - _bom + - bom_csv + - bom_xlsx + +preflight: + erc: true + update_xml: true + drc: false