mirror of
https://staging.allspice.dev/AllSpice-Demos/Actions-demo.git
synced 2025-04-24 09:13:21 +00:00
Merge branch 'dd/add-workflows-02-03'
This commit is contained in:
commit
2cb65481c9
@ -1,7 +1,6 @@
|
||||
{
|
||||
"Part Number": ["PART", "MANUFACTURER #"],
|
||||
"Manufacturer": ["Manufacturer", "MANUFACTURER"],
|
||||
"Part ID": ["_part_id"],
|
||||
"Designator": ["Designator"],
|
||||
"Description": ["PART DESCRIPTION"]
|
||||
}
|
||||
"Part Number": ["PART", "MANUFACTURER #", "_part_id"],
|
||||
"Manufacturer": ["Manufacturer", "MANUFACTURER"],
|
||||
"Designator": ["Designator"],
|
||||
"Description": ["PART DESCRIPTION"]
|
||||
}
|
1
.allspice/utils/hello-world.py
Normal file
1
.allspice/utils/hello-world.py
Normal file
@ -0,0 +1 @@
|
||||
print("Hello World!")
|
@ -17,30 +17,25 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Generate BOM
|
||||
uses: https://hub.allspice.io/Actions/generate-bom-altium@v0.2
|
||||
uses: https://hub.allspice.io/Actions/generate-bom@v0.3
|
||||
with:
|
||||
# The path to the Altium project file in your repo.
|
||||
project_path: Archimajor.PrjPcb
|
||||
|
||||
# The path to the project file in your repo (.PrjPcb for Altium, .DSN for OrCad).
|
||||
source_path: Archimajor.PrjPcb
|
||||
# [optional] A path to a JSON file mapping columns to the component attributes
|
||||
# they are from. This file must be provided.
|
||||
# Default: 'columns.json'
|
||||
columns: .allspice/columns.json
|
||||
|
||||
# [optional] The path to the output file that will be generated.
|
||||
# Default: 'bom.csv'
|
||||
output_file_name: bom.csv
|
||||
|
||||
# [optional] A comma-separated list of columns to group the BOM by. If empty
|
||||
# or not present, the BOM will be flat.
|
||||
# Default: ''
|
||||
group_by: 'Part ID'
|
||||
|
||||
group_by: 'Part Number'
|
||||
# [optional] The variant of the project to generate the BOM for. If empty
|
||||
# or not present, the BOM will be generated for the default variant.
|
||||
# Default: ''
|
||||
variant: ''
|
||||
|
||||
variant: ''
|
||||
# Print bom.csv to terminal
|
||||
- name: Show BOM
|
||||
run: cat bom.csv
|
||||
|
54
.allspice/workflows/03-Python-py-allspice.yml
Normal file
54
.allspice/workflows/03-Python-py-allspice.yml
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
# 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
|
||||
|
36
.allspice/workflows/04-Secrets-variables-keys.yml
Normal file
36
.allspice/workflows/04-Secrets-variables-keys.yml
Normal file
@ -0,0 +1,36 @@
|
||||
# Secrets, Variables, and Keys demo
|
||||
# This workflow demonstrates how to use secrets, variables, and keys in the workflow
|
||||
# AllSpice Actions documentation: https://learn.allspice.io/docs/actions-cicd
|
||||
name: Secrets-Variables-Keys-Demo
|
||||
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
|
||||
|
||||
# Print repository action variable VARIABLE_NAME and value
|
||||
- name: Print repository Action variable 🔎
|
||||
run: |
|
||||
echo "Repository variable VARIABLE_NAME = ${{ vars.VARIABLE_NAME }}"
|
||||
echo "Repository variables are stored in ${{ github.server_url }}/${{ github.repository }}/settings/actions/variables"
|
||||
|
||||
- name: Use Secret 🔎
|
||||
# Store the secret in an environment variable YOUR_SECRET
|
||||
env:
|
||||
ENV_SECRET: ${{ secrets.YOUR_SECRET }}
|
||||
|
||||
# Demonstrate how to use secrets in the workflow
|
||||
run: |
|
||||
echo "Secrets are stored in ${{ github.server_url }}/${{ github.repository }}"/settings/actions/secrets
|
||||
echo "Secrets are only available to the repository admins and the workflow"
|
||||
echo "Store API Tokens in secrets and use them in the workflow without exposing them"
|
||||
echo "Secrets are not printed to the terminal for security reasons and will be replaced with ***"
|
||||
echo "Using secret from /settings/actions/secrets YOUR_SECRET=${{ secrets.YOUR_SECRET }}"
|
||||
echo "Using secret from stored envrironmental variable ENV_SECRET=$YOUR_SECRET"
|
Loading…
Reference in New Issue
Block a user