Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdyscout committed Jun 12, 2020
1 parent 5e18572 commit 8c904d8
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 18 deletions.
146 changes: 146 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,146 @@
name: test

on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop

jobs:
schematic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: kicad-exports schematic docs
uses: nerdyscout/kicad-exports@master
with:
cmd: schematic
dir: test/docs
board: test/test.kicad_pcb
schematic: test/test.sch
- name: kicad-schematic
uses: andstor/file-existence-action@v1
with:
files: "test/docs/test_schematic.svg, test/docs/test_schematic.pdf"
- uses: actions/upload-artifact@v2
if: success()
with:
name: schematic
path: test/docs/*

bom:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: kicad-exports ibom docs/bom
uses: nerdyscout/kicad-exports@master
with:
cmd: bom
dir: test/docs/bom
board: test/test.kicad_pcb
schematic: test/test.sch
- name: "check output: bom"
if: success()
uses: andstor/file-existence-action@v1
with:
files: "test/docs/bom/ibom.html, test/docs/bom/test.csv, test/docs/bom/test.xlsx"
- uses: actions/upload-artifact@v2
if: success()
with:
name: bom
path: test/docs/bom/*

fabrication:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: kicad-exports fabrication gerber
uses: nerdyscout/kicad-exports@master
with:
cmd: fabrication
dir: test/gerber
board: test/test.kicad_pcb
schematic: test/test.sch
- name: "check output: kiplot-position"
uses: andstor/file-existence-action@v1
with:
files: "test/gerber/test-both-pos.csv"
- name: "check output: kiplot-drills"
uses: andstor/file-existence-action@v1
with:
files: "test/gerber/test-PTH.drl, test/gerber/test-NPTH.drl"
- uses: andstor/file-existence-action@v1
with:
files: "test/gerber/test-PTH-drl.gbr, test/gerber/test-NPTH-drl.gbr"
- name: "check output: kiplot-gerber"
uses: andstor/file-existence-action@v1
with:
files: "test/gerber/test-Edge_Cuts.gbr, test/gerber/test-F_Cu.gbr, test/gerber/test-B_SilkS.gbr"
- uses: actions/upload-artifact@v2
with:
name: gerber
path: test/gerber/*

report:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: kicad-exports report
uses: nerdyscout/kicad-exports@master
with:
cmd: report
dir: test
schematic: test/test.sch
board: test/test.kicad_pcb
- name: "check output: erc"
uses: andstor/file-existence-action@v1
with:
files: "test/test.erc"
- name: "check output: drc"
uses: andstor/file-existence-action@v1
with:
files: "test/test.rpt"
- uses: actions/upload-artifact@v2
with:
name: report
path: test/

tracespace:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: kicad-exports tracespace-board
uses: nerdyscout/kicad-exports@master
with:
cmd: tracespace-board
dir: test/docs/img
schematic: test/test.sch
board: test/test.kicad_pcb
- name: "check output: tracespace-board"
uses: andstor/file-existence-action@v1
with:
files: "test/docs/img/test_Board_Top.svg, test/docs/img/test_Board_Bottom.svg"

- name: kicad-exports tracespace-assembly
uses: nerdyscout/kicad-exports@master
with:
cmd: tracespace-assembly
dir: test/docs/img
schematic: test/test.sch
board: test/test.kicad_pcb
- name: "check output: tracespace-assembly"
uses: andstor/file-existence-action@v1
with:
files: "test/docs/img/test_Assembly_Top.svg, test/docs/img/test_Assembly_Bottom.svg"

- uses: actions/upload-artifact@v2
with:
name: images
path: test/docs/img/*
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -3,7 +3,7 @@
FROM setsoft/kicad_debian as kicad
LABEL MAINTAINER nerdyscout <nerdyscout@posteo.de>
LABEL Description="export various files from KiCad projects"
LABEL VERSION="v0.3"
LABEL VERSION="v1.0"


# update packages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -47,7 +47,7 @@ on:

*1: kicad-exports tries to set schematic and board file automatically. For most commands atleast one of both parameters are requiered, so they are not completly optional.

For examples of more full workflows see [kicad-exports-test](https://github.com/nerdyscout/kicad-exports-test/blob/v0.2/.github/workflows).
For examples of more full workflows see [kicad-exports-test](https://github.com/nerdyscout/kicad-exports/blob/master/.github/workflows/test.yml).

# use kicad-exports local

Expand Down
11 changes: 6 additions & 5 deletions commands.sh
Expand Up @@ -108,6 +108,7 @@ function bom() {
function kicad-bom() {
eeschema_do $VERBOSE bom_xml $SCHEMATIC $DIR
rm -f $DIR/$NAME.xml
rm -f $NAME.xml
}

# REQUIRES: $BOARD
Expand All @@ -122,10 +123,10 @@ function kicad-board() {
# REQUIRES: $NAME.xml
# OPTIONAL: $DIR
# OUTPUT: $DIR/$NAME.xlsx
function kibom-xlsx() {
eeschema_do $VERBOSE bom_xml $SCHEMATIC $DIR
python3 -m kibom $VERBOSE -d $DIR --cfg /opt/kibom/bom.ini $NAME.xml $DIR/$NAME.xlsx
rm -f $NAME.xml
function kibom() {
eeschema_do $VERBOSE bom_xml $SCHEMATIC /tmp
find . -name $NAME.xml -exec mv -t /tmp {} +
python3 -m kibom $VERBOSE -d $DIR --cfg /opt/kibom/bom.ini /tmp/$NAME.xml $DIR/$NAME.xlsx
}

# REQUIRES: $BOARD
Expand All @@ -140,7 +141,7 @@ function ibom() {
# OUTPUT: $DIR/$NAME.xlsx
function kicost() {
eeschema_do $VERBOSE bom_xml $SCHEMATIC /tmp
mv -f $DIR/*.xml /tmp
find . -name $NAME.xml -exec mv -t /tmp {} +
python3 -m kicost -i /tmp/$NAME.xml -o $DIR/$NAME.xlsx -w --eda kicad $PARAMETERS
}

Expand Down
18 changes: 8 additions & 10 deletions kicad-exports.sh
@@ -1,21 +1,18 @@
#!/bin/bash

if [ `basename $0 .sh` == 'kicad-exports' ]; then
echo "running OUTSIDE docker..."
echo "starting docker..."
docker run -it \
--volume $PWD:/mnt \
kicad-exports $@

else
echo "running INSIDE docker..."

export DIR="${2:-$PWD}"
export SCHEMATIC="${3:-$(ls -1 *.sch)}"
export BOARD="${4:-$(ls -1 *.kicad_pcb)}"
export MANUFACTURER="$5"
export PARAMETERS="$6"
export NAME="$(basename -s .kicad_pcb $BOARD)"
export VERBOSE=-v
# export VERBOSE=-v

if [ -n "$VERBOSE" ]; then
echo "DIR=$DIR"
Expand All @@ -25,10 +22,11 @@ else
echo "PARAMETERS=$PARAMETERS"
echo "NAME=$NAME"
echo "VERBOSE=$VERBOSE"

echo $DIR
ls -la $DIR
fi

/commands.sh $1
fi
if [ -n "$SCHEMATIC" ] || [ -n "$BOARD" ]; then
/commands.sh $1
else
echo "neither board nor schematic found!"
fi
fi
2 changes: 1 addition & 1 deletion opt/ibom/ibom.sh
Expand Up @@ -6,4 +6,4 @@ xvfb=$!

export DISPLAY=:99

python3 /opt/ibom/generate_interactive_bom.py $1 $3 --no-browser --dest-dir=$2
python3 /opt/ibom/generate_interactive_bom.py $1 $3 --no-browser --dest-dir=$(realpath $2)

0 comments on commit 8c904d8

Please sign in to comment.