Skip to content

Test random 💯

Test random 💯 #77

Workflow file for this run

name: "Test random 💯"
env:
TERM: xterm
on:
push:
branches: main
paths: 'programs/x86_64/**'
#pull_request:
# branches: main
# paths: 'programs/x86_64/**'
workflow_dispatch:
schedule:
- cron: '0 23 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
actions: write
contents: write
jobs:
generate-matrix:
name: "matrix 🌀"
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
count: ${{ steps.am-install.outputs.count }}
steps:
- name: "Check out repository 🏃"
uses: actions/checkout@v4
- name: "Show stats 📝"
run: |
x64Count=$(find programs/x86_64/ -type f | wc -l)
i68Count=$(find programs/i686/ -type f | wc -l)
a64Count=$(find programs/aarch64/ -type f | wc -l)
tested=$(wc -l < tested.list) || tested="0"
echo "### 🎬 apps" >> $GITHUB_STEP_SUMMARY
echo "$x64Count x86_64" >> $GITHUB_STEP_SUMMARY
echo "$i68Count i686" >> $GITHUB_STEP_SUMMARY
echo "$a64Count aarch64" >> $GITHUB_STEP_SUMMARY
echo "tested $tested" >> $GITHUB_STEP_SUMMARY
- name: "Generate Matrix 🏆"
id: set-matrix
run: |
mkdir -p results
find programs/x86_64/ -maxdepth 1 -type f -printf "%f\n" | sort > all.list
if [[ -f tested.list ]]; then
comm -23 all.list tested.list > totest.list
else
cp all.list totest.list
fi
FILES=$(shuf -n 100 totest.list || cat totest.list)
MATRIX="{\"include\": ["
for file in $FILES; do
MATRIX+="{\"file\": \"$file\"},"
done
MATRIX="${MATRIX%,}]}"
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
run-actions:
name: "🔨"
needs: generate-matrix
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
env:
TIMEOUT: 10
steps:
- name: "Check out repository 🏃"
uses: actions/checkout@v4
- name: "Install dependencies 📦️"
run: |
sudo apt-get -y update
sudo apt-get -y install wget curl torsocks zsync 2> /dev/null
- name: "Install AM 🎁"
run: |
mkdir -p results /usr/local/bin
chmod +x ./INSTALL
sudo ./INSTALL
- name: "test ${{ matrix.file }} 🚧"
run: |
mkdir -p results
script_content=$(curl -Ls https://raw.githubusercontent.com/ivan-hc/AM/main/programs/x86_64/"${{ matrix.file }}")
pure_arg=$(echo "${{ matrix.file }}" | sed 's/\.appimage//g; s/\^debian-testing-//g; s/\-appimage$//g' | sed 's:.*/::')
if [ ! -d /opt/"$pure_arg" ] \
&& [ ${{ matrix.file }} != code ] \
&& [ ${{ matrix.file }} != libfuse2 ] \
&& [ ${{ matrix.file }} != libreoffice ] \
&& [ ${{ matrix.file }} != mpv ] \
&& [ ${{ matrix.file }} != npm ] \
&& [ ${{ matrix.file }} != wine ] \
&& [ -z "$(PATH=/usr/local/bin command -v "$pure_arg" 2>/dev/null)" ] \
&& ! echo "$script_content" | grep -q "^#.*spooky" \
&& ! echo "${{ matrix.file }}" | grep -q "deadbeef" \
&& timeout "$TIMEOUT"m am -i "${{ matrix.file }}" --debug; then
echo ""
echo " Structure of the directory in /opt"
echo ""
if test -d /opt/kdegames; then
ls /opt/kdegames || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
elif test -d /opt/kdeutils; then
ls /opt/kdeutils || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
elif test -d /opt/platform-tools; then
ls /opt/platform-tools || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
elif test -d /opt/"${{ matrix.file }}"; then
ls /opt/"${{ matrix.file }}" || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
else
ls /opt/"$pure_arg" || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
fi
echo ""
echo "-------------------------------------------------------------"
echo ""
echo " Command in \$PATH"
echo ""
command -v "$pure_arg" || ls /usr/local/bin || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
echo ""
echo "-------------------------------------------------------------"
echo ""
echo " Launchers in /usr/local/share/applications"
echo ""
if test -f /usr/local/share/applications/*AM.desktop 2>/dev/null; then
ls /usr/local/share/applications | grep "AM.desktop$"
else
ls /usr/local/share/applications || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
fi
echo ""
echo "-------------------------------------------------------------"
am -R "${{ matrix.file }}" && echo "${{ matrix.file }}" > results/results-${{ matrix.file }} || echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
else
if [[ $? -eq 124 ]]; then
echo "### 💥 ${{ matrix.file }} timeout!" >> $GITHUB_STEP_SUMMARY
echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
else
echo "### 💀 ${{ matrix.file }}" >> $GITHUB_STEP_SUMMARY
echo "${{ matrix.file }}" > results/failed-${{ matrix.file }}
fi
exit 1
fi
- name: "Upload Failed Results ☝️"
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-${{ matrix.file }}
path: results/failed-${{ matrix.file }}
- name: "Upload Test Results ⬆️"
if: success()
uses: actions/upload-artifact@v4
with:
name: results-${{ matrix.file }}
path: results/results-${{ matrix.file }}
update-tested-list:
name: "results 📰"
needs: run-actions
runs-on: ubuntu-22.04
if: always()
steps:
- name: "Check out repository 🏃"
uses: actions/checkout@v4
- name: "Download Test Results ⬇️"
uses: actions/download-artifact@v4
with:
path: results
merge-multiple: true
- run: ls -R results
- name: "Git Config"
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: "Aggregate Succeded Results"
run: |
ls -R results
if compgen -G "results/results-*" > /dev/null; then
for file in results/results-*; do
cat "$file" >> aggregated.list
done
cat aggregated.list >> tested.list
sort -u tested.list -o tested.list
git add tested.list
git commit -m "update tested.list"
git push
else
echo "Nothing tested succesfully?"
fi
- name: "Aggregate Failed Results"
run: |
ls -R results
if compgen -G "results/failed-*" > /dev/null; then
for file in results/failed-*; do
cat "$file" >> fail.list
done
fail=$(wc -l < fail.list)
cat fail.list >> failed.list
sort -u failed.list -o failed.list
git add failed.list
git commit -m "update failed.list"
git push
else
echo "Nothing failed? Great!"
fail="0"
fi
- name: "Show Results 🏁"
if: always()
run: |
echo "DEBUG:"
echo "fail is $fail"
echo "failed is $failed"
ls
echo "DEBUG"
tested=$(wc -l < tested.list)
count=$(find programs/x86_64/ -type f | wc -l)
remaining=$((count - tested))
echo "### ⭐ $tested tested" >> $GITHUB_STEP_SUMMARY
echo "## 🛅 $remaining to test" >> $GITHUB_STEP_SUMMARY
fail=$(wc -l < fail.list 2>/dev/null || echo "0")
failed=$(wc -l < failed.list 2>/dev/null || echo "0")
echo "😱 $failed fails listed" >> $GITHUB_STEP_SUMMARY
echo ":x: $fail failed now" >> $GITHUB_STEP_SUMMARY
delete-all-artifacts:
name: "cleanup 🧹"
runs-on: ubuntu-22.04
needs: update-tested-list
if: always()
steps:
- name: "Check out repository 🏃"
uses: actions/checkout@v4
- name: "Delete Artifacts 🙈"
env:
REPO_NAME: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Fetching and deleting all artifacts for run ID: $RUN_ID"
PAGE=1
DELETED=0
while true; do
RESPONSE=$(curl -s -H "Authorization: token $TOKEN" \
"https://api.github.com/repos/$REPO_NAME/actions/runs/$RUN_ID/artifacts?per_page=100&page=$PAGE")
ARTIFACT_IDS=$(echo "$RESPONSE" | jq -r '.artifacts[].id')
if [[ -z "$ARTIFACT_IDS" ]]; then
echo "No more artifacts to delete. Total deleted: $DELETED"
break
fi
for ARTIFACT_ID in $ARTIFACT_IDS; do
echo "Deleting artifact with ID: $ARTIFACT_ID"
curl -X DELETE -s -H "Authorization: token $TOKEN" \
"https://api.github.com/repos/$REPO_NAME/actions/artifacts/$ARTIFACT_ID"
((DELETED+=1))
done
((PAGE+=1))
done
echo "Successfully deleted $DELETED artifacts."