From ed3c96ccb84a5ae56eb6fe1ebb5cac59be1eb386 Mon Sep 17 00:00:00 2001 From: silverqx Date: Sat, 4 May 2024 14:07:56 +0200 Subject: [PATCH] workflows enhanced synchronous execution - handled error states - taken into account disabled workflows (disabled_manually state) [skip ci] --- .github/workflows/linux-qt6-drivers.yml | 10 +++++++++- .github/workflows/msvc2022-qt6-drivers.yml | 10 +++++++++- .github/workflows/msys2-ucrt64-drivers.yml | 12 ++++++++++-- .github/workflows/vcpkg-linux-drivers.yml | 10 +++++++++- .github/workflows/vcpkg-linux.yml | 10 +++++++++- .github/workflows/vcpkg-windows-drivers.yml | 10 +++++++++- .github/workflows/vcpkg-windows.yml | 10 +++++++++- 7 files changed, 64 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux-qt6-drivers.yml b/.github/workflows/linux-qt6-drivers.yml index b54f6b44a..146e05e65 100644 --- a/.github/workflows/linux-qt6-drivers.yml +++ b/.github/workflows/linux-qt6-drivers.yml @@ -249,10 +249,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run vcpkg-linux.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run vcpkg-linux.yml --ref ${{ github.ref_name }} + workflowState=$(gh workflow list --all --json path,state \ + --jq '.[] | select (.path | endswith("/vcpkg-linux.yml")) | .state' + + if [ $? -eq 0 ] && [[ "$workflowState" == 'active' ]]; then + gh workflow run vcpkg-linux.yml --ref ${{ github.ref_name }} + fi env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/msvc2022-qt6-drivers.yml b/.github/workflows/msvc2022-qt6-drivers.yml index f1233dca7..7af0144a8 100644 --- a/.github/workflows/msvc2022-qt6-drivers.yml +++ b/.github/workflows/msvc2022-qt6-drivers.yml @@ -278,10 +278,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run vcpkg-windows.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run vcpkg-windows.yml --ref ${{ github.ref_name }} + $workflowState = gh workflow list --all --json path,state ` + --jq '.[] | select (.path | endswith("/vcpkg-windows.yml")) | .state' + + if ($? -and $workflowState -ceq 'active') { + gh workflow run vcpkg-windows.yml --ref ${{ github.ref_name }} + } env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/msys2-ucrt64-drivers.yml b/.github/workflows/msys2-ucrt64-drivers.yml index 7930b063f..906a1206e 100644 --- a/.github/workflows/msys2-ucrt64-drivers.yml +++ b/.github/workflows/msys2-ucrt64-drivers.yml @@ -1,4 +1,4 @@ -# MySQL +riv# MySQL # --- # Both use the default unencrypted database connections because maria client can't connect # to the MySQL >= 8.0.34 or >=8.1, there is some problem in TLS 1.2 and 1.3 connection, it can't @@ -272,10 +272,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run linux-qt6-drivers.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run linux-qt6-drivers.yml --ref ${{ github.ref_name }} + $workflowState = gh workflow list --all --json path,state ` + --jq '.[] | select (.path | endswith("/linux-qt6-drivers.yml")) | .state' + + if ($? -and $workflowState -ceq 'active') { + gh workflow run linux-qt6-drivers.yml --ref ${{ github.ref_name }} + } env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/vcpkg-linux-drivers.yml b/.github/workflows/vcpkg-linux-drivers.yml index e361c5c79..796f86bcc 100644 --- a/.github/workflows/vcpkg-linux-drivers.yml +++ b/.github/workflows/vcpkg-linux-drivers.yml @@ -477,10 +477,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run analyzers.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run analyzers.yml --ref ${{ github.ref_name }} + workflowState=$(gh workflow list --all --json path,state \ + --jq '.[] | select (.path | endswith("/analyzers.yml")) | .state' + + if [ $? -eq 0 ] && [[ "$workflowState" == 'active' ]]; then + gh workflow run analyzers.yml --ref ${{ github.ref_name }} + fi env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/vcpkg-linux.yml b/.github/workflows/vcpkg-linux.yml index acad36410..7852e2242 100644 --- a/.github/workflows/vcpkg-linux.yml +++ b/.github/workflows/vcpkg-linux.yml @@ -570,10 +570,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run vcpkg-linux-drivers.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run vcpkg-linux-drivers.yml --ref ${{ github.ref_name }} + workflowState=$(gh workflow list --all --json path,state \ + --jq '.[] | select (.path | endswith("/vcpkg-linux-drivers.yml")) | .state' + + if [ $? -eq 0 ] && [[ "$workflowState" == 'active' ]]; then + gh workflow run vcpkg-linux-drivers.yml --ref ${{ github.ref_name }} + fi env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/vcpkg-windows-drivers.yml b/.github/workflows/vcpkg-windows-drivers.yml index 840cabc12..ba2e6e399 100644 --- a/.github/workflows/vcpkg-windows-drivers.yml +++ b/.github/workflows/vcpkg-windows-drivers.yml @@ -496,10 +496,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run msys2-ucrt64-drivers.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run msys2-ucrt64-drivers.yml --ref ${{ github.ref_name }} + $workflowState = gh workflow list --all --json path,state ` + --jq '.[] | select (.path | endswith("/msys2-ucrt64-drivers.yml")) | .state' + + if ($? -and $workflowState -ceq 'active') { + gh workflow run msys2-ucrt64-drivers.yml --ref ${{ github.ref_name }} + } env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/vcpkg-windows.yml b/.github/workflows/vcpkg-windows.yml index fec2d4438..011b90b7f 100644 --- a/.github/workflows/vcpkg-windows.yml +++ b/.github/workflows/vcpkg-windows.yml @@ -519,10 +519,18 @@ jobs: # and all others will be canceled. # Jobs are run randomly! They are sorted from 0 to strategy.job-total - 1 in GitHub UI, so # the first job has index 0, the second job has index 1, ... + # Execute the next workflow inly if it's active and isn't disabled (disabled_manually state). + # Also, if the step fails due to any error, continue (eg. network unreachable or similar). - name: Run vcpkg-windows-drivers.yml workflows + continue-on-error: true if: strategy.job-index == 0 working-directory: ${{ env.TinyORMPath }} run: | - gh workflow run vcpkg-windows-drivers.yml --ref ${{ github.ref_name }} + $workflowState = gh workflow list --all --json path,state ` + --jq '.[] | select (.path | endswith("/vcpkg-windows-drivers.yml")) | .state' + + if ($? -and $workflowState -ceq 'active') { + gh workflow run vcpkg-windows-drivers.yml --ref ${{ github.ref_name }} + } env: GH_TOKEN: ${{ github.token }}