143 lines
3.4 KiB
YAML
143 lines
3.4 KiB
YAML
workflow:
|
|
rules:
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
|
when: never
|
|
- if: $CI_COMMIT_BRANCH
|
|
|
|
stages:
|
|
- run_erc
|
|
- run_drc
|
|
- gen_fab
|
|
|
|
image:
|
|
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:
|
|
- FILES=$(find . -name *$SEARCH)
|
|
get_dirs:
|
|
- FILES=$(find . -name *$SEARCH)
|
|
- |
|
|
if [[ $FILES == "" ]]; then
|
|
DIRS=""
|
|
else
|
|
DIRS=$(dirname $FILES)
|
|
fi
|
|
sch_from_pro:
|
|
- 'SCHEMS=$(for f in $FILES ; do echo "${f%.*}.kicad_sch"; done)'
|
|
- 'SCHEMS=$(for f in $SCHEMS ; do echo "${f##**/}"; 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:
|
|
SUFFIX: ""
|
|
script:
|
|
- !reference [.commands, kibot]
|
|
dependencies: []
|
|
|
|
.temprc:
|
|
extends: .template
|
|
rules:
|
|
- !reference [.main_rules, rules]
|
|
- !reference [.dev_rules, rules]
|
|
|
|
erc:
|
|
extends: .temprc
|
|
stage: run_erc
|
|
variables:
|
|
SUFFIX: update_xml,run_drc -i
|
|
|
|
drc:
|
|
extends: .temprc
|
|
stage: run_drc
|
|
variables:
|
|
SUFFIX: update_xml,run_erc -i
|
|
|
|
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]
|
|
variables:
|
|
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
|
|
- !reference [.commands, neo]
|