electrical_boards #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "electrical_boards" | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- '.github/workflows/electrical_boards.yml' | |
- '.github/workflows/convert_bottom_position.py' | |
- 'Electrical/Design/**' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
generate-artifacts: | |
name: kicad export | |
runs-on: ubuntu-latest | |
container: "setsoft/kicad_auto:ki8" | |
strategy: | |
fail-fast: false | |
matrix: | |
board: | |
- 'PCBA-KNOT' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run PCB stuff | |
run: | | |
make -C Electrical/Design/${{ matrix.board }} | |
- name: Print errors | |
if: ${{ always() }} | |
run: | | |
cat Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}-drc.txt | |
cat Electrical/Design/${{ matrix.board }}/kibot_error.log | |
- name: Set Date | |
run: echo "action_date=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_ENV | |
- name: Convert position file | |
run: | | |
python3 .github/workflows/convert_bottom_position.py ../../Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-both_pos.csv ../../Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-both_pos_fixed.csv | |
rm Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-both_pos.csv | |
- name: Zipping gerber | |
uses: vimtor/action-zip@v1 | |
with: | |
files: Electrical/Design/${{ matrix.board }}/mfg-bot/JLCPCB | |
dest: Electrical/Design/${{ matrix.board }}/mfg-bot/mfg/${{ matrix.board }}-gerber.zip | |
- name: Rename pdf files and removing non-zipped gerber files | |
run: | | |
mv Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}-erc.txt Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_erc.txt | |
mv Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}-drc.txt Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_drc.txt | |
mv Electrical/Design/${{ matrix.board }}/mfg-bot/Schematic.pdf Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_Schematic.pdf | |
mv Electrical/Design/${{ matrix.board }}/mfg-bot/PCB_Top.pdf Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_PCB_Top.pdf | |
mv Electrical/Design/${{ matrix.board }}/mfg-bot/PCB_Bottom.pdf Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_PCB_Bottom.pdf | |
mv Electrical/Design/${{ matrix.board }}/mfg-bot/kibot_errors.filter Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_kibot_errors.filter | |
mv Electrical/Design/${{ matrix.board }}/kibot_error.log Electrical/Design/${{ matrix.board }}/mfg-bot/${{ matrix.board }}_kibot_error.log | |
rm -r Electrical/Design/${{ matrix.board }}/mfg-bot/JLCPCB | |
- name: Upload results | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "result_${{ matrix.board }}_${{ env.action_date }}" | |
path: | | |
Electrical/Design/${{ matrix.board }}/mfg-bot/ | |
if-no-files-found: warn | |
deploy-results: | |
runs-on: ubuntu-latest | |
needs: generate-artifacts | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: preview | |
- name: Download reports' artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: download | |
- name: Collecting files | |
run: | | |
# Create the temp folder if it doesn't exist | |
mkdir -p Preview/Electrical | |
# Loop through each subdirectory in the download folder | |
for subdirectory in download/*; do | |
# Check if it is a directory | |
if [ -d "$subdirectory" ]; then | |
# Copy the contents of the subdirectory to the temp folder | |
cp -r "$subdirectory"/* "Preview/Electrical/" | |
fi | |
done | |
- name: Commit the files | |
run: | | |
git config --global user.name ${{ github.actor }} | |
git config --global user.email ${{ github.actor }}@users.noreply.github.com | |
git add Preview/* | |
git commit -m "BOT ${{ github.workflow }} ${{ github.sha }}" | |
git push |