Skip to content

Commit

Permalink
ci: add type-checking step with real Live resources
Browse files Browse the repository at this point in the history
  • Loading branch information
kmontag committed Aug 19, 2024
1 parent b396ad7 commit 62f801a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,24 @@ jobs:
- run: python -m pip install poetry
- run: poetry install
- run: make lint

check-types:
runs-on: macos-13
timeout-minutes: 30
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Install Ableton Live
run: brew install --cask ableton-live-lite

- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip

- run: python -m pip install poetry
- run: poetry install
- run: make check
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
POETRY := $(shell command -v poetry 2> /dev/null)

SYSTEM_MIDI_REMOTE_SCRIPTS_DIR := /Applications/Ableton\ Live\ 12\ Suite.app/Contents/App-Resources/MIDI\ Remote\ Scripts
# Recognize "Ableton Live 12 Suite", "Ableton Live 12 Lite", etc. Escape whitespace int
# he result so that we can use this as a target.
SYSTEM_MIDI_REMOTE_SCRIPTS_DIR := $(shell ls -d /Applications/Ableton\ Live\ 12\ *.app/Contents/App-Resources/MIDI\ Remote\ Scripts 2> /dev/null | head -n 1 | sed 's/ /\\ /g')

TEST_PROJECT_SET_NAMES := backlight default overrides standalone wide_clip_launch
TEST_PROJECT_DIR := tests/modeStep_tests_project
Expand Down Expand Up @@ -34,8 +36,7 @@ img: .make.install
.PHONY: clean
clean:
rm -rf __ext__/System_MIDIRemoteScripts/
# The .venv folder gets created by poetry (because
# tool.poetry.virtualenvs.in-project is enabled).
# The .venv folder gets created by poetry (because virtualenvs.in-project is enabled).
rm -rf .venv/
rm -f .make.install

Expand All @@ -44,8 +45,22 @@ $(TEST_PROJECT_DIR)/%.als: .make.install $(TEST_PROJECT_DIR)/create_set.py
$(POETRY) run python $(TEST_PROJECT_DIR)/create_set.py $*

__ext__/System_MIDIRemoteScripts/.make.decompile: $(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR) | .make.install
# Sanity check before rm'ing.
@if [ -z "$(@D)" ]; then \
echo "Sanity check failed: compile dir is not set"; \
exit 1; \
fi
rm -rf $(@D)/
mkdir -p $(@D)/ableton/
@if [ -z $(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR) ]; then \
echo "System remote scripts directory not found" ; \
exit 1; \
fi
@if [ ! -d $(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR) ]; then \
echo "The specified remote scripts directory ("$(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR)") does not exist"; \
exit 1; \
fi

# decompyle3 works for most files, and the ones where it doesn't don't
# matter for our purposes.
$(POETRY) run decompyle3 -r -o $(@D)/ableton/ $(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR)/ableton/
Expand Down

0 comments on commit 62f801a

Please sign in to comment.