Skip to content

Comparing actions and pyTooling variant behavior. #39

Comparing actions and pyTooling variant behavior.

Comparing actions and pyTooling variant behavior. #39

name: Verification of Preserving Artifact Upload
on:
push:
workflow_dispatch:
jobs:
Build-1:
name: Build 1 - Upload artifact
runs-on: ubuntu-24.04
steps:
- name: 🖉 Build 1
run: |
echo "Document 1 $(date --utc '+%d.%m.%Y - %H:%M:%S')" > document1.txt
echo "Analysis log $(date --utc '+%d.%m.%Y - %H:%M:%S')" > analysis.log
echo "Build log $(date --utc '+%d.%m.%Y - %H:%M:%S')" > build.log
mkdir -p bin
echo "Program $(date --utc '+%d.%m.%Y - %H:%M:%S')" > bin/program.py
chmod u+x bin/program.py
echo "Tool $(date --utc '+%d.%m.%Y - %H:%M:%S')" > bin/tool.py
chmod g+x bin/tool.py
mkdir -p lib
echo "Library $(date --utc '+%d.%m.%Y - %H:%M:%S')" > lib/common.py
chmod +x lib/common.py
- name: 🔎 Inspect directory structure
run: |
tree .
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: github-release
path: |
document1.txt
*.log
bin/
lib/*.py
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: pyTooling-release
path: |
document1.txt
*.log
bin/
lib/*.py
- name: 📤 Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-single-file
path: |
document1.txt
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: pyTooling-single-file
path: |
document1.txt
- name: 📤 Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-single-file-in-directory
path: |
bin/program.py
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: pyTooling-single-file-in-directory
path: |
bin/program.py
- name: 📤 Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-double-file-in-directory
path: |
bin/program.py
bin/tool.py
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: pyTooling-double-file-in-directory
path: |
bin/program.py
bin/tool.py
- name: 📤 Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-single-directory
path: |
bin
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: pyTooling-single-directory
path: |
bin
- name: 📤 Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-double-directory
path: |
bin
lib
- name: 📤 Upload artifact
uses: pyTooling/upload-artifact@dev
with:
name: pyTooling-double-directory
path: |
bin
lib
Verify-1:
name: Verify artifact content
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: release
- name: 🔎 Inspect downloaded artifact content
run: |
set +e
ANSI_LIGHT_RED="\e[91m"
ANSI_LIGHT_GREEN="\e[92m"
ANSI_NOCOLOR="\e[0m"
echo "List directory content"
ls -lAh .
echo "----------------------------------------"
echo -n "Does tarball exist ... "
if [[ ! -f __upload_artifact__.tar ]]; then
echo -e "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}"
echo -e "${ANSI_LIGHT_RED}Artifact doesn't contain a tar file named '__upload_artifact__.tar'.${ANSI_NOCOLOR}"
exit 1
else
echo -e "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}"
fi
- name: 📦 Extract tarball
run: |
set +e
ANSI_LIGHT_RED="\e[91m"
ANSI_LIGHT_GREEN="\e[92m"
ANSI_NOCOLOR="\e[0m"
echo -n "Extracting tarball ... "
tar -xf __upload_artifact__.tar
if [[ $? -ne 0 ]]; then
echo -e "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}"
else
echo -e "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}"
fi
- name: 🔎 Inspect extracted tarball
run: |
tree .
- name: 📋 Verify extracted tarball content
run: |
set +e
ANSI_LIGHT_RED="\e[91m"
ANSI_LIGHT_GREEN="\e[92m"
ANSI_NOCOLOR="\e[0m"
expected=(
"document1.txt"
"analysis.log"
"build.log"
"bin/program.py"
"lib/common.py"
)
errors=0
for file in "${expected[@]}"; do
echo -n "Checking '${file}' ... "
if [[ -f "$file" ]]; then
echo -e "${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}"
else
echo -e "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}"
echo -e "${ANSI_LIGHT_RED}Extracted artifact doesn't contain file '${file}'.${ANSI_NOCOLOR}"
errors=$((errors + 1))
fi
done
echo ""
if [[ $errors -ne 0 ]]; then
echo -e "${ANSI_LIGHT_RED}Counted ${errors} errors.${ANSI_NOCOLOR}"
exit 1
else
echo -e "${ANSI_LIGHT_GREEN}No errors found.${ANSI_NOCOLOR}"
fi
- name: 📋 Verify file permissions
run: |
set +e
ANSI_LIGHT_RED="\e[91m"
ANSI_LIGHT_GREEN="\e[92m"
ANSI_NOCOLOR="\e[0m"
expected=(
"bin/program.py"
"lib/common.py"
)
errors=0
for file in "${expected[@]}"; do
echo -n "Checking '${file}' ... "
if [[ -x "$file" ]]; then
echo -e "${ANSI_LIGHT_GREEN}[PASSED]${ANSI_NOCOLOR}"
else
echo -e "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}"
echo -e "${ANSI_LIGHT_RED}File '${file}' isn't executable.${ANSI_NOCOLOR}"
errors=$((errors + 1))
fi
done
echo ""
if [[ $errors -ne 0 ]]; then
echo -e "${ANSI_LIGHT_RED}Counted ${errors} errors.${ANSI_NOCOLOR}"
exit 1
else
echo -e "${ANSI_LIGHT_GREEN}No errors found.${ANSI_NOCOLOR}"
fi
Inspect-2-1:
name: Inspect single file
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: github-single-file
- name: 🔎 Inspect extracted tarball
run: |
tree .
Inspect-2-2:
name: Inspect single file in directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: github-single-file-in-directory
- name: 🔎 Inspect extracted tarball
run: |
tree .
Inspect-2-3:
name: Inspect double file in directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: github-double-file-in-directory
- name: 🔎 Inspect extracted tarball
run: |
tree .
Inspect-2-4:
name: Inspect single directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: github-single-directory
- name: 🔎 Inspect extracted tarball
run: |
tree .
Inspect-2-5:
name: Inspect double directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: github-double-directory
- name: 🔎 Inspect extracted tarball
run: |
tree .
Verify-2-1:
name: Verify single file
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: pyTooling-single-file
- name: 🔎 Inspect extracted tarball
run: |
tar -xf "__upload_artifact__.tar"
rm __upload_artifact__.tar
tree .
Verify-2-2:
name: Verify single file in directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: pyTooling-single-file-in-directory
- name: 🔎 Inspect extracted tarball
run: |
tar -xf "__upload_artifact__.tar"
rm __upload_artifact__.tar
tree .
Verify-2-3:
name: Verify double file in directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: pyTooling-double-file-in-directory
- name: 🔎 Inspect extracted tarball
run: |
tar -xf "__upload_artifact__.tar"
rm __upload_artifact__.tar
tree .
Verify-2-4:
name: Verify single directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: pyTooling-single-directory
- name: 🔎 Inspect extracted tarball
run: |
tar -xf "__upload_artifact__.tar"
rm __upload_artifact__.tar
tree .
Verify-2-5:
name: Verify double directory
runs-on: ubuntu-24.04
needs:
- Build-1
steps:
- name: 📥 Download artifact
uses: actions/download-artifact@v4
with:
name: pyTooling-double-directory
- name: 🔎 Inspect extracted tarball
run: |
tar -xf "__upload_artifact__.tar"
rm __upload_artifact__.tar
tree .