From 4f13493e15776f1b3840d5d99e237779a879999e Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 23 Sep 2024 12:21:42 +0800 Subject: [PATCH 01/14] gh-actions: Build and upload all artifacts Signed-off-by: Daniel Schaefer --- .github/workflows/generate-morphs.yaml | 104 +++++++++++++++++++++++++ bin/ci.py | 34 ++++++++ 2 files changed, 138 insertions(+) create mode 100644 .github/workflows/generate-morphs.yaml create mode 100644 bin/ci.py diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml new file mode 100644 index 00000000..67131a25 --- /dev/null +++ b/.github/workflows/generate-morphs.yaml @@ -0,0 +1,104 @@ +# This workflow builds Data Morph on Mac, Linux, and Windows for +# multiple versions of Python to confirm it can be properly installed. +# +# For more information see https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python +# +# Author: Stefanie Molin, Daniel Schaefer + +name: Generate Morphs + +on: + push: + pull_request: + paths-ignore: + - 'docs/**' + - 'src/tests/**' + + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + name: Build with Python ${{ matrix.python-version }} on ${{ matrix.os }} + + # Just generate on one operating system, they should all be the same + runs-on: ubuntu-latest + + defaults: + run: + shell: bash -e {0} + + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Data Morph + run: | + python -m pip install --upgrade pip + python -m pip install setuptools --upgrade + python -m pip install . + + - name: Get all dataset files that have changed + id: changed-files-yaml + uses: tj-actions/changed-files@v45 + with: + files_yaml: | + dataset: + - src/data_morph/data/starter_shapes/* + shape: + - src/data_morph/shapes/** + + # If datasets are added or changed + - name: Generate morphs from new or changed datasets + if: steps.changed-files-yaml.outputs.dataset_any_changed == 'true' + env: + DATASET_ALL_CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.dataset_all_changed_files }} + run: | + echo "One or more dataset file(s) has changed." + echo "List all the files that have changed: $DATASET_ALL_CHANGED_FILES" + DATASET_ARGS=$(python bin/ci.py $DATASET_ALL_CHANGED_FILES) + echo "Generating morphs for the following datasets: $DATASET_ARGS" + parallel -j0 data-morph \ + --start-shape $DATASET_ARGS \ + --target-shape {} \ + ::: bullseye heart rectangle star slant_up + + # If shapes are added or modified + - name: Generate morphs from new or changed shapes + if: steps.changed-files-yaml.outputs.shape_any_changed == 'true' + env: + SHAPE_ALL_CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.shape_all_changed_files }} + run: | + echo "One or more shape file(s) has changed." + echo "List all the files that have changed: $SHAPE_ALL_CHANGED_FILES" + SHAPE_ARGS=$(python bin/ci.py $SHAPE_ALL_CHANGED_FILES) + echo "Generating morphs for the following shapes: $SHAPE_ARGS" + data-morph \ + --start-shape music \ + --target-shape $SHAPE_ARGS \ + + # For core code changes, we want to do a couple morphs to see if they still look ok + # Only need to run if neither of the previous two morphs ran + - name: Morph shapes + if: steps.changed-files-yaml.outputs.dataset_any_changed != 'true' && steps.changed-files-yaml.outputs.shape_any_changed != 'true' + run: | + parallel -j0 data-morph \ + --start-shape music \ + --target-shape {} \ + ::: bullseye heart rectangle star slant_up + + - uses: actions/upload-artifact@v4 + with: + name: morphed_data + path: morphed_data diff --git a/bin/ci.py b/bin/ci.py new file mode 100644 index 00000000..fc3ba8d4 --- /dev/null +++ b/bin/ci.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +from data_morph.shapes.factory import ShapeFactory +from data_morph.data.loader import DataLoader +import sys +from inspect import getmro +from os.path import basename + +new_paths = sys.argv[1:] + +args = [] + +# Figure out argument of datasets based on .csv filename +for dataset, filename in DataLoader._DATASETS.items(): + for new_file in new_paths: + if filename in new_file: + args.append(dataset) + +# Figure out argument of shapes based on .py filename +new_files = [basename(x).split('/')[-1] for x in new_paths] +for shape, c in ShapeFactory._SHAPE_MAPPING.items(): + for new_file in new_files: + # Find the class and all parent classes and get their module name + # We get the module name because it ends in the python file without .py extension + # To make it easy to compare, we just add the extension onto the end + parents = [x.__module__ for x in getmro(c)] + all_modules = parents + [c.__module__] + all_modules = [f"{x}.py" for x in all_modules] + + for module in all_modules: + if module.endswith(new_file): + args.append(shape) + break + +print(" ".join(args)) From d6136d390b80f9ec2231690f2a79e4e168b86fb9 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 23 Sep 2024 16:12:27 +0800 Subject: [PATCH 02/14] review, please squash Signed-off-by: Daniel Schaefer --- .github/workflows/generate-morphs.yaml | 6 +----- bin/ci.py | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index 67131a25..090f9221 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -32,16 +32,12 @@ jobs: strategy: fail-fast: false - matrix: - python-version: ["3.12"] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Install Data Morph run: | diff --git a/bin/ci.py b/bin/ci.py index fc3ba8d4..eb2a591d 100644 --- a/bin/ci.py +++ b/bin/ci.py @@ -1,8 +1,20 @@ #!/usr/bin/env python +""" +Pass in the filenames that changed and it'll tell you the arguments of datasets and shapes. +See examples below + +$ python bin/ci.py src/data_morph/shapes/circles.py +bullseye circle rings + +$ python bin/ci.py src/data_morph/shapes/bases/line_collection.py +high_lines h_lines slant_down slant_up v_lines wide_lines x diamond rectangle star + + python bin/ci.py src/data_morph/data/starter_shapes/superdatascience.csv +SDS +""" from data_morph.shapes.factory import ShapeFactory from data_morph.data.loader import DataLoader import sys -from inspect import getmro from os.path import basename new_paths = sys.argv[1:] @@ -22,13 +34,13 @@ # Find the class and all parent classes and get their module name # We get the module name because it ends in the python file without .py extension # To make it easy to compare, we just add the extension onto the end - parents = [x.__module__ for x in getmro(c)] + parents = [x.__module__ for x in c.__mro__] all_modules = parents + [c.__module__] - all_modules = [f"{x}.py" for x in all_modules] + all_modules = [f'{x}.py' for x in all_modules] for module in all_modules: if module.endswith(new_file): args.append(shape) break -print(" ".join(args)) +print(' '.join(args)) From 5d75823d9d5a387a3893fe813d06f519ab75e542 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:43:57 +1100 Subject: [PATCH 03/14] Apply suggestions from code review --- .github/workflows/generate-morphs.yaml | 14 ++++++-------- bin/ci.py | 9 ++++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index 090f9221..7c396cab 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -12,7 +12,7 @@ on: pull_request: paths-ignore: - 'docs/**' - - 'src/tests/**' + - 'tests/**' concurrency: @@ -21,7 +21,7 @@ concurrency: jobs: build: - name: Build with Python ${{ matrix.python-version }} on ${{ matrix.os }} + name: Run Data Morph on new/altered datasets/shapes # Just generate on one operating system, they should all be the same runs-on: ubuntu-latest @@ -45,7 +45,7 @@ jobs: python -m pip install setuptools --upgrade python -m pip install . - - name: Get all dataset files that have changed + - name: Get all dataset and shape files that have changed id: changed-files-yaml uses: tj-actions/changed-files@v45 with: @@ -61,8 +61,7 @@ jobs: env: DATASET_ALL_CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.dataset_all_changed_files }} run: | - echo "One or more dataset file(s) has changed." - echo "List all the files that have changed: $DATASET_ALL_CHANGED_FILES" + echo "Detected changes to dataset(s): $DATASET_ALL_CHANGED_FILES" DATASET_ARGS=$(python bin/ci.py $DATASET_ALL_CHANGED_FILES) echo "Generating morphs for the following datasets: $DATASET_ARGS" parallel -j0 data-morph \ @@ -76,8 +75,7 @@ jobs: env: SHAPE_ALL_CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.shape_all_changed_files }} run: | - echo "One or more shape file(s) has changed." - echo "List all the files that have changed: $SHAPE_ALL_CHANGED_FILES" + echo "Detected changes to shape(s): $SHAPE_ALL_CHANGED_FILES" SHAPE_ARGS=$(python bin/ci.py $SHAPE_ALL_CHANGED_FILES) echo "Generating morphs for the following shapes: $SHAPE_ARGS" data-morph \ @@ -86,7 +84,7 @@ jobs: # For core code changes, we want to do a couple morphs to see if they still look ok # Only need to run if neither of the previous two morphs ran - - name: Morph shapes + - name: Morph shapes with core code changes if: steps.changed-files-yaml.outputs.dataset_any_changed != 'true' && steps.changed-files-yaml.outputs.shape_any_changed != 'true' run: | parallel -j0 data-morph \ diff --git a/bin/ci.py b/bin/ci.py index eb2a591d..4844196a 100644 --- a/bin/ci.py +++ b/bin/ci.py @@ -1,7 +1,10 @@ #!/usr/bin/env python """ -Pass in the filenames that changed and it'll tell you the arguments of datasets and shapes. -See examples below +Call this script with the names of files that have changed to get the +datasets and shapes to test with the CLI. + +Examples +-------- $ python bin/ci.py src/data_morph/shapes/circles.py bullseye circle rings @@ -9,7 +12,7 @@ $ python bin/ci.py src/data_morph/shapes/bases/line_collection.py high_lines h_lines slant_down slant_up v_lines wide_lines x diamond rectangle star - python bin/ci.py src/data_morph/data/starter_shapes/superdatascience.csv +$ python bin/ci.py src/data_morph/data/starter_shapes/superdatascience.csv SDS """ from data_morph.shapes.factory import ShapeFactory From 4aa3187065fa0507afaf77534b50a7f552f9c1ee Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:50:53 +1100 Subject: [PATCH 04/14] Use SHAs for actions --- .github/workflows/generate-morphs.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index 7c396cab..10274934 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -34,10 +34,10 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 - name: Install Data Morph run: | @@ -47,7 +47,7 @@ jobs: - name: Get all dataset and shape files that have changed id: changed-files-yaml - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4 with: files_yaml: | dataset: @@ -92,7 +92,7 @@ jobs: --target-shape {} \ ::: bullseye heart rectangle star slant_up - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: morphed_data path: morphed_data From ade3cd09b9aabdc84fd3b77f313c1ba325c027aa Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:54:30 +1100 Subject: [PATCH 05/14] Add/modify comments --- .github/workflows/generate-morphs.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index 10274934..72d5e7e6 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -1,7 +1,5 @@ -# This workflow builds Data Morph on Mac, Linux, and Windows for -# multiple versions of Python to confirm it can be properly installed. -# -# For more information see https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python +# This workflow runs Data Morph on datasets and/or shapes that have +# been added or modified. # # Author: Stefanie Molin, Daniel Schaefer @@ -14,7 +12,6 @@ on: - 'docs/**' - 'tests/**' - concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true @@ -45,6 +42,7 @@ jobs: python -m pip install setuptools --upgrade python -m pip install . + # docs for this action: https://github.com/tj-actions/changed-files - name: Get all dataset and shape files that have changed id: changed-files-yaml uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4 From eca5a328b3b258718c947199948b86096a3d25ef Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:31:12 +1100 Subject: [PATCH 06/14] Lint and refactor bin/ci.py --- bin/ci.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/bin/ci.py b/bin/ci.py index 4844196a..a1d603ff 100644 --- a/bin/ci.py +++ b/bin/ci.py @@ -12,13 +12,18 @@ $ python bin/ci.py src/data_morph/shapes/bases/line_collection.py high_lines h_lines slant_down slant_up v_lines wide_lines x diamond rectangle star +$ python bin/ci.py src/data_morph/shapes/points/heart.py +heart spade + $ python bin/ci.py src/data_morph/data/starter_shapes/superdatascience.csv SDS """ -from data_morph.shapes.factory import ShapeFactory -from data_morph.data.loader import DataLoader + import sys -from os.path import basename +from pathlib import Path + +from data_morph.data.loader import DataLoader +from data_morph.shapes.factory import ShapeFactory new_paths = sys.argv[1:] @@ -31,16 +36,21 @@ args.append(dataset) # Figure out argument of shapes based on .py filename -new_files = [basename(x).split('/')[-1] for x in new_paths] -for shape, c in ShapeFactory._SHAPE_MAPPING.items(): - for new_file in new_files: - # Find the class and all parent classes and get their module name - # We get the module name because it ends in the python file without .py extension - # To make it easy to compare, we just add the extension onto the end - parents = [x.__module__ for x in c.__mro__] - all_modules = parents + [c.__module__] - all_modules = [f'{x}.py' for x in all_modules] +new_files = [Path(x).name for x in new_paths] +for shape, shape_cls in ShapeFactory._SHAPE_MAPPING.items(): + # Find the class and all parent classes and get their module name + # We get the module name because it ends in the python file without .py extension + # To make it easy to compare, we just add the extension onto the end + mro = [ + x.__module__ for x in shape_cls.__mro__ if x.__module__.startswith('data_morph') + ] + + if shape == 'spade': + mro.append('heart') + all_modules = [f'{x}.py' for x in mro] + + for new_file in new_files: for module in all_modules: if module.endswith(new_file): args.append(shape) From 0831d8e4ef12e2f5da72b79c77bb2a3f7d45708b Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:33:13 +1100 Subject: [PATCH 07/14] Change run criteria to package changes --- .github/workflows/generate-morphs.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index 72d5e7e6..df413753 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -8,9 +8,9 @@ name: Generate Morphs on: push: pull_request: - paths-ignore: - - 'docs/**' - - 'tests/**' + paths: + - 'src/**' + - 'pyproject.toml' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} From a4f3a94929ce92d3e615255666c98160e6ec6a9b Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:39:19 +1100 Subject: [PATCH 08/14] Set Python version --- .github/workflows/check-pr.yml | 2 +- .github/workflows/generate-morphs.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 7d463b96..49923956 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: - python-version: "3.11" + python-version: "3.x" - name: Install Dependencies run: | diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index df413753..3887546f 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -35,6 +35,8 @@ jobs: - name: Set up Python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: "3.x" - name: Install Data Morph run: | From fff51fcaa0bf8b2a70fba14da40070936b63ca99 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:56:28 +1100 Subject: [PATCH 09/14] Run shape differences in parallel as well --- .github/workflows/generate-morphs.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index 3887546f..cd5fb135 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -78,9 +78,10 @@ jobs: echo "Detected changes to shape(s): $SHAPE_ALL_CHANGED_FILES" SHAPE_ARGS=$(python bin/ci.py $SHAPE_ALL_CHANGED_FILES) echo "Generating morphs for the following shapes: $SHAPE_ARGS" - data-morph \ + parallel -j0 data-morph \ --start-shape music \ - --target-shape $SHAPE_ARGS \ + --target-shape {} \ + ::: $SHAPE_ARGS # For core code changes, we want to do a couple morphs to see if they still look ok # Only need to run if neither of the previous two morphs ran From 8ea2af2788ac1d45808997697fe7e5313ba3fef0 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:03:01 +1100 Subject: [PATCH 10/14] Run only on PR; update naming of artifact --- .github/workflows/generate-morphs.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yaml index cd5fb135..1b9cc457 100644 --- a/.github/workflows/generate-morphs.yaml +++ b/.github/workflows/generate-morphs.yaml @@ -6,7 +6,6 @@ name: Generate Morphs on: - push: pull_request: paths: - 'src/**' @@ -28,7 +27,7 @@ jobs: shell: bash -e {0} strategy: - fail-fast: false + fail-fast: false steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -95,5 +94,5 @@ jobs: - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: - name: morphed_data + name: morphed-data-pr${{ github.event.number }}-${{ github.sha }} path: morphed_data From bd4effa9241c61e4601f48875f3e3bf8eb60d654 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:06:18 +1100 Subject: [PATCH 11/14] Don't run CI on bin/ --- .github/workflows/ci.yml | 1 + .github/workflows/{generate-morphs.yaml => generate-morphs.yml} | 0 2 files changed, 1 insertion(+) rename .github/workflows/{generate-morphs.yaml => generate-morphs.yml} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a82646d..6e543fbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ on: branches: [ "main" ] paths: - '**' + - '!bin/**' - '!docs/**' - '!.github/**' - '.github/workflows/ci.yml' diff --git a/.github/workflows/generate-morphs.yaml b/.github/workflows/generate-morphs.yml similarity index 100% rename from .github/workflows/generate-morphs.yaml rename to .github/workflows/generate-morphs.yml From 41b80185b5da2913d0f9a699cf9db1211abee614 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:15:10 +1100 Subject: [PATCH 12/14] Cleanup --- .github/workflows/generate-morphs.yml | 8 ++++---- bin/ci.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate-morphs.yml b/.github/workflows/generate-morphs.yml index 1b9cc457..8812a945 100644 --- a/.github/workflows/generate-morphs.yml +++ b/.github/workflows/generate-morphs.yml @@ -16,10 +16,10 @@ concurrency: cancel-in-progress: true jobs: - build: + generate-morphs: name: Run Data Morph on new/altered datasets/shapes - # Just generate on one operating system, they should all be the same + # Just generate on one operating system (they should all be the same) runs-on: ubuntu-latest defaults: @@ -54,7 +54,7 @@ jobs: shape: - src/data_morph/shapes/** - # If datasets are added or changed + # If datasets were added or changed in this PR - name: Generate morphs from new or changed datasets if: steps.changed-files-yaml.outputs.dataset_any_changed == 'true' env: @@ -68,7 +68,7 @@ jobs: --target-shape {} \ ::: bullseye heart rectangle star slant_up - # If shapes are added or modified + # If shapes are added or modified in this PR - name: Generate morphs from new or changed shapes if: steps.changed-files-yaml.outputs.shape_any_changed == 'true' env: diff --git a/bin/ci.py b/bin/ci.py index a1d603ff..5467b12d 100644 --- a/bin/ci.py +++ b/bin/ci.py @@ -39,8 +39,7 @@ new_files = [Path(x).name for x in new_paths] for shape, shape_cls in ShapeFactory._SHAPE_MAPPING.items(): # Find the class and all parent classes and get their module name - # We get the module name because it ends in the python file without .py extension - # To make it easy to compare, we just add the extension onto the end + # We get the module name because it ends in the Python file without .py extension mro = [ x.__module__ for x in shape_cls.__mro__ if x.__module__.startswith('data_morph') ] From bacbd10395db3fc918125c062072bea7ea746b62 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:18:05 +1100 Subject: [PATCH 13/14] Temporarily run on any PR --- .github/workflows/generate-morphs.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/generate-morphs.yml b/.github/workflows/generate-morphs.yml index 8812a945..cdcacc99 100644 --- a/.github/workflows/generate-morphs.yml +++ b/.github/workflows/generate-morphs.yml @@ -7,9 +7,6 @@ name: Generate Morphs on: pull_request: - paths: - - 'src/**' - - 'pyproject.toml' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} From 150e7d9f937c57bb9dc4bf7edb08dfa4632fd13c Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:26:06 +1100 Subject: [PATCH 14/14] Add restrictions to running the generate-morphs action --- .github/workflows/generate-morphs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/generate-morphs.yml b/.github/workflows/generate-morphs.yml index cdcacc99..2a3c5408 100644 --- a/.github/workflows/generate-morphs.yml +++ b/.github/workflows/generate-morphs.yml @@ -7,6 +7,10 @@ name: Generate Morphs on: pull_request: + paths: + - 'src/**' + - 'pyproject.toml' + - '.github/workflows/generate-morphs.yml' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}