Skip to content

Update component values. #18

Update component values.

Update component values. #18

Workflow file for this run

name: Kicad - production files generator
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
paths:
- '**.kicad_pcb'
- '**.kicad_sch'
- '**.kicad_pro'
- '**.yml'
- '**.yaml'
- 'doc/assets'
workflow_dispatch:
env:
branch: ${{ github.head_ref || github.ref_name }}
dir: "hw/out"
kibot: "doc/assets/kibot"
jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- id: set-matrix
run: |
if [ -f hw/sch_pcb/PCB_matrix.yaml ]; then
MATRIX=$(python3 -c "
import yaml, json
with open('hw/sch_pcb/PCB_matrix.yaml') as f:
projects = yaml.safe_load(f)
matrix = {'include': [
{'name': p['name'], 'dir': p['dir'],
'schema': p['dir'] + '/' + p['name'] + '.kicad_sch',
'board': p['dir'] + '/' + p['name'] + '.kicad_pcb'}
for p in projects
]}
print(json.dumps(matrix))
")
else
REPO="${{ github.event.repository.name }}"
MATRIX="{\"include\":[{\"name\":\"$REPO\",\"dir\":\"hw/sch_pcb\",\"schema\":\"hw/sch_pcb/$REPO.kicad_sch\",\"board\":\"hw/sch_pcb/$REPO.kicad_pcb\"}]}"
fi
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
ERC:
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/erc.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}/${{ matrix.name }}
DRC:
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/drc.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}/${{ matrix.name }}
schematics:
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/schematics.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_docs/${{ matrix.name }}
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_sch_${{ matrix.name }}
path: ${{ env.dir }}_docs/${{ matrix.name }}/**
placement:
name: "Placement and XML"
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/placement.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_docs/${{ matrix.name }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/xml.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_docs/${{ matrix.name }}
- name: "Collect files"
run: |
tree
mkdir doc_xml_${{ matrix.name }} || true
mv ${{ matrix.dir }}/*.xml doc_xml_${{ matrix.name }}/ || true
mv ${{ env.dir }}_docs/${{ matrix.name }}/*.csv doc_xml_${{ matrix.name }}/ || true
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_xml_${{ matrix.name }}
path: doc_xml_${{ matrix.name }}
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_placement_${{ matrix.name }}
path: |
${{ env.dir }}_docs/${{ matrix.name }}/**/*.pdf
${{ env.dir }}_docs/${{ matrix.name }}/**/*.svg
${{ env.dir }}_docs/${{ matrix.name }}/**/*.csv
report:
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/report.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_report/${{ matrix.name }}
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_report_${{ matrix.name }}
path: ${{ env.dir }}_report/${{ matrix.name }}/
ibom:
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/ibom.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_ibom/${{ matrix.name }}
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_ibom_${{ matrix.name }}
path: ${{ env.dir }}_ibom/${{ matrix.name }}/
gerbers:
name: "Fabrication: Gerbers, Drill and PnP"
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/gerbers.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_gerbers/${{ matrix.name }}
verbose: 3
- name: "Rename output"
run: for file in $(find ${{ env.dir }}_gerbers/${{ matrix.name }} -type f); do sudo mv "${file}" "${file//${{ matrix.name }}/${{ env.branch }}}" || true ; done
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: hw_cam_profi_${{ matrix.name }}
path: ${{ env.dir }}_gerbers/${{ matrix.name }}/gerbers/**
graphics:
name: "CAD and render"
needs: [discover]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.pat }}
ref: ${{ github.head_ref }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/cad.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_cad/${{ matrix.name }}
- uses: INTI-CMNB/KiBot@v2_dk10
with:
config: ${{ env.kibot }}/render.kibot.yaml
schema: ${{ matrix.schema }}
board: ${{ matrix.board }}
dir: ${{ env.dir }}_img/${{ matrix.name }}
verbose: 3
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_cad_${{ matrix.name }}
path: ${{ env.dir }}_cad/${{ matrix.name }}/**
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_img_${{ matrix.name }}
path: ${{ env.dir }}_img/${{ matrix.name }}/img/**
cad_postprocess:
name: "CAD postprocess"
needs: [discover, graphics]
strategy:
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: doc_cad_${{ matrix.name }}
path: doc_cad
- name: Install CAD postprocess tools
run: |
sudo apt-get update
sudo apt-get install -y admesh
- name: Convert STL to binary STL and compress large STEP
run: |
threshold=$((50 * 1024 * 1024))
find doc_cad -type f -name '*.stl' | while read -r f; do
tmp="${f}.tmp"
admesh --write-binary-stl="$tmp" "$f"
mv "$tmp" "$f"
done
find doc_cad -type f -name '*.step' | while read -r f; do
size=$(stat -c%s "$f")
if [ "$size" -gt "$threshold" ]; then
gzip -9 "$f"
fi
done
- name: Diagnostic output sizes
run: |
echo "STL files:"
find doc_cad -type f -name '*.stl' -exec stat -c '%n %s bytes' {} \;
echo "STEP/STEP.GZ files:"
find doc_cad -type f \( -name '*.step' -o -name '*.step.gz' \) -exec stat -c '%n %s bytes' {} \;
- uses: actions/upload-artifact@v4
with:
name: doc_cad_processed_${{ matrix.name }}
path: doc_cad/**
UPDATE_REPO:
runs-on: ubuntu-latest
name: Update repository
needs: [cad_postprocess, gerbers, schematics, placement, report, ibom]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.pat }}
- run: |
git pull --force --rebase || true
git submodule update --remote || true
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Remove old manufacturing data
run: |
rm -rf hw/cam_profi || true
rm -rf doc/gen || true
- name: Extract to right position
run: |
mkdir -p doc/gen doc/img/render hw/cam_profi
if [ -f hw/sch_pcb/PCB_matrix.yaml ]; then
NAMES=$(python3 -c "import yaml; [print(p['name']) for p in yaml.safe_load(open('hw/sch_pcb/PCB_matrix.yaml'))]")
for name in $NAMES; do
mkdir -p doc/gen/$name/img doc/gen/$name/mesh
mkdir -p hw/cam_profi/$name/gbr hw/cam_profi/$name/assembly hw/cam_profi/$name/ibom
cp -r doc_img_$name/* doc/gen/$name/img/ || true
cp -r doc_cad_processed_$name/cad/* doc/gen/$name/ || true
cp -r hw_cam_profi_$name/* hw/cam_profi/$name/gbr/ || true
cp -r doc_sch_$name/docs/* doc/gen/$name/ || true
cp -r doc_xml_$name/* hw/cam_profi/$name/ || true
cp -r doc_sch_$name/img/pcb/* doc/gen/$name/img/ || true
cp -r doc_placement_$name/* hw/cam_profi/$name/assembly/ || true
cp -r doc_report_$name/* doc/gen/$name/ || true
cp -r doc_ibom_$name/docs/* hw/cam_profi/$name/ibom/ || true
mv hw/cam_profi/$name/gbr/PnP/ hw/cam_profi/$name/assembly/ || true
done
else
REPO="${{ github.event.repository.name }}"
mkdir -p doc/gen/img doc/gen/mesh
mkdir -p hw/cam_profi/gbr hw/cam_profi/assembly hw/cam_profi/ibom
cp -r doc_img_$REPO/* doc/gen/img/ || true
cp -r doc_cad_processed_$REPO/cad/* doc/gen/ || true
cp -r hw_cam_profi_$REPO/* hw/cam_profi/gbr/ || true
cp -r doc_sch_$REPO/docs/* doc/gen/ || true
cp -r doc_xml_$REPO/* hw/cam_profi/ || true
cp -r doc_sch_$REPO/img/pcb/* doc/gen/img/ || true
cp -r doc_placement_$REPO/* hw/cam_profi/assembly/ || true
cp -r doc_report_$REPO/* doc/gen/ || true
cp -r doc_ibom_$REPO/docs/* hw/cam_profi/ibom/ || true
mv hw/cam_profi/gbr/PnP/ hw/cam_profi/assembly/ || true
fi
rm -rf doc_img_* doc_cad_* doc_cad_processed_* hw_cam_profi_* doc_sch_* \
doc_placement_* doc_xml_* doc_report_* doc_ibom_* || true
git add . -f
- uses: stefanzweifel/git-auto-commit-action@v4.16.0
with:
commit_message: Update actions products
add_options: '-A -f'