Skip to content

Commit

Permalink
Added CI (#6)
Browse files Browse the repository at this point in the history
* Added CI

* Added RoHS info

* Fixed silkscreen labels
  • Loading branch information
PatrickBaus authored Nov 21, 2024
1 parent b413d09 commit fadca2f
Show file tree
Hide file tree
Showing 31 changed files with 14,819 additions and 172,563 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "daily"
commit-message:
# Prefix all commit messages with "[gha] "
prefix: "[gha] "

- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "daily"
233 changes: 233 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
name: "Build manufacturing files"

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- "**"
paths:
- '**.kicad_sch'
- '**.kicad_pcb'
- 'footprints.pretty/*'
- 'footprints_project_specific.pretty/*'
- 'libraries/*'
- '.github/workflows/ci.yml'
- 'config.kibot.yaml'
- 'bom.ini'
# Ignore the push event when creating tags
tags-ignore:
- 'v?[0-9]+.[0-9]+.[0-9]+'
release:
types:
- published

env:
SCHEMATIC_FILE: lm399_burnin_board.kicad_sch
PCB_FILE: lm399_burnin_board.kicad_pcb
KIBOT_CONFIG: config.kibot.yaml

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
outputs:
revision: ${{ steps.extract_sch_revision.outputs.value }}
basename: ${{ steps.repo-basename.outputs.value }}

steps:
- name: Download repository
uses: actions/checkout@v4

- name: Parse repository name
id: repo-basename
run: |
echo "value=$(basename ${{ github.repository }})" >> $GITHUB_OUTPUT
shell: bash

- name: Extract schematic revision
id: extract_sch_revision
run: |
echo "value=$(perl -0777 -ne "print /\(title_block.+\(rev \"(.+?)\"\)/sg" ${{ env.SCHEMATIC_FILE }})" >>${GITHUB_OUTPUT}
shell: bash

- name: Extract PCB revision
id: extract_pcb_revision
run: |
echo "value=$(perl -0777 -ne "print /\(title_block.+\(rev \"(.+?)\"\)/sg" ${{ env.PCB_FILE }})" >>${GITHUB_OUTPUT}
shell: bash

- name: Test if the revision number was extracted
if: steps.extract_sch_revision.outputs.value == ''
run: |
echo "::error::Failed to extract revision number from schematic file: ${{ env.SCHEMATIC_FILE }}"
exit 1
shell: bash

- name: Test schematic revision == pcb revision
if: steps.extract_sch_revision.outputs.value != steps.extract_pcb_revision.outputs.value
run: |
echo "::error::Revision number of the schematic (${{ steps.extract_sch_revision.outputs.value }}) does not match PCB (${{ steps.extract_pcb_revision.outputs.value }}) revision."
exit 1
shell: bash

- name: Test for correct git tag
if: github.ref_type == 'tag' && github.ref_name != steps.extract_sch_revision.outputs.value
run: |
echo "::error::Revision number of the schematic/PCB (${{ steps.extract_sch_revision.outputs.value }}) does not match the Github tag (${{ github.ref_name }})."
exit 1
shell: bash

ERC:
name: Run ERC
runs-on: ubuntu-latest
needs: tests

steps:
- name: Download repository
uses: actions/checkout@v4
with:
submodules: true

- name: Run ERC
uses: INTI-CMNB/KiBot@v2_dk8
with:
config: ${{ env.KIBOT_CONFIG }}
schema: ${{ env.SCHEMATIC_FILE }}
dir: generated
skip: run_drc
targets: __NONE__ # Only run preflights

- name: Upload results
uses: actions/upload-artifact@v4
with:
name: ERC_Output
path: generated
retention-days: 7

DRC:
name: Run DRC
runs-on: ubuntu-latest
needs: ERC

steps:
- name: Download repository
uses: actions/checkout@v4
with:
submodules: true

- name: Run DRC
uses: INTI-CMNB/KiBot@v2_dk8
with:
config: ${{ env.KIBOT_CONFIG }}
board: ${{ env.PCB_FILE }}
dir: generated
skip: run_erc
targets: __NONE__ # Only run preflights

- name: Upload results
uses: actions/upload-artifact@v4
with:
name: DRC_Output
path: generated
retention-days: 7

fabrication_output:
name: 'Produce fabrication outputs'
runs-on: ubuntu-latest
needs: [ERC, DRC]
strategy:
matrix:
variant: [ 'default', ]
steps:
- name: Download repository
uses: actions/checkout@v4
with:
submodules: true

- uses: INTI-CMNB/KiBot@v2_dk8
with:
config: ${{ env.KIBOT_CONFIG }}
schema: ${{ env.SCHEMATIC_FILE }}
board: ${{ env.PCB_FILE }}
skip: run_erc,run_drc
variant: ${{ matrix.variant }}
verbose: 0 # use 3 for debugging

- name: Upload bill of materials files as artifact
uses: actions/upload-artifact@v4
with:
name: manufacturing_files-bom-${{ matrix.variant }}
path: bom_files_compressed
retention-days: 7

- name: Upload schematic files as artifact
uses: actions/upload-artifact@v4
with:
name: manufacturing_files-schematics-${{ matrix.variant }}
path: schematics
retention-days: 7

- name: Upload Gerber files as artifact
uses: actions/upload-artifact@v4
with:
name: manufacturing_files-gerber-${{ matrix.variant }}
path: gerber_files_compressed
retention-days: 7

release:
name: 'Upload manufacturing files to release'
runs-on: ubuntu-latest
needs: [tests, fabrication_output]
if: github.event.action == 'published'
strategy:
matrix:
variant: [ 'default', ]
steps:
- name: Download manufacturing files artifact
uses: actions/download-artifact@v4
with:
path: manufacturing_files
pattern: manufacturing_files-*
merge-multiple: true

- name: Display structure of downloaded files
run: ls -R
working-directory: ./manufacturing_files
shell: bash

- name: Append BOM (bill of materials) as asset
if: github.event.action == 'published'
run: |
mv "./manufacturing_files/bom_(${{ matrix.variant }}).zip" ${{ needs.tests.outputs.basename }}_bom_${{ needs.tests.outputs.revision }}_${{ matrix.variant }}.zip
gh release upload ${{ github.ref_name }} ${{ needs.tests.outputs.basename }}_bom_${{ needs.tests.outputs.revision }}_${{ matrix.variant }}.zip#"Bill of materials for the ${{ matrix.variant }} variant (zip)" --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

- name: Append schematics as asset
if: github.event.action == 'published'
run: |
mv "./manufacturing_files/$(basename ${{ env.SCHEMATIC_FILE }} .kicad_sch)_schematics_${{ needs.tests.outputs.revision }}_(${{ matrix.variant }}).pdf" ${{ needs.tests.outputs.basename }}_schematics_${{ needs.tests.outputs.revision }}_${{ matrix.variant }}.pdf
gh release upload ${{ github.ref_name }} ${{ needs.tests.outputs.basename }}_schematics_${{ needs.tests.outputs.revision }}_${{ matrix.variant }}.pdf#"Schematics for the ${{ matrix.variant }} variant (pdf)" --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

- name: Append position files as asset
if: github.event.action == 'published'
run: |
mv "./manufacturing_files/pos_(${{ matrix.variant }}).zip" ${{ needs.tests.outputs.basename }}_position_${{ needs.tests.outputs.revision }}_${{ matrix.variant }}.zip
gh release upload ${{ github.ref_name }} ${{ needs.tests.outputs.basename }}_position_${{ needs.tests.outputs.revision }}_${{ matrix.variant }}.zip#"Pick & Place position files for the ${{ matrix.variant }} variant (zip)" --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

- name: Append Gerber files as asset
if: github.event.action == 'published' && matrix.variant == 'default'
run: |
mv "./manufacturing_files/gerbers_(${{ matrix.variant }}).zip" ${{ needs.tests.outputs.basename }}_gerber_${{ needs.tests.outputs.revision }}_all.zip
gh release upload ${{ github.ref_name }} ${{ needs.tests.outputs.basename }}_gerber_${{ needs.tests.outputs.revision }}_all.zip#"Gerber files for all variants (zip)" --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ Thumbs.db
*.xml
_autosave-*
*-cache.lib
*.lck
fp-info-cache
footprints_project_specific.3dshapes

# KiCAD 6 Files #
*-backups
*.kicad_prl

# KiCAD 7 Files #
\#auto_saved_files#

# Automatically generated files #
#################################
gerber/*
/*.csv
/*.xlsx
51 changes: 34 additions & 17 deletions bom.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; If 'ignore_dnf' option is set to 1, rows that are not to be fitted on the PCB will not be written to the BoM file
ignore_dnf = 1
; If 'use_alt' option is set to 1, grouped references will be printed in the alternate compressed style eg: R1-R7,R18
use_alt = 0
use_alt = 1
; If 'alt_wrap' option is set to and integer N, the references field will wrap after N entries are printed
alt_wrap = 0
; If 'number_rows' option is set to 1, each row in the BoM will be prepended with an incrementing row number
Expand All @@ -14,18 +14,20 @@ group_connectors = 1
test_regex = 1
; If 'merge_blank_fields' option is set to 1, component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields = 1
; Specify output file name format, %O is the defined output name, %v is the version, %V is the variant name which will be ammended according to 'variant_file_name_format'.
; Specify output file name format, %O is the defined output name, %v is the version, %V is the variant name which will be amended according to 'variant_file_name_format'.
output_file_name = %O_bom_%v%V
; Specify the variant file name format, this is a unique field as the variant is not always used/specified. When it is unused you will want to strip all of this.
variant_file_name_format = _(%V)
; Field name used to determine if a particular part is to be fitted
fit_field = Config
; Make a backup of the bom before generating the new one, using the following template
make_backup = %O.tmp
;make_backup = %O.tmp
; Default number of boards to produce if none given on CLI with -n
number_boards = 1
; Default PCB variant if none given on CLI with -r
board_variant = ['default']
; Default PCB variant if none given on CLI with -r. Multiple variants can be separated by a comma
;board_variant = PCBA
; Complex variant field processing (disabled by default)
complex_variant = True
; Whether to hide headers from output file
hide_headers = False
; Whether to hide PCB info from output file
Expand All @@ -36,20 +38,31 @@ hide_pcb_info = False
; Titles are case-insensitive
Part Lib
Footprint Lib
Datasheet
Part
DNP
MANF
Config
Sheetpath
sim.enable
Note
;kicost:pricing
;PCBA:MFN
;PCBA:PN
;PCBA:Alternative

[COLUMN_ORDER]
; Columns will apear in the order they are listed here
; Columns will appear in the order they are listed here
; Titles are case-insensitive
Description
Part
Part Lib
Quantity Per PCB
References
Value
MFN
PN
Description
Footprint
Footprint Lib
Quantity Per PCB
Build Quantity
Datasheet
RoHS
Temperature

[GROUP_FIELDS]
; List of fields used for sorting individual components into groups
Expand All @@ -60,6 +73,8 @@ Part Lib
Value
Footprint
Footprint Lib
MFP
PN

[COMPONENT_ALIASES]
; A series of values which are considered to be equivalent for the part name
Expand All @@ -85,11 +100,13 @@ d diode d_small
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
References ^TP[0-9]*
References ^FID
Part mount.*hole
References ^NT[0-9]*
References ^LOGO[0-9]*
References ^SYM[0-9]*
References ^G[0-9]*
References ^FID[0-9]*
References ^H[0-9]*
Part solder.*bridge
Part test.*point
Footprint test.*point
Footprint mount.*hole
Footprint fiducial

Loading

0 comments on commit fadca2f

Please sign in to comment.