Skip to content

Commit

Permalink
Remove Python setup and fix multiline prerequisites output (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
colluca authored Sep 7, 2024
1 parent 8338b99 commit 08ef974
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
flags: --recursive
- name: Check recursive prerequisites
run: |
test "${{ steps.recursive-prerequisites.outputs.prerequisites }}" = "preprereq"
test "${{ steps.recursive-prerequisites.outputs.prerequisites }}" = "preprereq1 preprereq2"
echo ${{ steps.recursive-prerequisites.outputs.hash }}
8 changes: 2 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@ outputs:
runs:
using: "composite"
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Dependencies
shell: bash
run: pip install -r requirements.txt
run: python -m pip install -r ${GITHUB_ACTION_PATH}/requirements.txt
- name: List Make Prerequisites
id: list-make-prerequisites
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
hash=$(${GITHUB_ACTION_PATH}/list-make-prerequisites.py ${{ inputs.target }} ${{ inputs.flags }} --hash 2>/dev/null)
prerequisites=$(${GITHUB_ACTION_PATH}/list-make-prerequisites.py ${{ inputs.target }} ${{ inputs.flags }} 2>/dev/null)
prerequisites=$(${GITHUB_ACTION_PATH}/list-make-prerequisites.py ${{ inputs.target }} ${{ inputs.flags }} 2>/dev/null | xargs)
echo "hash=$hash" >> $GITHUB_OUTPUT
echo "prerequisites=$prerequisites" >> $GITHUB_OUTPUT
6 changes: 3 additions & 3 deletions list-make-prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def list_prerequisites(target, recursive=False, debug=False):
# Find all leaf prerequisites
leaf_prerequisites = [node.name for node in root.descendants if node.is_leaf]

# Remove repetitions
leaf_prerequisites = list(set(leaf_prerequisites))
# Remove repetitions and sort for consistency
leaf_prerequisites = sorted(list(set(leaf_prerequisites)))

# Return prerequisites
return leaf_prerequisites
Expand Down Expand Up @@ -158,7 +158,7 @@ def hash_files(file_list):

if args.hash:
# Print a hash of the prerequisites' contents
hash_value = hash_files(sorted(prerequisites))
hash_value = hash_files(prerequisites)
print(hash_value)
else:
# Print the list of prerequisites
Expand Down
3 changes: 2 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test: prereq
cp $< $@

prereq: preprereq
prereq: preprereq1 preprereq2
cp $< $@
cat preprereq2 >> $@
1 change: 0 additions & 1 deletion test/preprereq

This file was deleted.

1 change: 1 addition & 0 deletions test/preprereq1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preprereq1
1 change: 1 addition & 0 deletions test/preprereq2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preprereq2

0 comments on commit 08ef974

Please sign in to comment.