Kicad diff action (#1691)

* add kicad diff workflow

* download KiCad-Diff and fix path

* add wildcards

* wat me

* not capitalized as in the help menu grrr

* run script instead of all in workflow

* actually it is supposed to be capitalized

* upload results

* check for dir existence

* check RUSEFI_FTP_SERVER

* fix indentation

* we dont actually need xvfb

* make directory

* remove extension from dir name

* use find exec

* export and use bash

* fix quotes
This commit is contained in:
David Holdeman 2020-08-13 19:38:50 -05:00 committed by GitHub
parent 13679462d5
commit 162d36a5b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

37
.github/workflows/gen-diffs.yaml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Generate Kicad Diffs
on:
push:
paths:
- 'hardware/**'
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Install ncftp, kicad, and tk bindings
run: |
sudo add-apt-repository ppa:js-reynaud/kicad-5.1
sudo apt-get update
sudo apt-get install ncftp kicad python3-tk
- name: Get KiCad-Diff
run: git clone https://github.com/Gasman2014/KiCad-Diff.git
- name: Set FTP variables
run: |
if [ "${{github.event_name}}" = "push" ] && [ "${{github.ref}}" = "refs/heads/master" ]; then
echo "::set-env name=RUSEFI_FTP_SERVER::${{secrets.RUSEFI_FTP_SERVER}}";
echo "::set-env name=RUSEFI_DOXYGEN_FTP_USER::${{secrets.RUSEFI_DOXYGEN_FTP_USER}}";
echo "::set-env name=RUSEFI_DOXYGEN_FTP_PASS::${{secrets.RUSEFI_DOXYGEN_FTP_PASS}}";
fi
- name: Generate diffs
working-directory: ./hardware
run: bash generate_diffs.sh

View File

@ -0,0 +1,12 @@
#!/bin/bash
function gendiffs() {
../KiCad-Diff/kidiff_linux.py -w -s Git -b $(git rev-parse --short HEAD~1) -a $(git rev-parse --short HEAD) -d :0 $1
if [ -d $(dirname "$1")/plots ] && [ -n "$RUSEFI_FTP_SERVER" ]; then
echo "mkdir diffs/plots_$(basename "$1" .kicad_pcb)" | ncftp -u "$RUSEFI_DOXYGEN_FTP_USER" -p "$RUSEFI_DOXYGEN_FTP_PASS" "$RUSEFI_FTP_SERVER"
ncftpput -R -v -u "$RUSEFI_DOXYGEN_FTP_USER" -p "$RUSEFI_DOXYGEN_FTP_PASS" "$RUSEFI_FTP_SERVER" /diffs/plots_$(basename "$1" .kicad_pcb) $(dirname "$1")/plots
fi
}
export -f gendiffs
find . -name "*.kicad_pcb" -exec bash -c 'gendiffs "$0"' {} \;