Skip to content

Commit

Permalink
19
Browse files Browse the repository at this point in the history
  • Loading branch information
mkst committed Sep 11, 2023
1 parent f3ecc7e commit deea7ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
uses: actions/checkout@v3

- name: Create list of changed files
id: changed-files
run: |
# See https://github.community/t/check-pushed-file-changes-with-git-diff-tree-in-github-actions/17220/10
if [ $GITHUB_BASE_REF ]; then
Expand All @@ -34,14 +33,12 @@ jobs:
export DIFF=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA )
echo "Diff between ${{ github.event.before }} and $GITHUB_SHA"
fi
echo "$DIFF"
# Escape newlines (replace \n with ,)
echo "diff=$( echo "$DIFF" | sed ':a;N;$!ba;s/\n/,/g' )" >> $GITHUB_OUTPUT
echo "$DIFF" | tee changed_files.txt
- name: Create matrix of images to generate
id: create-matrix
run: |
echo "matrix=$(python3 matrix.py ${{ steps.changed-files.outputs.diff }})" >> $GITHUB_OUTPUT
echo "matrix=$(python3 matrix.py)" >> $GITHUB_OUTPUT
run_matrix:
name: Run Matrix
Expand Down
10 changes: 8 additions & 2 deletions matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@

def main():

# TODO:
# add arguments
# --platforms=n64,ps1,gc_wii ; limit to selected platforms
# --changed-files=files.txt ; limit to selected Dockerfiles

dockerfiles = glob.glob("platforms/*/*/Dockerfile")
dockerfiles += glob.glob("platforms/*/*/*/Dockerfile")

if len(sys.argv) > 1:
# if we are passed an argument, use it to filter dockerfiles
filtered_dockerfiles = sys.argv[2].split(",")
# if we are passed an argument, treat it as a file listing all changes
with open(sys.argv[1], "r") as f:
filtered_dockerfiles = f.readlines()
dockerfiles = filter(lambda x: x in filtered_dockerfiles, dockerfiles)

includes = []
Expand Down

0 comments on commit deea7ff

Please sign in to comment.