Skip to content

Create dynamic.yml

Create dynamic.yml #33

Workflow file for this run

name: "Test distros 🧪"
on:
workflow_dispatch:
push:
# branches:
# - master
# paths:
# - quickget
pull_request:
branches:
- '**'
# paths:
# - quickget
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-matrix:
name: "Generate Matrix Configuration"
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: "Install dependencies 📦️"
run: |
sudo apt-get -y update
sudo apt-get -y install curl qemu-utils jq
- name: "Generate OS matrix 📃"
run: |
./quickget | awk 'NR==2,/zorin/' | cut -d':' -f2 | grep -o '[^ ]*' | tail -n +2 | jq -R -s -c 'split("\n")[:-1] | map({os: .})' | jq -r '.[] | " - { os: \(.os) }"' > matrix.json
echo "::set-output name=matrix::$(cat matrix.json)"
# - name: Save state
# run: echo "matrix=$(cat matrix.yml)" >> "$GITHUB_ENV"
# - name: Set output
# run: echo "matrix=$(cat matrix.yml)" >> "$GITHUB_OUTPUT"
- name: "List OS variants 📃"
run: |
mkdir -p results
./quickget --list | tail -n +2 | tee results/list.txt
testing:
name: "Test"
needs: generate-matrix
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
env:
OS: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: "Install dependencies 📦️"
run: |
apt-get -y update
apt-get -y install curl qemu-utils jq
- name: "Check ${{ matrix.config.os }} downloads 💿️"
run: |
mkdir -p results
./quickget --check ${{ matrix.config.os }} | tee results/${{ matrix.config.os }}.txt || echo "### ${{ matrix.config.os }} :goberserk:" >> $GITHUB_STEP_SUMMARY
echo results/${{ matrix.config.os }}.txt >> $GITHUB_STEP_SUMMARY
- name: "Display results 📊"
run: |
RESULTS_FILE=results/${{ matrix.config.os }}.txt
if [[ -f $RESULTS_FILE ]]; then
WINDOWS=$(grep -c "windows-" $RESULTS_FILE)
FAILED=$(grep -c ^FAIL $RESULTS_FILE)
SKIPPED=$(grep -c ^SKIP $RESULTS_FILE)
PASSED=$(grep -c ^PASS $RESULTS_FILE)
CHECKED=$((WINDOWS + FAILED + SKIPPED + PASSED))
echo -e "\nResults:"
echo -e "- CHECKED:\t${CHECKED}"
echo -e "- PASSED:\t${PASSED}"
echo -e "- SKIPPED:\t${SKIPPED}\t(of which ${WINDOWS} are Windows)"
echo -e "- FAILED:\t${FAILED}\n"
grep ^FAIL $RESULTS_FILE | tee results/failed.txt
VARIATIONS=$(wc -l results/list.txt | cut -d' ' -f 1)
DOWNLOADS=$(wc -l $RESULTS_FILE | cut -d' ' -f 1)
echo
echo "Compare OS variations with downloads:"
echo -e "- Variations:\t${VARIATIONS}"
echo -e "- Downloads:\t${DOWNLOADS}"
else
echo "Results file not found for ${{ matrix.config.os }}."
fi
- name: Save state
run: echo "failed=$(cat failed)" >> $GITHUB_ENV
- name: Set output
run: echo "failed=$(cat failed)" >> $GITHUB_OUTPUT
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: results
path: results/