HW-FW-Releases-Demo/hw/.allspice/workflows/03-Python-py-allspice.yml

55 lines
2.3 KiB
YAML

# Python-py-allspice demo repository
# This workflow demonstrates how to use Python and py-allspice to interact with the AllSpice API
# AllSpice Actions documentation: https://learn.allspice.io/docs/actions-cicd
name: Python-py-allspice
on:
push:
issues:
types: [opened, closed, reopened]
jobs:
py-allspice test:
runs-on: ubuntu-latest
steps:
# Check out repository code
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -la ${{ github.workspace }}
# Installs python requirements from the requirements.txt file
- name: "[🤼->🖥️] Install python requirements"
run: pip install -r .allspice/utils/requirements.txt
# Call a python script from the .allspice/utils directory
- name: "[🏃->🐍] Run .allspice/utils/hello-world.py 🔎"
run: python .allspice/utils/hello-world.py
# Run the py-allspice self-test script, this will ping the server and verify the API is working
# Parameters: ${github.server_url} and ${github.token} are automatic Workflow variables and are used to authenticate the AllSpice API
- name: "[🔑->🕸️] Test AllSpice API with py-allspice 🔎"
run: python .allspice/utils/py-allspice-BIST.py --allspice_hub_url ${{ github.server_url }} --allspice_token ${{ github.token }}
# Generate a netlist from Altium .PcbDoc file
# Run the generate_netlist.py script from the .allspice/utils directory
- name: Generate Netlist
run: |
echo -e "repo ${{ github.repository }}"
ALLSPICE_AUTH_TOKEN=${{ github.token }} python .allspice/utils/generate_netlist.py "${{ github.repository }}" "Archimajor.PcbDoc" --allspice_hub_url "${{ github.server_url }}" --output_file Archimajor.pcbdoc.netlist.txt
# Print the netlist file to the terminal
- name: Show Netlist 🔎
run: cat Archimajor.pcbdoc.netlist.txt
# Archive the netlist file as an artifact file
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: Archimajor.PcbDoc.netlist.txt
path: Archimajor.pcbdoc.netlist.txt