Skip to content

Update workflow files #34

Update workflow files

Update workflow files #34

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'
- 'doc/assets'
workflow_dispatch:
env:
schema: "hw/sch_pcb/${{ github.event.repository.name }}.kicad_sch"
board: "hw/sch_pcb/${{ github.event.repository.name }}.kicad_pcb"
project: ${{ github.event.repository.name }}
branch: ${{ github.head_ref || github.ref_name }}
dir: "hw/out"
kibot: "doc/assets/kibot"
jobs:
ERC:
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_dk9
with:
config: ${{ env.kibot }}/erc.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}
DRC:
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_dk9
with:
config: ${{ env.kibot }}/drc.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}
schematics:
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_dk9
with:
config: ${{ env.kibot }}/schematics.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_docs
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_sch
path: ${{ env.dir }}_docs/**
placement:
name: "Placement and XML"
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_dk9
with:
config: ${{ env.kibot }}/placement.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_docs
- uses: INTI-CMNB/KiBot@v2_dk9
with:
config: ${{ env.kibot }}/xml.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_docs
# - name: "Rename output"
# run: |
# for file in $(find ${{env.dir}} -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" ; done
# for file in $(find ${{env.dir}}_docs -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" ; done
- name: "Collect files"
run: |
tree
mkdir doc_xml || true ;
mv hw/sch_pcb/*.xml doc_xml/ || true;
mv hw/out_docs/*.csv doc_xml/ || true;
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_xml
path: |
doc_xml
# Zde se zahazuji debugovaci videa
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_placement
path: |
${{ env.dir }}_docs/**/*.pdf
${{ env.dir }}_docs/**/*.svg
${{ env.dir }}_docs/**/*.csv
report:
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_dk9
with:
config: ${{ env.kibot }}/report.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_report
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_report
path: ${{ env.dir }}_report/
ibom:
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_dk9
with:
config: ${{ env.kibot }}/ibom.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_ibom
- name: "Rename output"
run: for file in $(find ${{env.dir}} -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" ; done
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_ibom
path: ${{ env.dir }}_ibom/
# fabrications
gerbers:
name: "Fabrication: Gerebrs, Drill and PnP"
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_dk9
with:
config: ${{ env.kibot }}/gerbers.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_gerbers
verbose: 3
- name: "Rename output"
run: for file in $(find ${{env.dir}}_gerbers -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" || true ; done
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: hw_cam_profi
path: ${{ env.dir }}_gerbers/gerbers/**
graphics:
name: "CAD and render"
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_dk9
with:
config: ${{ env.kibot }}/cad.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_cad
- uses: INTI-CMNB/KiBot@v2_dk9
with:
config: ${{ env.kibot }}/render.kibot.yaml
schema: ${{ env.schema }}
board: ${{ env.board }}
dir: ${{ env.dir }}_img
verbose: 3
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_cad
path: ${{ env.dir }}_cad/**
- uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: doc_img
path: ${{ env.dir }}_img/img/**
cad_postprocess:
name: "CAD postprocess"
runs-on: ubuntu-latest
needs: [graphics]
steps:
- uses: actions/download-artifact@v4
with:
name: doc_cad
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
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 a Build Artifact
uses: actions/download-artifact@v4
- name: Remove old manufarturing data
run: |
rm -r hw/cam_profi || true
rm -r doc/gen || true
- name: Extract to right position
run: |
mkdir doc || true
mkdir doc/gen || true
mkdir doc/gen/img || true
mkdir doc/gen/mesh || true
mkdir doc/img || true
mkdir doc/img/render || true
mkdir hw || true
mkdir hw/cam_profi || true
mkdir hw/cam_profi/gbr || true
mkdir hw/cam_profi/assembly || true
mkdir hw/cam_profi/ibom || true
cp -r doc_img/* doc/gen/img || true
cp -r doc_cad_processed/cad/* doc/gen || true
cp -r hw_cam_profi/* hw/cam_profi/gbr || true
cp -r doc_sch/docs/* doc/gen || true
cp -r doc_xml/* hw/cam_profi || true
cp -r doc_sch/img/pcb/* doc/gen/img || true
mv -r doc_placement/PnP/* hw/cam_profi/assembly || true
cp -r doc_placement/* hw/cam_profi/assembly || true
cp -r doc_report/* doc/gen || true
cp -r doc_ibom/docs/* hw/cam_profi || true
mv hw/cam_profi/gbr/PnP/ hw/cam_profi/assembly || true
rm -r doc_img || true
rm -r doc_cad || true
rm -r doc_cad_processed || true
rm -r hw_cam_profi || true
rm -r doc_sch || true
rm -r doc_placement || true
rm -r doc_xml || true
rm -r doc_report || true
rm -r 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'