Upload state of the art

This commit is contained in:
Daniel Lindmark 2024-05-06 15:13:14 -05:00
parent 93010bb417
commit 96f32a2c93
17 changed files with 633 additions and 34 deletions

View File

@ -0,0 +1,104 @@
#! /usr/bin/env python3
# Generate a Netlist from a PcbDoc file.
# For more information, read the README file in this directory.
import argparse
import os
import sys
from contextlib import ExitStack
from allspice import AllSpice
from allspice.utils.netlist_generation import generate_netlist
if __name__ == "__main__":
print("Hello World")
# Parse command line arguments. If you're writing a special purpose script,
# you can hardcode these values instead of using command line arguments.
parser = argparse.ArgumentParser(
prog="generate_pcb_netlist", description="Generate a netlist from a PCB file."
)
parser.add_argument("repository", help="The repo containing the project")
parser.add_argument(
"pcb_file",
help="The path to the PCB file in the source repo.",
)
parser.add_argument(
"--source_ref",
help="The git reference the netlist should be generated for (eg. branch name, tag name, commit SHA). Defaults to main.",
default="main",
)
parser.add_argument(
"--allspice_hub_url",
help="The URL of your AllSpice Hub instance. Defaults to https://hub.allspice.io.",
)
parser.add_argument(
"--output_file",
help="The path to the output file. If absent, the output will direct to the command line.",
)
args = parser.parse_args()
# Use Environment Variables to store your auth token. This keeps your token
# secure when sharing code.
auth_token = os.environ.get("ALLSPICE_AUTH_TOKEN")
if auth_token is None:
print("Please set the environment variable ALLSPICE_AUTH_TOKEN")
exit(1)
if args.allspice_hub_url is None:
allspice = AllSpice(token_text=auth_token)
else:
allspice = AllSpice(
token_text=auth_token, allspice_hub_url=args.allspice_hub_url
)
try:
# Test connection and key
print("AllSpice Version: " + allspice.get_version())
# Test private API call
print("API-Token belongs to user: " + allspice.get_user().username)
except Exception as e:
print(f"Could not connect to AllSpice Hub: {e}")
exit(1)
repo_owner, repo_name = args.repository.split("/")
try:
print(f"repo_owner={repo_owner}, repo_name={repo_name}")
repository = allspice.get_repository(repo_owner, repo_name)
except Exception as e:
print(f"Could not find repository {args.repository}: {e}")
exit(1)
pcb_file = args.pcb_file
print("Generating PCB Netlist...🏃", file=sys.stderr)
netlist_rows = generate_netlist(
allspice,
repository,
pcb_file,
args.source_ref,
)
with ExitStack() as stack:
if args.output_file is not None:
writer = stack.enter_context(open(args.output_file, "w"))
else:
writer = sys.stdout
nets = list(netlist_rows.keys())
# It's helpful to sort here to generate repeatable netlist files
nets.sort()
# You can change formatting here
for net in nets:
writer.write(net + "\n")
pins_on_net = netlist_rows[net]
pins_on_net.sort()
writer.write(" " + " ".join(pins_on_net) + "\n")
print("Generated PCB netlist.", file=sys.stderr)

View File

@ -0,0 +1,57 @@
# HelloWorld.py
# If you're new to scripting, this is a great place to start.
# Hello World starts you out easy with some simple server requests.
# This will help you troubleshoot your connection and show you the basics of making an api request
#
# For more information read our README.md
from allspice import AllSpice
import argparse, sys
print("Starting Test")
parser = argparse.ArgumentParser(
prog="Allspice_API_BIST", description="Test connection and execution of API actions"
)
parser.add_argument(
"--allspice_hub_url",
help="The URL of your AllSpice Hub instance. Defaults to https://hub.allspice.io.",
)
parser.add_argument(
"--allspice_token",
help="Your AllSpice application token. Generate a token: https://hub.allspice.io/user/settings/applications",
)
print("Parsing args")
args = parser.parse_args()
auth_token = args.allspice_token
if auth_token is None:
print("Please supply a token with --allspice_token <your_token> Generate a token: https://hub.allspice.io/user/settings/applications")
sys.exit(1)
print(f"Auth token {auth_token}")
if args.allspice_hub_url is None:
allspice = AllSpice(token_text="https://hub.allspice.io")
else:
try:
allspice = AllSpice(
token_text=auth_token, allspice_hub_url=args.allspice_hub_url
)
except Exception as e:
print("Error")
sys.exit(1)
print("Finish making connection")
# Test connection and key
print("AllSpice Version: " + allspice.get_version())
# Test private API call
print("API-Token belongs to user: " + allspice.get_user().username)
print("End test")

View File

@ -0,0 +1,2 @@
py-allspice
rich

View File

@ -0,0 +1,69 @@
# This is a basic workflow to help you get started with Actions
# Actions documentation: https://learn.allspice.io/docs/actions-cicd
# This file is written in YAML syntax, to learn more about YAML visit https://learn.allspice.io/docs/yaml
# Workflow name
name: Workflow-Hello-World
# Workflow run name, includes the actor that triggered the workflow
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
# Workflow triggers on
# To learn more about triggers, visit https://learn.allspice.io/docs/actions-triggers
on:
# Workflow is triggered if any of the following events occur
# i.e. Logical OR of triggers, i.e. trigger on push or issues
# Trigger on push
push:
# Trigger on issues
issues:
# Trigger on issue open, close, or reopen
types: [opened, closed, reopened]
# Environment variables
env:
# No environment variables defined for this demo
# Workflow jobs
# Jobs run in parallel by default
# To run jobs in sequence, create multiple steps in a job
jobs:
# Job name
Job-Hello-World:
# Set up server container using Ubuntu operating system (Debian based Linux distribution)
# To learn more about Ubuntu, visit https://ubuntu.com/
runs-on: ubuntu-latest
# Job steps
# Steps run in sequence on the runner machine
# To make steps run in parallel, create multiple jobs
steps:
# Step name
# Step to print "Hello World" to the terminal
- name: "Step: Hello World 🔎"
# run keyword specifies the shell command to run
# The shell command is a simple echo command to print "Hello World"
# The command is run in the runner machine
# To learn more about shell commands, visit https://www.shellscript.sh/
run: echo "Hello World"
# Step to run multiline shell command
- name: "Step: multiline shell command 🔎"
# The shell command is a simple echo command to print two lines of text
# The | pipe character is used to specify a multiline command
run: |
echo "This is the first line"
echo "This is the second line"

View File

@ -0,0 +1,21 @@
name: Workflow-Hello-World
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
# Trigger on issue open, close, or reopen
types: [opened, closed, reopened]
env:
jobs:
Job-Hello-World:
runs-on: ubuntu-latest
steps:
- name: "Step: Hello World 🔎"
run: echo "Hello World"

View File

@ -0,0 +1,81 @@
# This is a basic workflow to help you get started with Actions
# Actions documentation: https://learn.allspice.io/docs/actions-cicd
# This file is written in YAML syntax, to learn more about YAML visit https://learn.allspice.io/docs/yaml
# Workflow name
name: Workflow-Hello-World
# Workflow run name, includes the actor that triggered the workflow
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
# Workflow triggers on
# To learn more about triggers, visit https://learn.allspice.io/docs/actions-triggers
on:
# Workflow is triggered if any of the following events occur
# i.e. Logical OR of triggers, i.e. trigger on push or issues
# Trigger on push
push:
# Trigger on issues
issues:
# Trigger on issue open, close, or reopen
types: [opened, closed, reopened]
# Environment variables
env:
# No environment variables defined for this demo
# Workflow jobs
# Jobs run in parallel by default
# To run jobs in sequence, create multiple steps in a job
jobs:
# Job name
Job-Hello-World:
# Set up server container using Ubuntu operating system (Debian based Linux distribution)
# To learn more about Ubuntu, visit https://ubuntu.com/
runs-on: ubuntu-latest
# Job steps
# Steps run in sequence on the runner machine
# To make steps run in parallel, create multiple jobs
steps:
# Step name
- name: "[📚->🖥️] Check out repository code"
# uses keyword specifies the action to run
# actions/checkout@v3 is a GitHub provided action to checkout the repository code
# The action checks out the repository code to the runner machine
# The action is version 3 of the action
# The action is hosted in the actions organization on GitHub
# The action is named checkout
# Many GitHub actions and conventions work directly on AllSpice Actions
uses: actions/checkout@v3
# Step: list files in repo
- name: "[🔎->📂] List files in repo 🔎"
# run keyword specifies the shell command to run
# The shell command is a simple ls command to list files in the repository
# The command is run in the runner machine
# To learn more about shell commands, visit https://www.shellscript.sh/
run: ls -a -h -s -R -I ".git*" ${{ gitea.workspace }}
# Step: run git status
- name: "[🔎->📂] Git status 🔎"
# run keyword specifies the shell command to run
# The shell command is a simple git status command to check the repository status
# The command is run in the runner machine
# To learn more about shell commands, visit https://www.shellscript.sh/
run: git status

View File

@ -0,0 +1,34 @@
name: 🧸-Hello-World
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
types: [opened, closed, reopened]
env:
text_black_on_white: "\u001b[90;107m"
text_black_on_green: "\u001b[90;102m"
text_green_on_grey: "\u001b[92;100m"
text_blue_on_yellow: "\u001b[94;103m"
text_plain: "\u001b[0m"
jobs:
🧸-Hello-World:
runs-on: ubuntu-latest
steps:
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🤼->🖥️] Install requirements"
run: pip install -r .allspice/utils/requirements.txt
- name: "[🏋🏽..🏋🏽] Test Actions Server 🔎"
run: |
echo -e "🎉 The job was automatically triggered by a $text_black_on_white ${{ gitea.event_name }} $text_plain event."
echo -e "🐧 This job is now running on a $text_black_on_white ${{ runner.os }} $text_plain server hosted by $text_blue_on_yellow AllSpice! $text_plain"
echo -e "🔎 $text_black_on_green owner_name/repo_name $text_plain -> $text_green_on_grey branch_name $text_plain ... $text_black_on_green ${{ gitea.repository }} $text_plain -> $text_green_on_grey ${{ gitea.ref_name }} $text_plain"
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -a -h -s -R -I ".git*" ${{ gitea.workspace }}
- 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 }}

View File

@ -0,0 +1,34 @@
name: 🧸-Hello-World
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
types: [opened, closed, reopened]
env:
text_black_on_white: "\u001b[90;107m"
text_black_on_green: "\u001b[90;102m"
text_green_on_grey: "\u001b[92;100m"
text_blue_on_yellow: "\u001b[94;103m"
text_plain: "\u001b[0m"
jobs:
🧸-Hello-World:
runs-on: ubuntu-latest
steps:
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🤼->🖥️] Install requirements"
run: pip install -r .allspice/utils/requirements.txt
- name: "[🏋🏽..🏋🏽] Test Actions Server 🔎"
run: |
echo -e "🎉 The job was automatically triggered by a $text_black_on_white ${{ gitea.event_name }} $text_plain event."
echo -e "🐧 This job is now running on a $text_black_on_white ${{ runner.os }} $text_plain server hosted by $text_blue_on_yellow AllSpice! $text_plain"
echo -e "🔎 $text_black_on_green owner_name/repo_name $text_plain -> $text_green_on_grey branch_name $text_plain ... $text_black_on_green ${{ gitea.repository }} $text_plain -> $text_green_on_grey ${{ gitea.ref_name }} $text_plain"
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -a -h -s -R -I ".git*" ${{ gitea.workspace }}
- 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 }}

View File

@ -0,0 +1,34 @@
name: 🧸-Hello-World
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
types: [opened, closed, reopened]
env:
text_black_on_white: "\u001b[90;107m"
text_black_on_green: "\u001b[90;102m"
text_green_on_grey: "\u001b[92;100m"
text_blue_on_yellow: "\u001b[94;103m"
text_plain: "\u001b[0m"
jobs:
🧸-Hello-World:
runs-on: ubuntu-latest
steps:
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🤼->🖥️] Install requirements"
run: pip install -r .allspice/utils/requirements.txt
- name: "[🏋🏽..🏋🏽] Test Actions Server 🔎"
run: |
echo -e "🎉 The job was automatically triggered by a $text_black_on_white ${{ gitea.event_name }} $text_plain event."
echo -e "🐧 This job is now running on a $text_black_on_white ${{ runner.os }} $text_plain server hosted by $text_blue_on_yellow AllSpice! $text_plain"
echo -e "🔎 $text_black_on_green owner_name/repo_name $text_plain -> $text_green_on_grey branch_name $text_plain ... $text_black_on_green ${{ gitea.repository }} $text_plain -> $text_green_on_grey ${{ gitea.ref_name }} $text_plain"
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -a -h -s -R -I ".git*" ${{ gitea.workspace }}
- 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 }}

View File

@ -0,0 +1,34 @@
name: 🧸-Hello-World
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
types: [opened, closed, reopened]
env:
text_black_on_white: "\u001b[90;107m"
text_black_on_green: "\u001b[90;102m"
text_green_on_grey: "\u001b[92;100m"
text_blue_on_yellow: "\u001b[94;103m"
text_plain: "\u001b[0m"
jobs:
🧸-Hello-World:
runs-on: ubuntu-latest
steps:
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🤼->🖥️] Install requirements"
run: pip install -r .allspice/utils/requirements.txt
- name: "[🏋🏽..🏋🏽] Test Actions Server 🔎"
run: |
echo -e "🎉 The job was automatically triggered by a $text_black_on_white ${{ gitea.event_name }} $text_plain event."
echo -e "🐧 This job is now running on a $text_black_on_white ${{ runner.os }} $text_plain server hosted by $text_blue_on_yellow AllSpice! $text_plain"
echo -e "🔎 $text_black_on_green owner_name/repo_name $text_plain -> $text_green_on_grey branch_name $text_plain ... $text_black_on_green ${{ gitea.repository }} $text_plain -> $text_green_on_grey ${{ gitea.ref_name }} $text_plain"
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -a -h -s -R -I ".git*" ${{ gitea.workspace }}
- 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 }}

View File

@ -0,0 +1,34 @@
name: 🧸-Hello-World
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
types: [opened, closed, reopened]
env:
text_black_on_white: "\u001b[90;107m"
text_black_on_green: "\u001b[90;102m"
text_green_on_grey: "\u001b[92;100m"
text_blue_on_yellow: "\u001b[94;103m"
text_plain: "\u001b[0m"
jobs:
🧸-Hello-World:
runs-on: ubuntu-latest
steps:
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🤼->🖥️] Install requirements"
run: pip install -r .allspice/utils/requirements.txt
- name: "[🏋🏽..🏋🏽] Test Actions Server 🔎"
run: |
echo -e "🎉 The job was automatically triggered by a $text_black_on_white ${{ gitea.event_name }} $text_plain event."
echo -e "🐧 This job is now running on a $text_black_on_white ${{ runner.os }} $text_plain server hosted by $text_blue_on_yellow AllSpice! $text_plain"
echo -e "🔎 $text_black_on_green owner_name/repo_name $text_plain -> $text_green_on_grey branch_name $text_plain ... $text_black_on_green ${{ gitea.repository }} $text_plain -> $text_green_on_grey ${{ gitea.ref_name }} $text_plain"
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -a -h -s -R -I ".git*" ${{ gitea.workspace }}
- 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 }}

View File

@ -0,0 +1,36 @@
# .allspice/workflows/test.yml
name: AllSpice Actions Demo
run-name: ${{ gitea.actor }} is testing out AllSpice Actions 🚀
on:
push:
issues:
types: [opened, closed, reopened]
env:
text_black_on_white: "\u001b[90;107m"
text_black_on_green: "\u001b[90;102m"
text_green_on_grey: "\u001b[92;100m"
text_blue_on_yellow: "\u001b[94;103m"
text_plain: "\u001b[0m"
jobs:
Generate-Netlist:
runs-on: ubuntu-latest
steps:
- name: Set up Python 🐍->🖥️
uses: actions/checkout@v3
- name: Install requirements 🤼->🖥️
run: pip install -r .allspice/utils/requirements.txt
- name: Generate Netlist 🔎
run: |
echo -e "repo ${{ gitea.repository }}"
ALLSPICE_AUTH_TOKEN=${{ github.token }} python .allspice/utils/generate_netlist.py "${{ gitea.repository }}" "Archimajor.PcbDoc" --allspice_hub_url "https://hub.allspice.io" --output_file Archimajor.pcbdoc.netlist.txt
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: Archimajor.PcbDoc.netlist.txt
path: Archimajor.pcbdoc.netlist.txt
- run: echo "🍏 This job's status is ${{ job.status }}."

BIN
images/enable_actions.png Normal file

Binary file not shown.

After

(image error) Size: 43 KiB

BIN
images/workflow-demo.png Normal file

Binary file not shown.

After

(image error) Size: 271 KiB

BIN
images/workflow-list.png Normal file

Binary file not shown.

After

(image error) Size: 231 KiB

127
readme.md
View File

@ -1,53 +1,112 @@
# Archimajor
## Actions demo repo
Welcome to the Actions demo repo.
<img align="left" width="300" height="200" src="./.allspice/PCB.PNG">
This repo will help you get started quickly with actions.
## Summary
This repo is part of the [Actions quickstart guide](https://learn.allspice.io/docs/allspice-ci-cd-actions-quickstart)
3D printer motherboard, designed by [Ultimachine](https://ultimachine.com/). Features include:
### Quickstart overview
- **5x integrated 256 microstep motor drivers**
- **6x PWM Mosfet outputs**
- **4x thermistor inputs**
- **SPI (Serial Peripheral Interface)**
- ** Removed infinite loop on self-calibration.
- [ ] Sign up for Actions by talking to one of our [friendly engineers](https://allspice.io/demo)
- [ ] Create a new repo using this repo as a template, or migrate this repo
- [ ] Enable actions by visiting your repository->:wrench:Settings, and clicking [X] `Enable Repository Actions`
---
## Specifications
### General Specifications
**Input Power Supply**: 12V - 24V DC, 16A+
**Operating Temperature Range (est.)**: 0dC ~ 70dC
## Component library
[Archimajor Component Library](https://hub.allspice.io/Allspice-demos/Altium-component-library-demo)
- [ ] Trigger Actions workflows by pushing files to the repo, or by creating/opening/closing an issue
- [ ] Visit the Actions tab to view the workflows
- Click on the workflow you would like to view
- <img height="400" src="./images/workflow-list.png">
- Click on individual jobs to see their output
- <img height="400" src="./images/workflow-demo.png">
## Firmware
## Actions background
### Firmware Repo
This section introduces some high-level concepts and definitions of Actions. To learn more, visit the main [Actions documentation](https://learn.allspice.io/docs/actions-cicd)
[Current FW image](https://github.com/ultimachine/Marlin/commit/2f9e3b771e2669118cce922ad52785165e16d1e9)
### Continuous Integration (CI)
### Original source
[Source](https://github.com/ultimachine/Marlin4due/tree/Archim2)
CI is part of development operations (DevOps).
### Legacy firmware (use releases for current fw)
[Binary](https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip)
CI is the practice of **automating** the integration of **design changes** from multiple contributors into a single project.
## Bill of Materials
### Actions
[Archimajor.csv](./Archimajor.csv)
An action is the basic reusable block of CI. It's just a program or series of programs that you call from your workflow `.allspice/workflows/your_workflow.yml`
## Note
Actions allow you to `automate repetitive and error-prone processes` to let the engineers focus on the creative design challenges.
Changed heat bed fuse holder to yellow to differentiate channels.
Actions is just an easy way to say automation program.
### Actions trigger automatically
Automation programs are `triggered` by standard actions like `uploading files to version control`, starting or `finishing a design review`.
Triggers are defined in your workflow files `.allspice/workflows/your_workflow.yml`
Engineering teams gain rapid improvements on their process by relying on Actions to automate instead of manual operations.
## **Actions help your design team**
- Process BOM/Assembly
- Availability checks
- Lifecycle checks (PLM)
- COGS (ERP)
- CM BOM Diff Report
- Extended quote/forecasting
- PCB cost/schedule options
- Quotes with multiple quantities
- Date extended quantity is available
- Process Schematics
- Verify symbols
- Reference designators
- Symbol attributes
- MFG/MPN/Value/etc
- Netlist
- Static analysis
- Power/GND misconnects
- Voltage level checks between components
- Process PCBAs
- Verify footprints
- Verify design rules match (DRC is no good if the rules are wrong)
- Create trace report (Current/Power/Width)
- Generate stack-up documentation
- Generate documentation (Sch/PCB Design Review/Release notes/Fab files)
- Regulate releases
- File pattern match
- Flag missing files
- Generate report
- Connect to any public API
- PLM/ERP (Cofactr/PTC)
- Distributors (Digikey/Mouser/Newark/Octopart)
- Task management (Jira)
- Create Read Update Delete (CRUD) cloud “office” documents
- MS365 (Excel/Word/Powerpoint)
- Google docs (Sheets/Docs/Slides)
- Network sync (Dropbox/MS365/iCloud)
Actions can seem a bit abstract, but it's really just code running on a computer
## Workflows
Workflows are the scaffolding of your automation. They are the code that loads the automation code. Workflows are easy to read and write `yaml` files that define the following:
- Load software container
- Ubuntu LTS 2024 (Debian flavored Linux distro)
- Load dependencies
- Software libraries
- Design Files
- API tools
- Secrets/tokens/keys
- Run programs
- Actions - Pre-built no-code automation programs
- Python - Programs can be written in python and access our AllSpice.io API via our py-allspice python module.
- C/C++, use the same language as firmware development
- Any programming language that can run on Debian/Ubuntu Linux
- Extend existing automation
- Workflows can be broken into modules that can be reused and extended.
## Disclaimer
*NOTE: This does not represent actual data from the Rambo/Archimajor PCBA
## Learn more
To learn more, visit our [actions documentation](https://learn.allspice.io/docs/actions-cicd).