Skip to content

gh-actions: Build and upload all artifacts #7

gh-actions: Build and upload all artifacts

gh-actions: Build and upload all artifacts #7

# This workflow runs Data Morph on datasets and/or shapes that have
# been added or modified.
#
# Author: Stefanie Molin, Daniel Schaefer
name: Generate Morphs
on:
push:
pull_request:
paths-ignore:
- 'docs/**'
- 'tests/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
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
defaults:
run:
shell: bash -e {0}
strategy:
fail-fast: false
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- name: Install Data Morph
run: |
python -m pip install --upgrade pip
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
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 "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 \
--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 "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 \
--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 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 \
--start-shape music \
--target-shape {} \
::: bullseye heart rectangle star slant_up
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: morphed_data
path: morphed_data