diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 12043250..8cafb9fd 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -263,6 +263,54 @@ jobs: ghcr.io/inti-cmnb/kicad6_auto_full:dev labels: ${{ steps.meta.outputs.labels }} + push_to_registry_ng: + name: Push Docker image to Docker Hub (KiCad 7) + runs-on: ubuntu-latest + needs: test + permissions: + packages: write + contents: read + # Don't create `dev` images using the `master` + if: github.ref == 'refs/heads/dev' + + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + setsoft/kicad_auto_test + ghcr.io/inti-cmnb/kicad_auto_test + ghcr.io/inti-cmnb/kicad7_auto_full + tags: | + type=raw,dev_k7 + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: tools/dev_image_k7 + push: true + tags: | + setsoft/kicad_auto_test:dev_k7 + ghcr.io/inti-cmnb/kicad_auto_test:dev_k7 + labels: ${{ steps.meta.outputs.labels }} + coveralls: name: Finish Coveralls needs: test diff --git a/kibot/__main__.py b/kibot/__main__.py index 9c33d5fb..e1b32408 100644 --- a/kibot/__main__.py +++ b/kibot/__main__.py @@ -93,7 +93,7 @@ if os.environ.get('KIAUS_USE_NIGHTLY'): # pragma: no cover (nightly) sys_path.insert(0, pcbnew_path) # This helps other tools like iBoM to pick-up the right pcbnew module if 'PYTHONPATH' in os.environ: - os.environ['PYTHONPATH'] += ':'+pcbnew_path + os.environ['PYTHONPATH'] += os.pathsep+pcbnew_path else: os.environ['PYTHONPATH'] = pcbnew_path nightly = True diff --git a/kibot/pre_run_drc.py b/kibot/pre_run_drc.py index d9400231..21b68fae 100644 --- a/kibot/pre_run_drc.py +++ b/kibot/pre_run_drc.py @@ -15,6 +15,7 @@ from .macros import macros, pre_class # noqa: F401 from .error import KiPlotConfigurationError from .gs import GS from .optionable import Optionable +from .kicad.config import KiConf from .kiplot import load_board from .misc import DRC_ERROR from .log import get_logger @@ -51,6 +52,9 @@ class Run_DRC(BasePreFlight): # noqa: F821 def run(self): command = self.ensure_tool('KiAuto') + if GS.ki7: + # KiCad 7 can do some library parity checks, but we need to be sure that the KICAD7* vars are defined + KiConf.init(GS.pcb_file) output = self.get_targets()[0] os.makedirs(os.path.dirname(output), exist_ok=True) logger.debug('DRC report: '+output) diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 2403f257..705022dd 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -855,7 +855,8 @@ def test_import_7(test_dir): if context.ki7(): ctx.board_file.replace('kicad_pcb', 'kicad_pro') with open(ctx.board_file.replace('kicad_pcb', 'kicad_pro'), 'wt') as f: - f.write(json.dumps({"board": {"design_settings": {"rule_severities": {"lib_footprint_issues": "ignore"}}}})) + f.write(json.dumps({"board": {"design_settings": {"rule_severities": {"lib_footprint_issues": "ignore", + "lib_footprint_mismatch": "ignore"}}}})) ctx.run(extra=[]) ctx.expect_out_file('3Rs-drc.txt') ctx.clean_up() diff --git a/tests/test_plot/test_print_sch.py b/tests/test_plot/test_print_sch.py index 87687cc7..77441c11 100644 --- a/tests/test_plot/test_print_sch.py +++ b/tests/test_plot/test_print_sch.py @@ -58,6 +58,39 @@ def test_print_sch_svg_ok(test_dir): ctx.clean_up() +# @pytest.mark.slow +# @pytest.mark.eeschema +# def test_print_sch_ps_ok(test_dir): +# prj = 'test_v5' +# ctx = context.TestContext(test_dir, prj, 'print_sch_ps') +# ctx.run() +# # Check all outputs are there +# ctx.expect_out_file(SVG_FILE.replace('svg', 'ps')) +# ctx.clean_up() + + +# @pytest.mark.slow +# @pytest.mark.eeschema +# def test_print_sch_dxf_ok(test_dir): +# prj = 'test_v5' +# ctx = context.TestContext(test_dir, prj, 'print_sch_dxf') +# ctx.run() +# # Check all outputs are there +# ctx.expect_out_file(SVG_FILE.replace('svg', 'dxf')) +# ctx.clean_up() + + +# @pytest.mark.slow +# @pytest.mark.eeschema +# def test_print_sch_hpgl_ok(test_dir): +# prj = 'test_v5' +# ctx = context.TestContext(test_dir, prj, 'print_sch_hpgl') +# ctx.run() +# # Check all outputs are there +# ctx.expect_out_file(SVG_FILE.replace('svg', 'hpgl')) +# ctx.clean_up() + + @pytest.mark.slow @pytest.mark.eeschema def test_print_sch_svg_fail(test_dir): diff --git a/tests/utils/context.py b/tests/utils/context.py index 6755a2e0..7856ef3b 100644 --- a/tests/utils/context.py +++ b/tests/utils/context.py @@ -521,7 +521,12 @@ class TestContext(object): # m = re.match(r'([\d\.e-]+) \(([\d\.e-]+)\)', res.decode()) # assert m # logging.debug('MSE={} ({})'.format(m.group(1), m.group(2))) - ae = int(res.decode()) + s = res.decode() + # Remove error messages generated by KiCad 7 plotted PDFs + s = re.sub(r'^\s+\*+.*', '', s, 0, re.M) + s = re.sub(r'^\s+Output may be incorrect.*', '', s, 0, re.M) + s = s.strip() + ae = int(s) logging.debug('AE=%d' % ae) if png_ref: os.remove(png_ref) diff --git a/tests/yaml_samples/drc_filter.kibot.yaml b/tests/yaml_samples/drc_filter.kibot.yaml index d320535e..5364fe93 100644 --- a/tests/yaml_samples/drc_filter.kibot.yaml +++ b/tests/yaml_samples/drc_filter.kibot.yaml @@ -34,3 +34,6 @@ preflight: - filter_msg: 'Ignore library issues' error: lib_footprint_issues regexp: '.*' + - filter_msg: 'Ignore library missmatches' + error: lib_footprint_mismatch + regexp: '.*' diff --git a/tests/yaml_samples/ibom_all_ops7.kibot.yaml b/tests/yaml_samples/ibom_all_ops7.kibot.yaml new file mode 120000 index 00000000..6bb5ea24 --- /dev/null +++ b/tests/yaml_samples/ibom_all_ops7.kibot.yaml @@ -0,0 +1 @@ +ibom_all_ops6.kibot.yaml \ No newline at end of file diff --git a/tests/yaml_samples/print_sch_dxf.kibot.yaml b/tests/yaml_samples/print_sch_dxf.kibot.yaml new file mode 100644 index 00000000..373fda77 --- /dev/null +++ b/tests/yaml_samples/print_sch_dxf.kibot.yaml @@ -0,0 +1,11 @@ +# Example KiBot config file +kibot: + version: 1 + +outputs: + - name: 'print_dxf_svg' + comment: "Plot schematic (DXF)" + type: dxf_sch_print + dir: . + options: + output: Schematic.dxf diff --git a/tests/yaml_samples/print_sch_hpgl.kibot.yaml b/tests/yaml_samples/print_sch_hpgl.kibot.yaml new file mode 100644 index 00000000..61365770 --- /dev/null +++ b/tests/yaml_samples/print_sch_hpgl.kibot.yaml @@ -0,0 +1,11 @@ +# Example KiBot config file +kibot: + version: 1 + +outputs: + - name: 'print_hpgl_svg' + comment: "Plot schematic (HPGL)" + type: hpgl_sch_print + dir: . + options: + output: Schematic.plt diff --git a/tests/yaml_samples/print_sch_ps.kibot.yaml b/tests/yaml_samples/print_sch_ps.kibot.yaml new file mode 100644 index 00000000..6eea87f6 --- /dev/null +++ b/tests/yaml_samples/print_sch_ps.kibot.yaml @@ -0,0 +1,11 @@ +# Example KiBot config file +kibot: + version: 1 + +outputs: + - name: 'print_ps_svg' + comment: "Plot schematic (PS)" + type: ps_sch_print + dir: . + options: + output: Schematic.ps diff --git a/tools/dev_image_k7/Dockerfile b/tools/dev_image_k7/Dockerfile new file mode 100644 index 00000000..4fe91da3 --- /dev/null +++ b/tools/dev_image_k7/Dockerfile @@ -0,0 +1,22 @@ +FROM setsoft/kicad_auto_test:nightly +MAINTAINER Salvador E. Tropea +LABEL Description="KiCad 6 with KiBot and other automation scripts" + +RUN dpkg --remove kicost kibot && \ + apt-get update && \ + curl https://codeload.github.com/INTI-CMNB/KiBot/zip/refs/heads/dev --output pp.zip && \ + unzip pp.zip && \ + pip3 install --no-compile KiBot-dev/ && \ + rm -rf KiBot-dev pp.zip && \ + curl https://codeload.github.com/hildogjr/KiCost/zip/refs/heads/master --output pp.zip && \ + unzip pp.zip && \ + pip3 install KiCost-master/ && \ + rm -rf KiCost-master pp.zip && \ + rm -rf /var/lib/apt/lists/* + +# kidiff depends on KiAuto +# dpkg --remove kiauto && \ +# curl https://codeload.github.com/INTI-CMNB/KiAuto/zip/refs/heads/master --output pp.zip && \ +# unzip pp.zip && \ +# pip3 install KiAuto-master/ && \ +# rm -rf KiAuto-master/ pp.zip && \