Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
WIP: Merge main (c++ core & picker stuff)
Browse files Browse the repository at this point in the history
  • Loading branch information
iopapamanoglou committed Nov 7, 2024
1 parent 4d13797 commit 1137283
Show file tree
Hide file tree
Showing 135 changed files with 6,311 additions and 1,721 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'
#cache: 'poetry'
#cache: 'hatch'
- name: Install dependencies
run: |
python -m pip install poetry --upgrade pip
poetry install --with dev
python -m pip install hatch --upgrade pip
hatch env create test
- name: Lint with Ruff
run: poetry run ruff check --output-format=github .
run: hatch run ruff check --output-format=github .
#continue-on-error: true
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
- name: Run pytest
run: poetry run pytest
run: hatch run test:pytest
#- name: Upload pytest test results
# uses: actions/upload-artifact@v4
# with:
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/release.yml

This file was deleted.

111 changes: 111 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Taken from https://github.com/pybind/scikit_build_example/blob/master/.github/workflows/wheels.yml

name: Wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
release:
types:
# - created
- published

env:
FORCE_COLOR: 3

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Build SDist
run: pipx run build --sdist

- name: Check metadata
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz


build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
#TODO
#- windows-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: astral-sh/setup-uv@v3

- uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_LINUX: x86_64 # aarch64
# Force GLIBC 2.28 for C++ 20
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl


upload_all:
name: Upload if release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment: pypi
permissions:
id-token: write
attestations: write

steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: actions/download-artifact@v4
with:
pattern: cibw-*
merge-multiple: true
path: dist

- name: Generate artifact attestation for sdist and wheels
uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/*"

- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ ENV/

# IDE stuff
.vscode
.aider*

_local
.local

# OS stuff
.DS_Store

.envrc
5 changes: 4 additions & 1 deletion examples/iterative_design_nand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import typer

import faebryk.library._F as F
from faebryk.core.graph import GraphFunctions
from faebryk.core.module import Module
from faebryk.libs.brightness import TypicalLuminousIntensity
from faebryk.libs.examples.buildutil import apply_design_to_pcb
Expand Down Expand Up @@ -119,7 +120,9 @@ def App():
app.add(c)

# parametrizing
for _, t in app.get_graph().nodes_with_trait(F.ElectricLogic.has_pulls):
for _, t in GraphFunctions(app.get_graph()).nodes_with_trait(
F.ElectricLogic.has_pulls
):
for pull_resistor in (r for r in t.get_pulls() if r):
pull_resistor.resistance.constrain_subset(
L.Range.from_center_rel(100 * P.kohm, 0.05)
Expand Down
4 changes: 4 additions & 0 deletions examples/minimal_led_orderable.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import faebryk.library._F as F
from faebryk.core.module import Module
from faebryk.exporters.documentation.datasheets import export_datasheets
from faebryk.exporters.pcb.kicad.artifacts import export_svg
from faebryk.exporters.pcb.kicad.transformer import PCB_Transformer
from faebryk.exporters.pcb.layout.absolute import LayoutAbsolute
Expand All @@ -23,6 +24,7 @@
from faebryk.libs.examples.pickers import add_example_pickers
from faebryk.libs.library import L
from faebryk.libs.logging import setup_basic_logging
from faebryk.libs.picker.common import CachePicker
from faebryk.libs.picker.jlcpcb.jlcpcb import JLCPCB_DB
from faebryk.libs.picker.jlcpcb.pickers import add_jlcpcb_pickers
from faebryk.libs.picker.picker import pick_part_recursively
Expand Down Expand Up @@ -130,6 +132,7 @@ def main():

# picking ----------------------------------------------------------------
modules = app.get_children_modules(types=Module)
CachePicker.add_to_modules(modules, prio=-20)
try:
JLCPCB_DB()
for n in modules:
Expand All @@ -147,6 +150,7 @@ def main():
apply_design_to_pcb(app, transform_pcb)
export_pcba_artifacts(ARTIFACTS, PCB_FILE, app)
export_svg(PCB_FILE, ARTIFACTS / Path("pcba.svg"))
export_datasheets(app, BUILD_DIR / "documentation" / "datasheets")


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit 1137283

Please sign in to comment.