-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (68 loc) · 2.26 KB
/
run_all_distros.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Run all distros - FOG install tests
on:
workflow_dispatch:
defaults:
run:
shell: bash
permissions:
actions: write
contents: write
jobs:
get-all-distros-matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set matrix of distros
id: set-matrix
run: |
cd .github/workflows/
json_array=$(jq -n '[]')
for distro_file in $(ls distro_*); do
json_array=$(echo "$json_array" | jq --arg distro "$distro_file" '. + [$distro]')
done
matrix=$(echo "{\"distros\": $json_array}" | jq -c .)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
run-distro:
needs: get-all-distros-matrix
runs-on: ubuntu-22.04
strategy:
matrix:
${{ fromJson(needs.get-all-distros-matrix.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run all distros
run: gh workflow run ${{ matrix.distros }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-if-successful:
needs: [get-all-distros-matrix, run-distro]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
${{ fromJson(needs.get-all-distros-matrix.outputs.matrix) }}
steps:
- name: Wait a minute for the runs to start
run: sleep 60
- name: Get run IDs
run: |
run_id=$(gh run list --repo ${{ github.repository }} --workflow ${{ matrix.distros }} --json databaseId --limit 1 | jq -r '.[0].databaseId')
echo "RUN_ID=$run_id" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if distro workflow passed or failed
run: |
run_status=""
while [[ $run_status != "success" && $run_status != "failure" ]]; do
sleep 15
run_status=$(gh run view --repo ${{ github.repository }} ${{ env.RUN_ID }} --exit-status --json conclusion | jq -r '.conclusion')
done
if [[ $run_status == "failure" ]]; then
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}