Skip to content

Commit

Permalink
Added more tests for unexpected files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Dec 25, 2024
1 parent 4337858 commit 7979bd0
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/actions/check-artifact-content/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ runs:
printf "%s\n" "${ANSI_LIGHT_GREEN}[YES]${ANSI_NOCOLOR}"
else
printf "%s\n" "${ANSI_LIGHT_RED}[YES]${ANSI_NOCOLOR}"
printf "::error file=%s,title=%s::%s\n" "${{ inputs.tarball }}" "check-artifact-content" "Tarball '${{ inputs.tarball }}' wasn't removed."
exit 1
fi
else
if [[ "${{ inputs.must-exist }}" == "true" ]]; then
printf "%s\n" "${ANSI_LIGHT_RED}[NO]${ANSI_NOCOLOR}"
printf "::error file=%s,title=%s::%s\n" "${{ inputs.tarball }}" "check-artifact-content" "Tarball '${{ inputs.tarball }}' is missing."
exit 1
else
printf "%s\n" "${ANSI_LIGHT_GREEN}[NO]${ANSI_NOCOLOR}"
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/check-directory-content/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ runs:
printf "%s\n" "${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}"
else
printf "%s\n" "${ANSI_LIGHT_RED}[MISSING]${ANSI_NOCOLOR}"
printf "::error file=%s,title=%s::%s\n" "${file}" "check-directory-content" "File '${file}' is missing."
errors=$((errors + 1))
fi
done <<<'${{ inputs.expected-files }}'
Expand Down Expand Up @@ -77,6 +78,7 @@ runs:
printf "%s" "Checking '${file}' ... "
if [[ -f "$file" ]]; then
printf "%s\n" "${ANSI_LIGHT_RED}[UNEXPECTED]${ANSI_NOCOLOR}"
printf "::error file=%s,title=%s::%s\n" "${file}" "check-directory-content" "File '${file}' is unexpected."
errors=$((errors + 1))
else
printf "%s\n" "${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}"
Expand Down
1 change: 1 addition & 0 deletions .github/actions/file-is-executable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ runs:
printf "%s\n" "${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}"
else
printf "%s\n" "${ANSI_LIGHT_RED}[NOT EXECUTABLE]${ANSI_NOCOLOR}"
printf "::error file=%s,title=%s::%s\n" "${file}" "file-is-executable" "File '${file}' isn't executable."
errors=$((errors + 1))
fi
done <<<'${{ inputs.files }}'
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/ArtifactsUpload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ jobs:
- name: 📋 Verify file permissions
uses: ./.github/actions/file-is-executable
if: matrix.os.name != 'Windows'
with:
files: |
bin/program.py
Expand Down Expand Up @@ -384,6 +385,18 @@ jobs:
with:
expected-files: |
document1.txt
unexpected-files: |
.config
analysis.log
build.log
bin/program.py
bin/tool.py
bin/.settings
lib/common.py
lib/shared.py
lib/.library
lib/gui/main.py
lib/gui/dialog.py
Inspect-2:
name: ${{ matrix.os.icon }} Inspect single file in directory ${{ matrix.task.action }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -427,13 +440,19 @@ jobs:
with:
expected-files: |
program.py
unexpected-files: |
tool.py
.settings
- name: 📋 Verify extracted tarball content
uses: ./.github/actions/check-directory-content
if: matrix.task.name == 'verify'
with:
expected-files: |
bin/program.py
unexpected-files: |
bin/tool.py
bin/.settings
Inspect-3:
name: ${{ matrix.os.icon }} Inspect double file in directory ${{ matrix.task.action }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -478,6 +497,8 @@ jobs:
expected-files: |
program.py
tool.py
unexpected-files: |
.settings
- name: 📋 Verify extracted tarball content
uses: ./.github/actions/check-directory-content
Expand All @@ -486,6 +507,8 @@ jobs:
expected-files: |
bin/program.py
bin/tool.py
unexpected-files: |
bin/.settings
Inspect-4:
name: ${{ matrix.os.icon }} Inspect triple file in directory ${{ matrix.task.action }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -531,6 +554,9 @@ jobs:
common.py
gui/main.py
gui/dialog.py
unexpected-files: |
shared.py
.library
- name: 📋 Verify extracted tarball content
uses: ./.github/actions/check-directory-content
Expand All @@ -540,6 +566,9 @@ jobs:
lib/common.py
lib/gui/main.py
lib/gui/dialog.py
unexpected-files: |
lib/shared.py
lib/.library
Inspect-5:
name: ${{ matrix.os.icon }} Inspect double file in deep directory ${{ matrix.task.action }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -636,6 +665,8 @@ jobs:
expected-files: |
program.py
tool.py
unexpected-files: |
.settings
- name: 📋 Verify extracted tarball content
uses: ./.github/actions/check-directory-content
Expand All @@ -644,6 +675,8 @@ jobs:
expected-files: |
bin/program.py
bin/tool.py
unexpected-files: |
bin/.settings
Inspect-7:
name: ${{ matrix.os.icon }} Inspect double directory ${{ matrix.task.action }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -692,6 +725,9 @@ jobs:
lib/shared.py
lib/gui/main.py
lib/gui/dialog.py
unexpected-files: |
bin/.settings
lib/.library
- name: 📋 Verify extracted tarball content
uses: ./.github/actions/check-directory-content
Expand All @@ -704,6 +740,9 @@ jobs:
lib/shared.py
lib/gui/main.py
lib/gui/dialog.py
unexpected-files: |
bin/.settings
lib/.library
Inspect-8:
name: ${{ matrix.os.icon }} Unpredictable Wildcard ${{ matrix.task.action }} on ${{ matrix.os.name }}
Expand Down Expand Up @@ -748,6 +787,10 @@ jobs:
expected-files: |
lib/gui/main.py
lib/gui/dialog.py
unexpected-files: |
lib/common.py
lib/shared.py
lib/.library
- name: 📋 Verify extracted tarball content
uses: ./.github/actions/check-directory-content
Expand All @@ -756,6 +799,11 @@ jobs:
expected-files: |
lib/gui/main.py
lib/gui/dialog.py
unexpected-files: |
lib/common.py
lib/shared.py
lib/.library
Verify-9:
name: Verify lib directory
Expand Down Expand Up @@ -800,3 +848,5 @@ jobs:
shared.py
gui/dialog.py
gui/main.py
unexpected-files: |
.library
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ To ensure files are extracted and assigned to the owner/group of the extracting

### On macOS (BSD tar)

⚠ BSD tar doesn't support a `--delete` option. Thus, hidden files (dot files) can't be removed (excluded) from tarballs.
Removing discovered hidden files afterward from created tarballs is used on runner OS providing GNU tar. This technique
can't be applied to BSD tar.

⚠ BSD tar doesn't support a `--verbatim-files-from` option. Thus, files starting with a dash might be interpreted by `tar`
as a command line option.

Expand Down

0 comments on commit 7979bd0

Please sign in to comment.