refactor: consolidate and simplify quickget tests

This commit is contained in:
Martin Wimpress 2024-05-16 16:23:48 +01:00 committed by Martin Wimpress
parent f4fbb7dd29
commit 8f58d0e07c
1 changed files with 25 additions and 81 deletions

View File

@ -13,96 +13,40 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs: jobs:
list-all-supported: quickget-tests:
name: "List all supported OS 📝" name: "Run quickget tests 👟"
runs-on: ubuntu-22.04
# The type of runner that the job will run on
#runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: "List all supported OS variants"
run: |
mkdir -p results
./quickget --list | tee results/supported.txt
echo -e "\nResults:"
echo "- All supported OS variants: $(wc -l results/supported.txt | cut -d' ' -f 1)"
- uses: actions/upload-artifact@v4
with:
name: supported
path: results/supported.txt
list-all-urls:
needs: [list-all-supported]
name: "List all URLs 🔗"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: "quickget --url" - name: "Install dependencies 📦️"
run: |
sudo apt-get -y update
sudo apt-get -y install curl qemu-utils
- name: "List OS variants 📃"
run: | run: |
export TERM=xterm-256color
mkdir -p results mkdir -p results
./quickget --url | tee results/urls.txt ./quickget --list | tail -n +2 | tee results/list.txt
- uses: actions/download-artifact@v4 - name: "Check OS downloads 💿️"
with:
path: results
merge-multiple: true
- name: "Show differences ⚖️"
run: | run: |
echo -e "\nResults:"
echo -e "List All URLs:\t$(grep -c http results/urls.txt)"
echo -e "OS Info URLs:\t$(wc -l results/supported.txt | cut -d' ' -f 1)"
- uses: actions/upload-artifact@v4
with:
name: urls
path: results/urls.txt
check-all-urls:
name: "Check all image URLs 💿️"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: "quickget --check"
run: |
export TERM=xterm-256color
mkdir -p results mkdir -p results
./quickget --check | tee results/checks.txt ./quickget --check | tee results/check.txt
WINDOWS=$(grep -c "windows-" results/checks.txt) - name: "Display results 📊"
FAILED=$(grep -c ^FAIL results/checks.txt) run: |
SKIPPED=$(grep -c ^SKIP results/checks.txt) WINDOWS=$(grep -c "windows-" results/check.txt)
PASSED=$(grep -c ^PASS results/checks.txt) FAILED=$(grep -c ^FAIL results/check.txt)
CHECKED=$((FAILED + SKIPPED + PASSED)) SKIPPED=$(grep -c ^SKIP results/check.txt)
PASSED=$(grep -c ^PASS results/check.txt)
CHECKED=$((WINDOWS + FAILED + SKIPPED + PASSED))
echo -e "\nResults:" echo -e "\nResults:"
echo -e "- CHECKED:\t${CHECKED}"
echo -e "- PASSED:\t${PASSED}" echo -e "- PASSED:\t${PASSED}"
echo -e "- SKIPPED:\t${SKIPPED}\t(of which ${WINDOWS} are Windows)" echo -e "- SKIPPED:\t${SKIPPED}\t(of which ${WINDOWS} are Windows)"
echo -e "- FAILED:\t${FAILED}\n" echo -e "- FAILED:\t${FAILED}\n"
grep ^FAIL results/checks.txt | tee results/failed.txt grep ^FAIL results/check.txt | tee results/failed.txt
- uses: actions/upload-artifact@v4 VARIATIONS=$(wc -l results/list.txt | cut -d' ' -f 1)
with: DOWNLOADS=$(wc -l results/check.txt | cut -d' ' -f 1)
name: checks echo
path: results/checks.txt echo "Compare OS variations with downloads:"
- uses: actions/upload-artifact@v4 echo -e "- Variations:\t${VARIATIONS}"
with: echo -e "- Downloads:\t${DOWNLOADS}"
name: failed
path: results/failed.txt
upload-artifacts:
needs: [list-all-urls, check-all-urls]
name: "Uploading artifacts"
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
path: results
merge-multiple: true
- name: "List results"
run: |
ls -R results/
- uses: actions/upload-artifact@v4
with:
overwrite: true
name: results
path: results/