Skip to content

Commit

Permalink
get changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
tisutisu committed Nov 4, 2024
1 parent 5ff1e15 commit 923122a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/run-task-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ jobs:
task/**
test/**
- name: List all changed task and test files
if: steps.changed-files.outputs.any_changed == 'true'
- name: Check if any task and test files changed
run: |
if ${{ steps.changed-files.outputs.any_changed }} != 'true'; then
echo "No test or task files changed, exiting..."
exit 0
fi
- name: Get the changed files

Check failure on line 32 in .github/workflows/run-task-tests.yaml

View workflow job for this annotation

GitHub Actions / yamllint

32:36 [trailing-spaces] trailing spaces
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
echo ${CHANGED_FILES}
# for file in ${ALL_CHANGED_FILES}; do
# echo "$file"
# done
- name: Checkout build-defintions Repository
uses: actions/checkout@v3
Expand Down
16 changes: 7 additions & 9 deletions test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,19 @@ function set_test_return_code() {
}

function detect_changed_e2e_test() {
# detect for changes in hack dir
# TODO: change PULL_BASE_SHA and PULL_PULL_SHA with values applicable for PAC/GA
git --no-pager diff --name-only "${PULL_BASE_SHA}".."${PULL_PULL_SHA}"|grep "^test/[^/]*"
# check if any file from test directory is changed
echo ${CHANGED_FILES} |grep "^test/[^/]*"
}

function detect_new_changed_resources() {
# TODO: change PULL_BASE_SHA and PULL_PULL_SHA with values applicable for PAC/GA
# detect for changes in tests dir of the task
git --no-pager diff --name-only "${PULL_BASE_SHA}".."${PULL_PULL_SHA}"|grep 'task/[^\/]*/[^\/]*/tests/[^/]*'|xargs -I {} dirname {}|sed 's/\(tests\).*/\1/g'
# detect for changes in task or tests dir of the task
echo ${CHANGED_FILES} |grep 'task/[^\/]*/[^\/]*/tests/[^/]*'|xargs -I {} dirname {}|sed 's/\(tests\).*/\1/g'
# detect for changes in the task manifest
git --no-pager diff --name-only "${PULL_BASE_SHA}".."${PULL_PULL_SHA}"|grep 'task/[^\/]*/[^\/]*/*[^/]*.yaml'|xargs -I {} dirname {}|awk '{print $1"/tests"}'
echo ${CHANGED_FILES} |grep 'task/[^\/]*/[^\/]*/*[^/]*.yaml'|xargs -I {} dirname {}|awk '{print $1"/tests"}'
# detect for changes in tests dir of the stepaction
git --no-pager diff --name-only "${PULL_BASE_SHA}".."${PULL_PULL_SHA}"|grep 'stepactions/[^\/]*/[^\/]*/tests/[^/]*'|xargs -I {} dirname {}|sed 's/\(tests\).*/\1/g'
echo ${CHANGED_FILES} |grep 'stepactions/[^\/]*/[^\/]*/tests/[^/]*'|xargs -I {} dirname {}|sed 's/\(tests\).*/\1/g'
# detect for changes in the stepaction manifest
git --no-pager diff --name-only "${PULL_BASE_SHA}".."${PULL_PULL_SHA}"|grep 'stepactions/[^\/]*/[^\/]*/*[^/]*.yaml'|xargs -I {} dirname {}|awk '{print $1"/tests"}'
echo ${CHANGED_FILES} |grep 'stepactions/[^\/]*/[^\/]*/*[^/]*.yaml'|xargs -I {} dirname {}|awk '{print $1"/tests"}'
}

# Signal (as return code and in the logs) that all E2E tests passed.
Expand Down

0 comments on commit 923122a

Please sign in to comment.