Skip to content

Commit

Permalink
use external Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
42CrMo4 committed Feb 19, 2024
1 parent c7ab77d commit 16f0df5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 406 deletions.
125 changes: 2 additions & 123 deletions .github/workflows/generate_output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ name: CI output design
# Controls when the action will run. Triggers the workflow on push or pull request
# events that happen on all branches
on:
workflow_call:
push:
# branches: [ main ]
paths:
Expand All @@ -26,125 +25,5 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
ERC-DRC:
runs-on: ubuntu-latest
container: ghcr.io/inti-cmnb/kicad6_auto:1.6.3

steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Run ERC & DRC
run: |
[ -f *.kicad_sch ] && kiplot -d Fabrication_temp -s update_xml,run_drc -i
[ -f *.kicad_pcb ] && kiplot -d Fabrication_temp -s update_xml,run_erc -i
#- name: Retrieve results
# uses: actions/upload-artifact@v3
# with:
# name: ERC-DRC_Output
# path: 'Fabrication_temp'

# DRC:
# runs-on: ubuntu-latest
# container: setsoft/kicad_auto:dev_k6
# needs: ERC

# steps:
# - uses: actions/checkout@v3

# - name: Run DRC
# run: |
# [ -f *.kicad_pcb ] && kiplot -d Fabrication_temp -s update_xml,run_erc -i
#- name: Retrieve results
# uses: actions/upload-artifact@v3
# with:
# name: ERC-DRC_Output
# path: 'Fabrication_temp'

Fabrication:
name: Fabrication files
runs-on: ubuntu-latest
container: ghcr.io/inti-cmnb/kicad6_auto:1.6.3
# needs: ERC

steps:
- name: Update system repositories, Install Required Libraries
run: |
apt update
apt -y install git
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Assign variables from project.properties to Env variable
run: |
cat project.properties | egrep -v "^\s*(#|$)" >> $GITHUB_ENV
# https://kvz.io/cat-a-file-without-the-comments.html

- name: Update the Schematic with the git hash
run: |
export COMMIT=$(git rev-parse --short HEAD)
echo "COMMIT = ${COMMIT}"
sed -i "s!<<hash>>!Git-${COMMIT}!" *.kicad_sch
sed -i "s!<<project_name>>!${{ env.project_name }}!" *.kicad_sch
sed -i "s!<<date>>!$(date +'%Y-%m-%d')!" *.kicad_sch
sed -i "s!<<ID>>!${{ env.ID_prefix }}${{ env.ID }}!" *.kicad_sch
- name: Run Schematic and BOM
run: |
[ -f *.kicad_sch ] && kiplot -d Fabrication_temp -s all print_sch interactive_bom diff_sch
- name: Update the PCBs with the git hash
run: |
export COMMIT=$(git rev-parse --short HEAD)
echo "COMMIT = ${COMMIT}"
sed -i "s!<<hash>>!Git-${COMMIT}!" *.kicad_pcb
sed -i "s!<<project_name>>!${{ env.project_name }}!" *.kicad_pcb
sed -i "s!<<date>>!$(date +'%Y-%m-%d')!" *.kicad_pcb
sed -i "s!<<website_link>>!${{ env.Website_link }}/${{ env.ID_prefix }}/${{ env.ID }}!" *.kicad_pcb
sed -i "s!<<ID>>!ID:${{ env.ID_prefix }}${{ env.ID }}!" *.kicad_pcb
- name: Run PCB stuff
run: |
[ -f *.kicad_pcb ] && kiplot -d Fabrication_temp -s all pcb_top_b pcb_bottom_b 3dview diff_pcb #print_front print_back
- name: Rename the Schematic and PCB Raw Files
run: |
mv *.kicad_sch ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}.kicad_sch
mv *.kicad_pcb ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}.kicad_pcb
- name: Retrieve results kicad_pcb with the git hash
uses: actions/upload-artifact@v3
with:
name: ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_Kicad_raw
path: '${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}.kicad_*'

- name: Renaming Files
run: |
cd Fabrication_temp
for file in *; do mv -v ${file} ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_${file}; done #https://unix.stackexchange.com/a/389516
# mkdir PCB_Sheet
# mv *Sheet.* PCB_Sheet/
mkdir BoM
mv *iBoM.* BoM/
- name: Retrieve results
uses: actions/upload-artifact@v3
with:
name: ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_Output
path: 'Fabrication_temp'

- name: Run STEP
run: |
[ -f *.kicad_pcb ] && kiplot -d Fabrication_temp_step -s all step
cd Fabrication_temp_step
mv *.step ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}.step
- name: Retrieve results
uses: actions/upload-artifact@v3
with:
name: ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_Output_STEP
path: 'Fabrication_temp_step'
call-workflow-passing-data:
uses: 42CrMo4/KiCad_Workflows/.github/workflows/generate_output.yml@main
117 changes: 2 additions & 115 deletions .github/workflows/rc_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: RC Release Design

# Controls when the action will run. Triggers the workflow on tags on push or pull request
on:
workflow_call:
push:
tags:
- 'v[0-9]+.[0-9]+-rc[0-9]+'
Expand All @@ -16,117 +15,5 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
ERC:
runs-on: ubuntu-latest
container: ghcr.io/inti-cmnb/kicad6_auto:1.6.3

steps:
- uses: actions/checkout@v3

- name: Run ERC
run: |
[ -f *.kicad_sch ] && kiplot -d Fabrication_temp -s update_xml,run_drc -i
# - name: Retrieve results
# uses: actions/upload-artifact@v1
# with:
# name: ERC_Output
# path: Fabrication_temp

DRC:
runs-on: ubuntu-latest
container: ghcr.io/inti-cmnb/kicad6_auto:1.6.3
needs: ERC

steps:
- uses: actions/checkout@v3

- name: Run DRC
run: |
[ -f *.kicad_pcb ] && kiplot -d Fabrication_temp -s update_xml,run_erc -i
# - name: Retrieve results
# uses: actions/upload-artifact@v1
# with:
# name: DRC_Output
# path: Fabrication_temp

Fabrication:
name: Fabrication files
runs-on: ubuntu-latest
permissions:
contents: write
container: ghcr.io/inti-cmnb/kicad6_auto:1.6.3
needs: DRC

steps:
- name: Update system repositories, Install Required Libraries
run: |
apt update
apt -y install git
- name: Checkout Repository
uses: actions/checkout@v3

- name: Assign variables from project.properties to Env variable
run: |
cat project.properties | egrep -v "^\s*(#|$)" >> $GITHUB_ENV
- name: Update the Schematic with the git hash
run: |
export COMMIT=$(git rev-parse --short HEAD)
echo "COMMIT = ${COMMIT}"
sed -i "s!<<hash>>!Git-${COMMIT}!" *.kicad_sch
sed -i "s!<<project_name>>!${{ env.project_name }}!" *.kicad_sch
sed -i "s!<<date>>!$(date +'%Y-%m-%d')!" *.kicad_sch
sed -i "s!<<version>>!${{ github.ref_name }}!" *.kicad_sch
sed -i "s!<<ID>>!ID:${{ env.ID_prefix }}${{ env.ID }}!" *.kicad_sch
mv *.kicad_sch ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_${{ github.ref_name }}.kicad_sch
- name: Update the PCBs with the git hash
run: |
export COMMIT=$(git rev-parse --short HEAD)
echo "COMMIT = ${COMMIT}"
sed -i "s!<<hash>>!Git-${COMMIT}!" *.kicad_pcb
sed -i "s!<<project_name>>!${{ env.project_name }}!" *.kicad_pcb
sed -i "s!<<date>>!$(date +'%Y-%m-%d')!" *.kicad_pcb
sed -i "s!<<version>>!${{ github.ref_name }}!" *.kicad_pcb
sed -i "s!<<ID>>!ID:${{ env.ID_prefix }}${{ env.ID }}!" *.kicad_pcb
sed -i "s!<<website_link>>!${{ env.Website_link }}/${{ env.ID_prefix }}/${{ env.ID }}!" *.kicad_pcb
mv *.kicad_pcb ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_${{ github.ref_name }}.kicad_pcb
- name: Update the release note with the RepoName / Tag
run: |
sed -i "s!<<repo_name>>!${{ github.repository }}!g" docs/release_note.md
sed -i "s!<<tag>>!${{ github.ref_name }}!g" docs/release_note.md
sed -i "s!<<project_name>>!${{ env.project_name }}!g" docs/release_note.md
sed -i "s!<<version>>!${{ github.ref_name }}!g" docs/release_note.md
sed -i "s!<<ID>>!${{ env.ID_prefix }}${{ env.ID }}!g" docs/release_note.md
- name: Run Schematic and BOM
run: |
[ -f *.kicad_sch ] && kiplot -d Fabrication_temp -s all print_sch interactive_bom
- name: Run PCB
run: |
[ -f *.kicad_pcb ] && kiplot -d Fabrication_temp -s all print_front print_back pcb_top_b pcb_bottom_b step
- name: Run Gerber
run: |
[ -f *.kicad_pcb ] && kiplot -d Gerber -s all gerbers gerber_drills
- name: Renaming Files
run: |
cd Fabrication_temp
for file in *; do mv -v ${file} ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_${{ github.ref_name }}_${file}; done #https://unix.stackexchange.com/a/389516
- uses: vimtor/[email protected]
with:
files: Gerber/
recursive: false
dest: ${{ env.ID_prefix }}${{ env.ID }}_${{ env.project_name }}_${{ github.ref_name }}_Gerber.zip

- uses: ncipollo/release-action@v1
with:
artifacts: "Fabrication_temp/*, *.kicad_sch, *.kicad_pcb, *Gerber.zip " # Fabrication_temp/BoM/*ibom*, *.kicad_sch, Gerber.zip, *.kicad_pcb, Fabrication_temp/3D/*.step, Fabrication_temp/PCB/blue/*"
bodyFile: "docs/release_note.md"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
call-workflow-passing-data:
uses: 42CrMo4/KiCad_Workflows/.github/workflows/rc_release.yml@main
Loading

0 comments on commit 16f0df5

Please sign in to comment.