Skip to content

Commit

Permalink
ci: ignoring tests if not tools were updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nishaq503 committed Jul 18, 2024
1 parent d004ef8 commit a4ccab4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/package-filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
list:
description: "The list of directories containing the updated packages"
value: ${{ jobs.package-filter.outputs.list }}
num_packages:
description: "The number of updated packages"
value: ${{ jobs.package-filter.outputs.num_packages }}

permissions:
contents: read
Expand All @@ -31,6 +34,7 @@ jobs:
outputs:
matrix: ${{ steps.package-filter.outputs.matrix }}
list: ${{ steps.package-filter.outputs.list }}
num_packages: ${{ steps.package-filter.outputs.num_packages }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -41,6 +45,7 @@ jobs:
- name: Find Updated Packages
id: package-filter
run: |
NUM_PACKAGES=0
PACKAGE_DIRS=""
COMPANION_FILES="VERSION .bumpversion.cfg"
Expand Down Expand Up @@ -123,6 +128,7 @@ jobs:
fi
fi
NUM_PACKAGES=$((NUM_PACKAGES+1))
PACKAGE_DIRS="$PACKAGE_DIRS ${pkg_dir}"
fi
done
Expand All @@ -136,6 +142,7 @@ jobs:
then
echo "::error::No updated packages were found" && exit 1
fi
echo "The number of updated packages is $NUM_PACKAGES"
# Convert the package directories to JSON for the output matrix
JSON="{\"include\": ["
Expand All @@ -160,3 +167,4 @@ jobs:
# Set the output
echo "matrix=$( echo "$JSON" )" >> $GITHUB_OUTPUT
echo "list=$( echo "$PACKAGE_DIRS" )" >> $GITHUB_OUTPUT
echo "num_packages=$NUM_PACKAGES" >> $GITHUB_OUTPUT
3 changes: 3 additions & 0 deletions .github/workflows/package-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
pre-commit:
name: Pre-commit | ${{ matrix.package_name }}
needs: package-filter
if: ${{ needs.package-filter.outputs.num_packages > 0 }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.package-filter.outputs.matrix) }}
Expand Down Expand Up @@ -56,6 +57,7 @@ jobs:
docker:
name: Docker | Build ${{ matrix.package_name }}
needs: package-filter
if: ${{ needs.package-filter.outputs.num_packages > 0 }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.package-filter.outputs.matrix) }}
Expand Down Expand Up @@ -106,6 +108,7 @@ jobs:
tests:
name: Test | ${{ matrix.package_name }}
needs: package-filter
if: ${{ needs.package-filter.outputs.num_packages > 0 }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.package-filter.outputs.matrix) }}
Expand Down

0 comments on commit a4ccab4

Please sign in to comment.