Files
kicad-ci/.gitlab-ci.yml
ac 804440f8f4 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.
2023-04-05 19:50:35 +10:00

153 lines
3.5 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:
- |
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]
vars:
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
- ls Fabrication/interface
- !reference [.commands, neo]