|
| 1 | +name: Kicad - production files generator |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + paths: |
| 10 | + - '**.kicad_pcb' |
| 11 | + - '**.kicad_sch' |
| 12 | + - '**.kicad_pro' |
| 13 | + - '**.yml' |
| 14 | + - 'doc/assets' |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +env: |
| 18 | + schema: "hw/sch_pcb/${{ github.event.repository.name }}.kicad_sch" |
| 19 | + board: "hw/sch_pcb/${{ github.event.repository.name }}.kicad_pcb" |
| 20 | + project: ${{ github.event.repository.name }} |
| 21 | + branch: ${{ github.head_ref || github.ref_name }} |
| 22 | + dir: "hw/out" |
| 23 | + kibot: "doc/assets/kibot" |
| 24 | + |
| 25 | +jobs: |
| 26 | + ERC: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + continue-on-error: true |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + submodules: recursive |
| 33 | + token: ${{ secrets.pat }} |
| 34 | + ref: ${{ github.head_ref }} |
| 35 | + |
| 36 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 37 | + with: |
| 38 | + config: ${{ env.kibot }}/erc.kibot.yaml |
| 39 | + schema: ${{ env.schema }} |
| 40 | + board: ${{ env.board }} |
| 41 | + dir: ${{ env.dir }} |
| 42 | + |
| 43 | + |
| 44 | + DRC: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + continue-on-error: true |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + submodules: recursive |
| 51 | + token: ${{ secrets.pat }} |
| 52 | + ref: ${{ github.head_ref }} |
| 53 | + |
| 54 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 55 | + with: |
| 56 | + config: ${{ env.kibot }}/drc.kibot.yaml |
| 57 | + schema: ${{ env.schema }} |
| 58 | + board: ${{ env.board }} |
| 59 | + dir: ${{ env.dir }} |
| 60 | + |
| 61 | + |
| 62 | + schematics: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + continue-on-error: true |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + with: |
| 68 | + submodules: recursive |
| 69 | + token: ${{ secrets.pat }} |
| 70 | + ref: ${{ github.head_ref }} |
| 71 | + |
| 72 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 73 | + with: |
| 74 | + config: ${{ env.kibot }}/schematics.kibot.yaml |
| 75 | + schema: ${{ env.schema }} |
| 76 | + board: ${{ env.board }} |
| 77 | + dir: ${{ env.dir }}_docs |
| 78 | + |
| 79 | + - uses: actions/upload-artifact@v4 |
| 80 | + if: ${{ success() }} |
| 81 | + with: |
| 82 | + name: doc_sch |
| 83 | + path: ${{ env.dir }}_docs/** |
| 84 | + |
| 85 | + placement: |
| 86 | + name: "Placement and XML" |
| 87 | + runs-on: ubuntu-latest |
| 88 | + #continue-on-error: true |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + with: |
| 92 | + submodules: recursive |
| 93 | + token: ${{ secrets.pat }} |
| 94 | + ref: ${{ github.head_ref }} |
| 95 | + |
| 96 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 97 | + with: |
| 98 | + config: ${{ env.kibot }}/placement.kibot.yaml |
| 99 | + schema: ${{ env.schema }} |
| 100 | + board: ${{ env.board }} |
| 101 | + dir: ${{ env.dir }}_docs |
| 102 | + |
| 103 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 104 | + with: |
| 105 | + config: ${{ env.kibot }}/xml.kibot.yaml |
| 106 | + schema: ${{ env.schema }} |
| 107 | + board: ${{ env.board }} |
| 108 | + dir: ${{ env.dir }}_docs |
| 109 | + |
| 110 | +# - name: "Rename output" |
| 111 | +# run: | |
| 112 | +# for file in $(find ${{env.dir}} -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" ; done |
| 113 | +# for file in $(find ${{env.dir}}_docs -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" ; done |
| 114 | + |
| 115 | + - name: "Collect files" |
| 116 | + run: | |
| 117 | + tree |
| 118 | + mkdir doc_xml || true ; |
| 119 | + mv hw/sch_pcb/*.xml doc_xml/ || true; |
| 120 | + mv hw/out_docs/*.csv doc_xml/ || true; |
| 121 | + |
| 122 | + - uses: actions/upload-artifact@v4 |
| 123 | + if: ${{ success() }} |
| 124 | + with: |
| 125 | + name: doc_xml |
| 126 | + path: | |
| 127 | + doc_xml |
| 128 | +
|
| 129 | + # Zde se zahazuji debugovaci videa |
| 130 | + - uses: actions/upload-artifact@v4 |
| 131 | + if: ${{ success() }} |
| 132 | + with: |
| 133 | + name: doc_placement |
| 134 | + path: | |
| 135 | + ${{ env.dir }}_docs/**/*.pdf |
| 136 | + ${{ env.dir }}_docs/**/*.svg |
| 137 | + ${{ env.dir }}_docs/**/*.csv |
| 138 | +
|
| 139 | + report: |
| 140 | + runs-on: ubuntu-latest |
| 141 | + #continue-on-error: true |
| 142 | + steps: |
| 143 | + - uses: actions/checkout@v4 |
| 144 | + with: |
| 145 | + submodules: recursive |
| 146 | + token: ${{ secrets.pat }} |
| 147 | + ref: ${{ github.head_ref }} |
| 148 | + |
| 149 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 150 | + with: |
| 151 | + config: ${{ env.kibot }}/report.kibot.yaml |
| 152 | + schema: ${{ env.schema }} |
| 153 | + board: ${{ env.board }} |
| 154 | + dir: ${{ env.dir }}_report |
| 155 | + |
| 156 | + - uses: actions/upload-artifact@v4 |
| 157 | + if: ${{ success() }} |
| 158 | + with: |
| 159 | + name: doc_report |
| 160 | + path: ${{ env.dir }}_report/ |
| 161 | + |
| 162 | + |
| 163 | + ibom: |
| 164 | + runs-on: ubuntu-latest |
| 165 | + continue-on-error: true |
| 166 | + steps: |
| 167 | + - uses: actions/checkout@v4 |
| 168 | + with: |
| 169 | + submodules: recursive |
| 170 | + token: ${{ secrets.pat }} |
| 171 | + ref: ${{ github.head_ref }} |
| 172 | + |
| 173 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 174 | + with: |
| 175 | + config: ${{ env.kibot }}/ibom.kibot.yaml |
| 176 | + schema: ${{ env.schema }} |
| 177 | + board: ${{ env.board }} |
| 178 | + dir: ${{ env.dir }}_ibom |
| 179 | + |
| 180 | + - name: "Rename output" |
| 181 | + run: for file in $(find ${{env.dir}} -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" ; done |
| 182 | + |
| 183 | + - uses: actions/upload-artifact@v4 |
| 184 | + if: ${{ success() }} |
| 185 | + with: |
| 186 | + name: doc_ibom |
| 187 | + path: ${{ env.dir }}_ibom/ |
| 188 | + |
| 189 | + |
| 190 | +# fabrications |
| 191 | + gerbers: |
| 192 | + name: "Fabrication: Gerebrs, Drill and PnP" |
| 193 | + runs-on: ubuntu-latest |
| 194 | + continue-on-error: true |
| 195 | + steps: |
| 196 | + - uses: actions/checkout@v4 |
| 197 | + with: |
| 198 | + submodules: recursive |
| 199 | + token: ${{ secrets.pat }} |
| 200 | + ref: ${{ github.head_ref }} |
| 201 | + |
| 202 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 203 | + with: |
| 204 | + config: ${{ env.kibot }}/gerbers.kibot.yaml |
| 205 | + schema: ${{ env.schema }} |
| 206 | + board: ${{ env.board }} |
| 207 | + dir: ${{ env.dir }}_gerbers |
| 208 | + verbose: 3 |
| 209 | + |
| 210 | + - name: "Rename output" |
| 211 | + run: for file in $(find ${{env.dir}}_gerbers -type f); do sudo mv "${file}" "${file//${{env.project}}/${{env.branch}}}" || true ; done |
| 212 | + |
| 213 | + - uses: actions/upload-artifact@v4 |
| 214 | + if: ${{ success() }} |
| 215 | + with: |
| 216 | + name: hw_cam_profi |
| 217 | + path: ${{ env.dir }}_gerbers/gerbers/** |
| 218 | + |
| 219 | + |
| 220 | + graphics: |
| 221 | + name: "CAD and render" |
| 222 | + runs-on: ubuntu-latest |
| 223 | + #continue-on-error: true |
| 224 | + steps: |
| 225 | + - uses: actions/checkout@v4 |
| 226 | + with: |
| 227 | + submodules: recursive |
| 228 | + token: ${{ secrets.pat }} |
| 229 | + ref: ${{ github.head_ref }} |
| 230 | + |
| 231 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 232 | + with: |
| 233 | + config: ${{ env.kibot }}/cad.kibot.yaml |
| 234 | + schema: ${{ env.schema }} |
| 235 | + board: ${{ env.board }} |
| 236 | + dir: ${{ env.dir }}_cad |
| 237 | + |
| 238 | + - uses: INTI-CMNB/KiBot@v2_dk8 |
| 239 | + with: |
| 240 | + config: ${{ env.kibot }}/render.kibot.yaml |
| 241 | + schema: ${{ env.schema }} |
| 242 | + board: ${{ env.board }} |
| 243 | + dir: ${{ env.dir }}_img |
| 244 | + verbose: 3 |
| 245 | + |
| 246 | + - uses: actions/upload-artifact@v4 |
| 247 | + if: ${{ success() }} |
| 248 | + with: |
| 249 | + name: doc_cad |
| 250 | + path: ${{ env.dir }}_cad/** |
| 251 | + |
| 252 | + - uses: actions/upload-artifact@v4 |
| 253 | + if: ${{ success() }} |
| 254 | + with: |
| 255 | + name: doc_img |
| 256 | + path: ${{ env.dir }}_img/img/** |
| 257 | + |
| 258 | + |
| 259 | + UPDATE_REPO: |
| 260 | + runs-on: ubuntu-latest |
| 261 | + name: Update repository |
| 262 | + needs: [graphics, gerbers, schematics, placement, report, ibom] |
| 263 | + steps: |
| 264 | + - uses: actions/checkout@v4 |
| 265 | + with: |
| 266 | + ref: ${{ github.head_ref }} |
| 267 | + token: ${{ secrets.pat }} |
| 268 | + |
| 269 | + - run: | |
| 270 | + git pull --force --rebase || true |
| 271 | + git submodule update --remote || true |
| 272 | +
|
| 273 | + - name: Download a Build Artifact |
| 274 | + uses: actions/download-artifact@v4 |
| 275 | + |
| 276 | + - name: Remove old manufarturing data |
| 277 | + run: | |
| 278 | + rm -r hw/cam_profi || true |
| 279 | + rm -r doc/gen || true |
| 280 | + |
| 281 | + - name: Extract to right position |
| 282 | + run: | |
| 283 | + |
| 284 | + mkdir doc || true |
| 285 | + mkdir doc/gen || true |
| 286 | + mkdir doc/gen/img || true |
| 287 | + mkdir doc/img || true |
| 288 | + mkdir doc/img/render || true |
| 289 | + mkdir hw || true |
| 290 | + mkdir hw/cam_profi || true |
| 291 | + mkdir hw/cam_profi/gbr || true |
| 292 | + mkdir hw/cam_profi/assembly || true |
| 293 | + mkdir hw/cam_profi/ibom || true |
| 294 | + |
| 295 | + cp -r doc_img/* doc/gen/img || true |
| 296 | + cp -r doc_cad/cad/* doc/gen || true |
| 297 | + cp -r hw_cam_profi/* hw/cam_profi/gbr || true |
| 298 | + cp -r doc_sch/docs/* doc/gen || true |
| 299 | + cp -r doc_xml/* hw/cam_profi || true |
| 300 | + cp -r doc_sch/img/pcb/* doc/gen/img || true |
| 301 | + mv -r doc_placement/PnP/* hw/cam_profi/assembly || true |
| 302 | + cp -r doc_placement/* hw/cam_profi/assembly || true |
| 303 | + cp -r doc_report/* doc/gen || true |
| 304 | + cp -r doc_ibom/docs/* hw/cam_profi || true |
| 305 | + |
| 306 | + mv hw/cam_profi/gbr/PnP/ hw/cam_profi/assembly || true |
| 307 | + |
| 308 | + rm -r doc_img || true |
| 309 | + rm -r doc_cad || true |
| 310 | + rm -r hw_cam_profi || true |
| 311 | + rm -r doc_sch || true |
| 312 | + rm -r doc_placement || true |
| 313 | + rm -r doc_xml || true |
| 314 | + rm -r doc_report || true |
| 315 | + rm -r doc_ibom || true |
| 316 | + |
| 317 | + git add . -f |
| 318 | + |
| 319 | + - uses: stefanzweifel/[email protected] |
| 320 | + with: |
| 321 | + commit_message: Update actions products |
| 322 | + add_options: '-A -f' |
0 commit comments