diff --git a/base-gitlab.yaml b/base-gitlab.yaml new file mode 100644 index 0000000..fb7c9d7 --- /dev/null +++ b/base-gitlab.yaml @@ -0,0 +1 @@ +include ".gitlab/kibot-ci.yaml" diff --git a/default.kibot.yaml b/default.kibot.yaml index 45d408e..b87f2aa 100644 --- a/default.kibot.yaml +++ b/default.kibot.yaml @@ -1,8 +1,13 @@ # Example KiPlot config file kibot: version: 1 + import: - file: JLCPCB + definitions: + _KIBOT_POS_ENABLED: false + _KIBOT_BOM_ENABLED: false + preflight: run_erc: true update_xml: true @@ -13,12 +18,15 @@ preflight: - name: 'date' expand_kibot_patterns: true text: '%D' + - name: 'name' + expand_kibot_patterns: true + command: 'echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"-" -f1' fill_zones: true ignore_unconnected: false global: environment: - user_templates: "${CI_PROJECT_DIR}/.templates" + user_templates: "${CI_PROJECT_DIR}/.gitlab" outputs: - name: 'print_sch' @@ -28,15 +36,21 @@ outputs: options: output: Schematic.pdf - - name: 'print_front' - comment: "Print F.Cu+Dwgs.User" - type: pdf_pcb_print + - name: 'print_pcb' + comment: "Print Top and Bottom Copper+Silk" + type: pcb_print dir: . options: - output_name: PCB_Top.pdf - layers: - - 'copper' - - layer: F.SilkS + output_name: PCB.pdf + pages: + - layers: + - layer: F.Cu + - layer: F.SilkS + - layer: Edge.Cuts + - layers: + - layer: B.Cu + - layer: B.SilkS + - layer: Edge.Cuts - name: 'bom' comment: "BOM in csv format" @@ -45,18 +59,21 @@ outputs: options: columns: - field: Value - name: Query + name: value - field: Quantity Per PCB - name: Qty - - Description + name: qty + - field: Footprint + name: footprint - mpn - manf - field: References - name: Schematic Reference + name: refs csv: + separator: ';' hide_pcb_info: true hide_stats_info: true format: "CSV" + exclude_filter: "" - name: 'drill' comment: "excellon drill files" @@ -82,6 +99,11 @@ outputs: units: millimeters separate_files_for_front_and_back: false only_smd: true + + - name: 'stencil' + comment: '3D printable stencil for when you forgot to order it' + type: stencil_3d + dir: '3D Stencil' - name: 'diff_pcb' comment: "Diff for visual comparison" @@ -103,12 +125,12 @@ outputs: groups: - name: pcb outputs: - - _JLCPCB_fab + - _JLCPCB_compress - neo_position - - print_front + - print_pcb + - stencil - name: sch outputs: - bom - print_sch - diff --git a/.gitmodules b/gitmodules similarity index 100% rename from .gitmodules rename to gitmodules diff --git a/.gitlab-ci.yml b/kibot-ci.yml similarity index 60% rename from .gitlab-ci.yml rename to kibot-ci.yml index ba10a8c..d8b543e 100644 --- a/.gitlab-ci.yml +++ b/kibot-ci.yml @@ -14,9 +14,10 @@ variables: stages: - gen_mech - gen_fab + - release image: - name: ghcr.io/inti-cmnb/kicad7_auto:1.6.2 + name: ghcr.io/inti-cmnb/kicad7_auto:1.6.3 .main_rules: rules: @@ -31,9 +32,9 @@ image: .commands: get_files: - - FILES=$(find . -name *$SEARCH) + - FILES=$(find $CI_PROJECT_DIR -name *$SEARCH) get_dirs: - - FILES=$(find . -name *$SEARCH) + - FILES=$(find CI_PROJECT_DIR -name *$SEARCH) - | if [[ $FILES == "" ]]; then DIRS="" @@ -55,13 +56,13 @@ image: - | for i in $(seq 1 $END) do - if [[ ${dir_arr[i-1]} == "./Frame" ]]; then + if [[ ${dir_arr[i-1]} == "$CI_PROJECT_DIR/Frame" ]]; then continue fi echo ${dir_arr[i-1]} echo ${sch_arr[i-1]} cd $CI_PROJECT_DIR/${dir_arr[i-1]} - kibot -e ${sch_arr[i-1]} -c $CI_PROJECT_DIR/default.kibot.yaml -d $CI_PROJECT_DIR/Fabrication/${dir_arr[i-1]} -s $SUFFIX + kibot -e ${sch_arr[i-1]} -c $CI_PROJECT_DIR/.gitlab/default.kibot.yaml -d $CI_PROJECT_DIR/Fabrication/${dir_arr[i-1]} -s $SUFFIX done - cd $CI_PROJECT_DIR @@ -80,7 +81,7 @@ image: kikit panelize -p $JSON $PCB $CI_PROJECT_DIR/$NAME/$NAME.kicad_pcb touch $CI_PROJECT_DIR/$NAME/$NAME.kicad_sch cp fp-lib-table $CI_PROJECT_DIR/$NAME/ - python3 $CI_PROJECT_DIR/.scripts/post_panel.py $CI_PROJECT_DIR/$NAME/$NAME.kicad_pro + python3 $CI_PROJECT_DIR/.scripts/post_panel.py $CI_PROJECT_DIR/$NAME/$NAME.kicad_pro $PCB done - cd $CI_PROJECT_DIR @@ -90,29 +91,29 @@ image: - | for d in $DIRS do - if [[ $d == "./Frame" ]]; then + if [[ $d == "$CI_PROJECT_DIR/Frame" ]]; then continue fi echo $d python3 .scripts/neo.py $d done - templates: - - if [ $GITLAB_CI == 'true' ]; then git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/Micromelon/kicad-project.git .templates; fi - - cd .templates - - shopt -s extglob - - rm -rf !(*.kicad_wks) - - cd $CI_PROJECT_DIR + git_tag: + - | + if [[ $GITLAB_CI == 'true' && $CI_COMMIT_BRANCH == "main" ]]; then + git tag $CI_COMMIT_MESSAGE + fi output_mech: stage: gen_mech artifacts: when: always paths: - - Fabrication/ + - Fabrication/**/* variables: SUFF_MECH: run_erc,run_drc step script: + - !reference [.commands, git_tag] - SUFFIX=$SUFF_MECH - !reference [.commands, kibot] @@ -122,13 +123,14 @@ outputs_dev: stage: gen_fab artifacts: when: always + name: "$CI_PROJECT_TITLE-$CI_COMMIT_SHORT_SHA" paths: - - Fabrication/ + - Fabrication/**/* + expire_in: 1 week variables: SUFF_SCH: run_drc print_sch - SUFF_PCB: run_erc,update_xml print_front + SUFF_PCB: run_erc,update_xml,set_text_variables print_pcb script: - - !reference [.commands, templates] - SUFFIX=$SUFF_SCH - !reference [.commands, kibot] - SUFFIX=$SUFF_PCB @@ -140,13 +142,43 @@ outputs_all: - !reference [.main_rules, rules] variables: SUFF_SCH: run_drc sch - SUFF_PCB: run_erc,update_xml pcb + SUFF_PCB: run_erc,update_xml,set_text_variables pcb script: - - !reference [.commands, templates] + - !reference [.commands, git_tag] - SUFFIX=$SUFF_SCH - !reference [.commands, kibot] - - !reference [.commands, panel] - SUFFIX=$SUFF_PCB + - !reference [.commands, panel] - !reference [.commands, kibot] - !reference [.commands, neo] + +release_job: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: outputs_all + artifacts: true + rules: + - if: $CI_COMMIT_TAG + when: never # Do not run this job when a tag is created manually + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch + script: + - echo "running release_job for $TAG" + artifacts: + when: always + name: "$CI_PROJECT_TITLE-$CI_COMMIT_MESSAGE" + paths: + - Fabrication/**/* + expire_in: never + release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties + tag_name: '$CI_COMMIT_MESSAGE' # The version is incremented per pipeline. + description: '$CI_COMMIT_MESSAGE' + ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA. + assets: + links: + - name: All Fab + url: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/download" + links: + - name: All Fab + url: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/download"