From 16f0df56a256cb50bf52ed948825b6595fbf801d Mon Sep 17 00:00:00 2001 From: 42CrMo4 <44754810+42CrMo4@users.noreply.github.com> Date: Mon, 19 Feb 2024 23:32:33 +0100 Subject: [PATCH] use external Workflows --- .github/workflows/generate_output.yml | 125 +-------------------- .github/workflows/rc_release.yml | 117 +------------------- .github/workflows/release.yml | 140 +----------------------- .github/workflows/update_bom_pcbtop.yml | 32 +----- 4 files changed, 8 insertions(+), 406 deletions(-) diff --git a/.github/workflows/generate_output.yml b/.github/workflows/generate_output.yml index ca2dc34..30494b8 100644 --- a/.github/workflows/generate_output.yml +++ b/.github/workflows/generate_output.yml @@ -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: @@ -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!<>!Git-${COMMIT}!" *.kicad_sch - sed -i "s!<>!${{ env.project_name }}!" *.kicad_sch - sed -i "s!<>!$(date +'%Y-%m-%d')!" *.kicad_sch - sed -i "s!<>!${{ 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!<>!Git-${COMMIT}!" *.kicad_pcb - sed -i "s!<>!${{ env.project_name }}!" *.kicad_pcb - sed -i "s!<>!$(date +'%Y-%m-%d')!" *.kicad_pcb - sed -i "s!<>!${{ env.Website_link }}/${{ env.ID_prefix }}/${{ env.ID }}!" *.kicad_pcb - sed -i "s!<>!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 \ No newline at end of file diff --git a/.github/workflows/rc_release.yml b/.github/workflows/rc_release.yml index 5894aa7..aed17ec 100644 --- a/.github/workflows/rc_release.yml +++ b/.github/workflows/rc_release.yml @@ -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]+' @@ -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!<>!Git-${COMMIT}!" *.kicad_sch - sed -i "s!<>!${{ env.project_name }}!" *.kicad_sch - sed -i "s!<>!$(date +'%Y-%m-%d')!" *.kicad_sch - sed -i "s!<>!${{ github.ref_name }}!" *.kicad_sch - sed -i "s!<>!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!<>!Git-${COMMIT}!" *.kicad_pcb - sed -i "s!<>!${{ env.project_name }}!" *.kicad_pcb - sed -i "s!<>!$(date +'%Y-%m-%d')!" *.kicad_pcb - sed -i "s!<>!${{ github.ref_name }}!" *.kicad_pcb - sed -i "s!<>!ID:${{ env.ID_prefix }}${{ env.ID }}!" *.kicad_pcb - sed -i "s!<>!${{ 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!<>!${{ github.repository }}!g" docs/release_note.md - sed -i "s!<>!${{ github.ref_name }}!g" docs/release_note.md - sed -i "s!<>!${{ env.project_name }}!g" docs/release_note.md - sed -i "s!<>!${{ github.ref_name }}!g" docs/release_note.md - sed -i "s!<>!${{ 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/action-zip@v1.1 - 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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c441029..9d54555 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: Release Design # Controls when the action will run. Triggers the workflow on push or pull request on: - workflow_call: push: tags: - 'v[0-9]+.[0-9]+' @@ -16,140 +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 - - FabSch: - 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!<>!Git-${COMMIT}!" *.kicad_sch - sed -i "s!<>!${{ env.project_name }}!" *.kicad_sch - sed -i "s!<>!$(date +'%Y-%m-%d')!" *.kicad_sch - sed -i "s!<>!${{ github.ref_name }}!" *.kicad_sch - sed -i "s!<>!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!<>!Git-${COMMIT}!" *.kicad_pcb - sed -i "s!<>!${{ env.project_name }}!" *.kicad_pcb - sed -i "s!<>!$(date +'%Y-%m-%d')!" *.kicad_pcb - sed -i "s!<>!${{ github.ref_name }}!" *.kicad_pcb - sed -i "s!<>!ID:${{ env.ID_prefix }}${{ env.ID }}!" *.kicad_pcb - sed -i "s!<>!${{ 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!<>!${{ github.repository }}!g" docs/release_note.md - sed -i "s!<>!${{ github.ref_name }}!g" docs/release_note.md - sed -i "s!<>!${{ env.project_name }}!g" docs/release_note.md - sed -i "s!<>!${{ github.ref_name }}!g" docs/release_note.md - sed -i "s!<>!${{ 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 bom_csv_release - head -n -12 Fabrication_temp/BoM-long.csv > Fabrication_temp/BoM.csv - - - 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/action-zip@v1.1 - 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, *.csv " - bodyFile: "docs/release_note.md" - token: ${{ secrets.GITHUB_TOKEN }} - - Archiv-md: - name: Archive & Renew Release Docs - runs-on: ubuntu-latest - needs: FabSch - steps: - - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Renaming Release note & checklist + copy the template - run: | - cd docs - mv release_note.md release_note_${{ github.ref_name }}.md - mv release_checklist.md release_checklist_${{ github.ref_name }}.md - cp release_template/release_note.md release_note.md - cp release_template/release_checklist.md release_checklist.md - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - repository: . - branch: main - commit_message: Archive & Renew release docs \ No newline at end of file + call-workflow-passing-data: + uses: 42CrMo4/KiCad_Workflows/.github/workflows/release.yml@main \ No newline at end of file diff --git a/.github/workflows/update_bom_pcbtop.yml b/.github/workflows/update_bom_pcbtop.yml index f31836f..7cc8687 100644 --- a/.github/workflows/update_bom_pcbtop.yml +++ b/.github/workflows/update_bom_pcbtop.yml @@ -3,7 +3,6 @@ name: Update Bom PCB_top # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - workflow_call: push: branches: [ main ] paths: @@ -23,32 +22,5 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - BOM_PCBtop: - name: Update Bom, PCB_top and upload - runs-on: ubuntu-latest - container: ghcr.io/inti-cmnb/kicad6_auto:1.6.3 - 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: Run BOM - run: | - [ -f *.kicad_sch ] && kiplot -d Fabrication -s all bom_csv_upload pcb_top_b pcb_bottom_b - head -n -12 Fabrication/BoM/design-bom.csv > Fabrication/BoM/design-bom-short.csv - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - repository: . - create_branch: true - branch: documentation - push_options: '--force' - commit_message: Update Bom and PCB_top + call-workflow-passing-data: + uses: 42CrMo4/KiCad_Workflows/.github/workflows/update_bom_pcbtop.yml@main \ No newline at end of file