Renamed .gitmodules to gitmodules, and .gitlab-ci.yml to kibot-ci.yml
Updated default.kibot.yaml and kibot-ci.yml to match DS. Added ci yaml to be copied to the root of the kicad proj, it just includes kibot-ci.yml
This commit is contained in:
184
kibot-ci.yml
Normal file
184
kibot-ci.yml
Normal file
@@ -0,0 +1,184 @@
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
GIT_SUBMODULE_DEPTH: 1
|
||||
GIT_SUBMODULE_FORCE_HTTPS: "true"
|
||||
|
||||
stages:
|
||||
- gen_mech
|
||||
- gen_fab
|
||||
- release
|
||||
|
||||
image:
|
||||
name: ghcr.io/inti-cmnb/kicad7_auto:1.6.3
|
||||
|
||||
.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 $CI_PROJECT_DIR -name *$SEARCH)
|
||||
get_dirs:
|
||||
- FILES=$(find CI_PROJECT_DIR -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
|
||||
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/.gitlab/default.kibot.yaml -d $CI_PROJECT_DIR/Fabrication/${dir_arr[i-1]} -s $SUFFIX
|
||||
done
|
||||
- cd $CI_PROJECT_DIR
|
||||
|
||||
panel:
|
||||
- 'SEARCH="_panel.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}")
|
||||
PCB=$(find *.kicad_pcb)
|
||||
mkdir $CI_PROJECT_DIR/$NAME
|
||||
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 $PCB
|
||||
done
|
||||
- cd $CI_PROJECT_DIR
|
||||
|
||||
neo:
|
||||
- 'SEARCH=".kicad_pro"'
|
||||
- !reference [.commands, get_dirs]
|
||||
- |
|
||||
for d in $DIRS
|
||||
do
|
||||
if [[ $d == "$CI_PROJECT_DIR/Frame" ]]; then
|
||||
continue
|
||||
fi
|
||||
echo $d
|
||||
python3 .scripts/neo.py $d
|
||||
done
|
||||
|
||||
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/**/*
|
||||
variables:
|
||||
SUFF_MECH: run_erc,run_drc step
|
||||
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: run_drc print_sch
|
||||
SUFF_PCB: run_erc,update_xml,set_text_variables print_pcb
|
||||
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 sch
|
||||
SUFF_PCB: run_erc,update_xml,set_text_variables pcb
|
||||
script:
|
||||
- !reference [.commands, git_tag]
|
||||
- SUFFIX=$SUFF_SCH
|
||||
- !reference [.commands, kibot]
|
||||
- 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"
|
||||
Reference in New Issue
Block a user