Changed job strategy to find all projects and run kibot on them.

Also added:
- script to produce neoden yy1 compatible pnp files
- panelisation capability which runs for all compabatible .json files.
This commit is contained in:
ac
2023-04-05 19:50:35 +10:00
parent 40737327a0
commit 804440f8f4
3 changed files with 267 additions and 69 deletions

View File

@@ -8,60 +8,100 @@ workflow:
stages:
- run_erc
- run_drc
- gen_mech
- mech_out
- gen_fab
- fab_out
image:
name: ghcr.io/inti-cmnb/kicad6_auto:1.3.0
name: ghcr.io/inti-cmnb/kicad7_auto:latest
.main_rules:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
- if: $CI_COMMIT_BRANCH == "main"
- if: $GITLAB_CI == 'false'
.dev_rules:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"'
- if: $CI_COMMIT_BRANCH == "dev"
.commands:
get_files:
- |
if find **/*$SEARCH ; then
FILES=$(find **/*$SEARCH)
else
FILES=''
fi
get_dirs:
- |
if find **/*$SEARCH ; then
FILES=$(find **/*$SEARCH)
DIRS=$(dirname $FILES)
else
FILES=''
DIRS=''
fi
- ''
sch_from_pro:
- 'SCHEMS=$(for f in $FILES ; do echo "${f%.*}.kicad_sch"; done)'
- 'SCHEMS=$(for f in $SCHEMS ; do echo "${f##**/}"; done)'
get_names:
- 'NAMES=$(for f in $FILES ; do echo "${**/f%$SEARCH}"; done)'
dir_arr:
- !reference [.commands, get_dirs]
- END=$(wc -w <<< $DIRS)
- dir_arr=($DIRS)
kibot:
- 'SEARCH=".kicad_pro"'
- !reference [.commands, dir_arr]
- !reference [.commands, sch_from_pro]
- sch_arr=($SCHEMS)
- |
for i in $(seq 1 $END)
do
echo ${dir_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
done
panel:
- 'SEARCH="boards.json"'
- !reference [.commands, get_dirs]
- |
for d in $DIRS
do
echo $d
cd $CI_PROJECT_DIR/$d
JSON=$(find panel_*.json )
NAME=$(echo "${JSON%.json}")
mkdir panel
kikit -p $JSON boards.json panel/$NAME.kicad_pcb
touch panel/$NAME.kicad_sch
done
neo:
- 'SEARCH=".kicad_pro"'
- !reference [.commands, get_dirs]
- |
for d in $DIRS
do
python3 scripts/neo.py $d
done
.template:
rules:
- !reference [.main_rules, rules]
variables:
COMMAND: kibot -e "$SCHEM" -c "$CI_PROJECT_DIR/default.kibot.yaml" -d "$CI_PROJECT_DIR/Fabrication/$DIR" -s
vars:
SUFFIX: ""
script:
- cd "$DIR"
- echo $COMMAND $SUFFIX | bash
- !reference [.commands, kibot]
dependencies: []
parallel:
matrix:
.tempout:
extends: .template
artifacts:
when: always
expire_in: 2 mins
paths:
- Fabrication/
.temprc:
extends: .template
rules:
- !reference [.main_rules, rules]
- !reference [.dev_rules, rules]
.tempcoll:
rules:
- !reference [.main_rules, rules]
script:
- ls Fabrication/
artifacts:
when: always
paths:
- Fabrication/
erc:
extends: .temprc
@@ -75,46 +115,38 @@ drc:
variables:
SUFFIX: update_xml,run_erc -i
cad_outputs:
extends: .tempout
outputs_dev:
rules:
- !reference [.dev_rules, rules]
stage: gen_fab
artifacts:
when: always
paths:
- Fabrication/
variables:
SUFF_SCH: run_drc,run_erc print_sch step
SUFF_PCB: all print_front
script:
- SUFFIX=$SUFF_SCH
- !reference [.commands, kibot]
- SUFFIX=$SUFF_PCB
- !reference [.commands, kibot]
outputs_all:
extends: outputs_dev
rules:
- !reference [.main_rules, rules]
- !reference [.dev_rules, rules]
stage: gen_mech
variables:
SUFFIX: run_drc step
mech_outputs:
extends: .tempcoll
rules:
- !reference [.main_rules, rules]
- !reference [.dev_rules, rules]
stage: mech_out
dependencies:
- cad_outputs
sch_outputs:
extends: .tempout
stage: gen_fab
variables:
SUFFIX: run_drc,run_erc print_sch
pcb_outputs:
extends: .tempout
stage: gen_fab
variables:
SUFFIX: all print_front JLCPCB_fab assembly step
bom:
extends: .tempout
stage: gen_fab
variables:
SUFFIX: all bom
fab_outputs:
extends: .tempcoll
stage: fab_out
dependencies:
- sch_outputs
- pcb_outputs
- bom
SUFF_SCH: run_drc,run_erc print_sch step bom
SUFF_PCB: all print_front gerbers drill position
script:
- SUFFIX=$SUFF_SCH
- !reference [.commands, kibot]
- cd $CI_PROJECT_DIR
- !reference [.commands, panel]
- SUFFIX=$SUFF_PCB
- cd $CI_PROJECT_DIR
- !reference [.commands, kibot]
- cd $CI_PROJECT_DIR
- ls Fabrication/interface
- !reference [.commands, neo]