-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
918ca3c
commit b74eccb
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 }} |