From edfbf9b107d0912d9e8cf308e280e967c6983dfe Mon Sep 17 00:00:00 2001 From: tiawl Date: Sun, 28 Apr 2024 23:49:32 +0200 Subject: [PATCH 01/12] [update] better CI --- .github/actions/ci/action.yml | 58 ------ .github/workflows/ci.yml | 320 +++++----------------------------- .github/workflows/dump.yml | 27 +++ 3 files changed, 67 insertions(+), 338 deletions(-) delete mode 100644 .github/actions/ci/action.yml diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml deleted file mode 100644 index 3c82f44..0000000 --- a/.github/actions/ci/action.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: 'ci' -description: 'Run CI test for CD ping' -inputs: - dependency: - description: 'The used dependency' - required: true - is_composite: - description: 'Is this a composite action repository ?' - required: false - default: 'false' - user: - description: 'The User of this repository' - required: true - token: - description: 'The github token' - required: true -runs: - using: "composite" - steps: - - uses: actions/checkout@v4 - with: - repository: "${{ github.repository_owner }}/${{ inputs.user }}" - - - name: Search current tag selected by user - id: used - env: - DEPENDENCY: "${{ github.repository_owner }}/${{ inputs.dependency }}" - shell: bash - run: | - tag="$(grep -h -o -R "${DEPENDENCY}@v\S\+" | sed "s#^${DEPENDENCY}@##" | sort -u || :)" - printf 'tag=%s\n' "${tag}" >> "${GITHUB_OUTPUT}" - - - uses: actions/checkout@v4 - with: - repository: "${{ github.repository_owner }}/${{ inputs.dependency }}" - fetch-depth: 0 - fetch-tags: true - - - name: Prepare CD - id: prepare - env: - USED: "${{ steps.used.outputs.tag }}" - shell: bash - run: | - tags="$(git tag --points-at "$(git describe --tags --abbrev=0 2> /dev/null)" 2> /dev/null | wc -l || :)" - if [[ -z "${tags}" || "${tags}" == '0' ]]; then tag='0.0.0' - elif [[ "${tags}" == '1' ]]; then tag="$(git describe --tags --abbrev=0)"; fi - git show-ref --tags "${tag:-"${USED}"}" --quiet && git checkout "${tag:-"${USED}"}" - printf 'tag=%s\n' "${tag:-"${USED}"}" >> "${GITHUB_OUTPUT}" - - - uses: actions/checkout@v4 - - uses: ./ - with: - repository_name: "${{ inputs.dependency }}" - is_composite: "${{ inputs.is_composite }}" - user: "${{ inputs.user }}" - tag: "${{ steps.prepare.outputs.tag }}" - token: "${{ inputs.token }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9b612c..6753eb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,286 +6,6 @@ on: - trunk jobs: - test-toolbox: - permissions: - contents: write - strategy: - matrix: - user: - - vulkan.zig - - wayland.zig - - X11.zig - - glfw.zig - - cimgui.zig - - spirv.zig - - glslang.zig - - shaderc.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'toolbox' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-vulkan: - permissions: - contents: write - strategy: - matrix: - user: - - glfw.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'vulkan.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-wayland: - permissions: - contents: write - strategy: - matrix: - user: - - glfw.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'wayland.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-X11: - permissions: - contents: write - strategy: - matrix: - user: - - glfw.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'X11.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-glfw: - permissions: - contents: write - strategy: - matrix: - user: - - cimgui.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'glfw.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-cimgui: - permissions: - contents: write - strategy: - matrix: - user: - - spaceporn - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'cimgui.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-spirv: - permissions: - contents: write - strategy: - matrix: - user: - - shaderc.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'spirv.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-glslang: - permissions: - contents: write - strategy: - matrix: - user: - - shaderc.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'glslang.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-shaderc: - permissions: - contents: write - strategy: - matrix: - user: - - spaceporn - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'shaderc.zig' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-env-action: - permissions: - contents: write - strategy: - matrix: - user: - - spaceporn-dep-action-bot - - spaceporn-dep-action-ci - - spaceporn-dep-action-cd-ping - - spaceporn-dep-action-cd-pong - - spaceporn - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'spaceporn-dep-action-env' - is_composite: 'true' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-bot-action: - permissions: - contents: write - strategy: - matrix: - user: - - vulkan.zig - - wayland.zig - - X11.zig - - glfw.zig - - cimgui.zig - - spirv.zig - - glslang.zig - - shaderc.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'spaceporn-dep-action-bot' - is_composite: 'true' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-ci-action: - permissions: - contents: write - strategy: - matrix: - user: - - toolbox - - vulkan.zig - - wayland.zig - - X11.zig - - glfw.zig - - cimgui.zig - - spirv.zig - - glslang.zig - - shaderc.zig - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'spaceporn-dep-action-ci' - is_composite: 'true' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-ping-action: - permissions: - contents: write - strategy: - matrix: - user: - - toolbox - - vulkan.zig - - wayland.zig - - X11.zig - - glfw.zig - - cimgui.zig - - spirv.zig - - glslang.zig - - shaderc.zig - - spaceporn-dep-action-env - - spaceporn-dep-action-bot - - spaceporn-dep-action-ci - - spaceporn-dep-action-cd-pong - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'spaceporn-dep-action-cd-ping' - is_composite: 'true' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 - test-pong-action: - permissions: - contents: write - strategy: - matrix: - user: - - toolbox - - vulkan.zig - - wayland.zig - - X11.zig - - glfw.zig - - cimgui.zig - - spirv.zig - - glslang.zig - - shaderc.zig - - spaceporn - - spaceporn-dep-action-env - - spaceporn-dep-action-bot - - spaceporn-dep-action-ci - - spaceporn-dep-action-cd-ping - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/ci - with: - dependency: 'spaceporn-dep-action-cd-pong' - is_composite: 'true' - user: "${{ matrix.user }}" - token: "${{ secrets.PAT }}" - - uses: actions/checkout@v4 ping: permissions: contents: write @@ -341,10 +61,50 @@ jobs: printf 'tag=%s\n' "${tag:-"${USED}"}" >> "${GITHUB_OUTPUT}" - uses: actions/checkout@v4 + + - name: Keep the last run ID in memory + id: previous_run + env: + FIELD: 'databaseId' + WORKFLOW_NAME: "dump-${{ matrix.repo }}" + shell: bash + run: | + id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" + printf 'id=%s\n' "${id}" >> "${GITHUB_OUTPUT}" + - uses: ./ with: repository_name: "${{ matrix.repo }}" user: "${{ github.event.repository.name }}" tag: "${{ steps.prepare.outputs.tag }}" token: "${{ secrets.PAT }}" + - uses: actions/checkout@v4 + + - name: Wait for the new run to finish + id: current_run + env: + PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" + LIST_FIELD: 'databaseId' + VIEW_FIELD: 'conclusion' + shell: bash + run: | + id="${PREVIOUS_RUN_ID}" + while [[ "${id}" == "${PREVIOUS_RUN_ID}" ]] + do + sleep 0.1 + id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${LIST_FIELD}" | jq ".[] | .${LIST_FIELD}")" + done + while [[ "${conclusion:-}" != 'success' && "${conclusion:-}" != 'failure' ]] + do + sleep 0.1 + conclusion="$(gh run view --json "${VIEW_FIELD}" "${id}" | jq -r ".${VIEW_FIELD}")" + done + printf 'result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" + + - name: Fail if the dump checker failed + env: + RESULT: "${{ steps.current_run.outputs.result }}" + shell: bash + run: | + if [[ "${RESULT}" != 'success' ]]; then exit 1; fi diff --git a/.github/workflows/dump.yml b/.github/workflows/dump.yml index 9cc07c7..4c4e09e 100644 --- a/.github/workflows/dump.yml +++ b/.github/workflows/dump.yml @@ -28,3 +28,30 @@ jobs: CLIENT_PAYLOAD: "${{ toJson(github.event.client_payload) }}" run: | printf '%s\n' "${CLIENT_PAYLOAD}" + + - uses: actions/checkout@v4 + with: + repository: "${{ github.repository_owner }}/${{ github.event.client_payload.dependency }}" + fetch-depth: 0 + fetch-tags: true + + - name: Check client payload tag field + env: + PAYLOAD_TAG: "${{ github.event.client_payload.tag }}" + shell: bash + run: | + git show-ref --tags "${PAYLOAD_TAG}" --quiet && git checkout "${PAYLOAD_TAG}" + + - uses: goto-bus-stop/setup-zig@v2.2.0 + + - name: Check client payload hash field + env: + PAYLOAD_HASH: "${{ github.event.client_payload.hash }}" + shell: bash + run: | + if [[ -f "${GITHUB_WORKSPACE}/build.zig" ]] + then + [[ "${PAYLOAD_HASH}" == "$(zig fetch .)" ]] + else + [[ -z "${PAYLOAD_HASH}" ]] + fi From 5b0536ff8899b4ce1493ebc0d9400795e13da9ec Mon Sep 17 00:00:00 2001 From: tiawl Date: Sun, 28 Apr 2024 23:55:12 +0200 Subject: [PATCH 02/12] [fix] --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6753eb2..c1ed807 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,7 @@ jobs: id: previous_run env: FIELD: 'databaseId' + GH_TOKEN: "${{ github.token }}" WORKFLOW_NAME: "dump-${{ matrix.repo }}" shell: bash run: | @@ -84,8 +85,9 @@ jobs: - name: Wait for the new run to finish id: current_run env: - PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" + GH_TOKEN: "${{ github.token }}" LIST_FIELD: 'databaseId' + PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" VIEW_FIELD: 'conclusion' shell: bash run: | @@ -107,4 +109,4 @@ jobs: RESULT: "${{ steps.current_run.outputs.result }}" shell: bash run: | - if [[ "${RESULT}" != 'success' ]]; then exit 1; fi + [[ "${RESULT}" == 'success' ]] From b9060c59e5ed2178300521987d934d271622871e Mon Sep 17 00:00:00 2001 From: tiawl Date: Sun, 28 Apr 2024 23:58:29 +0200 Subject: [PATCH 03/12] [fix] --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1ed807..462b633 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ jobs: permissions: contents: write strategy: + max-parallel: 1 matrix: repo: - toolbox @@ -67,7 +68,7 @@ jobs: env: FIELD: 'databaseId' GH_TOKEN: "${{ github.token }}" - WORKFLOW_NAME: "dump-${{ matrix.repo }}" + WORKFLOW_NAME: 'dump' shell: bash run: | id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" @@ -104,7 +105,7 @@ jobs: done printf 'result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" - - name: Fail if the dump checker failed + - name: Fail if the dump failed env: RESULT: "${{ steps.current_run.outputs.result }}" shell: bash From 6541d1c616830886d71afe134d21e4a3612458f0 Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 00:13:09 +0200 Subject: [PATCH 04/12] [fix] --- .github/workflows/ci.yml | 18 ++++++++++++------ .github/workflows/dump.yml | 10 +++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 462b633..2b9c0c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,25 +83,31 @@ jobs: - uses: actions/checkout@v4 - - name: Wait for the new run to finish - id: current_run + - name: Wait for the new job to start env: + FIELD: 'databaseId' GH_TOKEN: "${{ github.token }}" - LIST_FIELD: 'databaseId' PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" - VIEW_FIELD: 'conclusion' shell: bash run: | id="${PREVIOUS_RUN_ID}" while [[ "${id}" == "${PREVIOUS_RUN_ID}" ]] do sleep 0.1 - id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${LIST_FIELD}" | jq ".[] | .${LIST_FIELD}")" + id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" done + + - name: Wait for the new job to end + id: current_run + env: + FIELD: 'conclusion' + GH_TOKEN: "${{ github.token }}" + shell: bash + run: | while [[ "${conclusion:-}" != 'success' && "${conclusion:-}" != 'failure' ]] do sleep 0.1 - conclusion="$(gh run view --json "${VIEW_FIELD}" "${id}" | jq -r ".${VIEW_FIELD}")" + conclusion="$(gh run view --json "${FIELD}" "${id}" | jq -r ".${FIELD}")" done printf 'result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" diff --git a/.github/workflows/dump.yml b/.github/workflows/dump.yml index 4c4e09e..72177de 100644 --- a/.github/workflows/dump.yml +++ b/.github/workflows/dump.yml @@ -41,15 +41,23 @@ jobs: shell: bash run: | git show-ref --tags "${PAYLOAD_TAG}" --quiet && git checkout "${PAYLOAD_TAG}" + if [[ -f "${GITHUB_WORKSPACE}/build.zig" ]] + then + printf 'zig=true\n' >> "${GITHUB_ENV}" + else + printf 'zig=false\n' >> "${GITHUB_ENV}" + fi - uses: goto-bus-stop/setup-zig@v2.2.0 + if: env.zig == 'true' - name: Check client payload hash field env: + ZIG: "${{ env.zig }}" PAYLOAD_HASH: "${{ github.event.client_payload.hash }}" shell: bash run: | - if [[ -f "${GITHUB_WORKSPACE}/build.zig" ]] + if [[ "${ZIG}" == 'true' ]] then [[ "${PAYLOAD_HASH}" == "$(zig fetch .)" ]] else From 82772b7b61c7883340faf0e82c5cb8b5f9dcd930 Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 00:19:51 +0200 Subject: [PATCH 05/12] [fix] --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b9c0c4..35d2a0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,7 @@ jobs: - uses: actions/checkout@v4 - name: Wait for the new job to start + id: start env: FIELD: 'databaseId' GH_TOKEN: "${{ github.token }}" @@ -96,24 +97,26 @@ jobs: sleep 0.1 id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" done + printf 'job_id=%s\n' >> "${GITHUB_OUTPUT}" - name: Wait for the new job to end - id: current_run + id: end env: FIELD: 'conclusion' GH_TOKEN: "${{ github.token }}" + ID: "${{ steps.start.outputs.job_id }}" shell: bash run: | while [[ "${conclusion:-}" != 'success' && "${conclusion:-}" != 'failure' ]] do sleep 0.1 - conclusion="$(gh run view --json "${FIELD}" "${id}" | jq -r ".${FIELD}")" + conclusion="$(gh run view --json "${FIELD}" "${ID}" | jq -r ".${FIELD}")" done - printf 'result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" + printf 'job_result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" - name: Fail if the dump failed env: - RESULT: "${{ steps.current_run.outputs.result }}" + RESULT: "${{ steps.end.outputs.job_result }}" shell: bash run: | [[ "${RESULT}" == 'success' ]] From a9ef3599b043f035dc449b77bb6b6624d74b78bc Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 08:57:38 +0200 Subject: [PATCH 06/12] [fix] --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35d2a0e..71ad8cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,10 +91,9 @@ jobs: PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" shell: bash run: | - id="${PREVIOUS_RUN_ID}" - while [[ "${id}" == "${PREVIOUS_RUN_ID}" ]] + while [[ -z "${id:-}" || "${id:-}" == "${PREVIOUS_RUN_ID}" ]] do - sleep 0.1 + sleep 2 id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" done printf 'job_id=%s\n' >> "${GITHUB_OUTPUT}" @@ -109,7 +108,7 @@ jobs: run: | while [[ "${conclusion:-}" != 'success' && "${conclusion:-}" != 'failure' ]] do - sleep 0.1 + sleep 2 conclusion="$(gh run view --json "${FIELD}" "${ID}" | jq -r ".${FIELD}")" done printf 'job_result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" From 1c69e9265a5b525e5e340ea890e0383072dd7459 Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 09:04:16 +0200 Subject: [PATCH 07/12] [fix] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71ad8cf..10995a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: sleep 2 id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" done - printf 'job_id=%s\n' >> "${GITHUB_OUTPUT}" + printf 'job_id=%s\n' "${id}" >> "${GITHUB_OUTPUT}" - name: Wait for the new job to end id: end From 835b774f9924e90969d32e1e0b193476d95f25f6 Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 09:23:34 +0200 Subject: [PATCH 08/12] [fix] --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10995a0..20e5b12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,12 @@ jobs: elif [[ "${tags}" == '1' ]]; then tag="$(git describe --tags --abbrev=0)"; fi git show-ref --tags "${tag:-"${USED}"}" --quiet && git checkout "${tag:-"${USED}"}" printf 'tag=%s\n' "${tag:-"${USED}"}" >> "${GITHUB_OUTPUT}" + if [[ -f "${GITHUB_WORKSPACE}/build.zig" ]] + then + printf 'is_composite=true\n' >> "${GITHUB_OUTPUT}" + else + printf 'is_composite=false\n' >> "${GITHUB_OUTPUT}" + fi - uses: actions/checkout@v4 @@ -77,6 +83,7 @@ jobs: - uses: ./ with: repository_name: "${{ matrix.repo }}" + is_composite: "${{ steps.prepare.outputs.is_composite }}" user: "${{ github.event.repository.name }}" tag: "${{ steps.prepare.outputs.tag }}" token: "${{ secrets.PAT }}" @@ -89,6 +96,7 @@ jobs: FIELD: 'databaseId' GH_TOKEN: "${{ github.token }}" PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" + WORKFLOW_NAME: 'dump' shell: bash run: | while [[ -z "${id:-}" || "${id:-}" == "${PREVIOUS_RUN_ID}" ]] From 72dd8bb47bb86a76ff84d7b17133563363ed3cdc Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 09:27:05 +0200 Subject: [PATCH 09/12] [fix] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20e5b12..292aebb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,9 +62,9 @@ jobs: printf 'tag=%s\n' "${tag:-"${USED}"}" >> "${GITHUB_OUTPUT}" if [[ -f "${GITHUB_WORKSPACE}/build.zig" ]] then - printf 'is_composite=true\n' >> "${GITHUB_OUTPUT}" - else printf 'is_composite=false\n' >> "${GITHUB_OUTPUT}" + else + printf 'is_composite=true\n' >> "${GITHUB_OUTPUT}" fi - uses: actions/checkout@v4 From bc68bd477736a42531765ed51d8da6e7c3d5f4d6 Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 09:58:45 +0200 Subject: [PATCH 10/12] [fix] --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292aebb..9b04fde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ jobs: permissions: contents: write strategy: - max-parallel: 1 matrix: repo: - toolbox @@ -72,12 +71,12 @@ jobs: - name: Keep the last run ID in memory id: previous_run env: - FIELD: 'databaseId' GH_TOKEN: "${{ github.token }}" + TITLE: "ping-${{ matrix.repo }}" WORKFLOW_NAME: 'dump' shell: bash run: | - id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" + id="$(gh run list -w "${WORKFLOW_NAME}" -L 100 --json 'databaseId,displayTitle' --jq "[.[] | select(.displayTitle | contains (\"${TITLE}\")) | .databaseId] | sort | .[-1]")" printf 'id=%s\n' "${id}" >> "${GITHUB_OUTPUT}" - uses: ./ @@ -93,16 +92,16 @@ jobs: - name: Wait for the new job to start id: start env: - FIELD: 'databaseId' GH_TOKEN: "${{ github.token }}" PREVIOUS_RUN_ID: "${{ steps.previous_run.outputs.id }}" + TITLE: "ping-${{ matrix.repo }}" WORKFLOW_NAME: 'dump' shell: bash run: | while [[ -z "${id:-}" || "${id:-}" == "${PREVIOUS_RUN_ID}" ]] do sleep 2 - id="$(gh run list -w "${WORKFLOW_NAME}" -L 1 --json "${FIELD}" | jq ".[] | .${FIELD}")" + id="$(gh run list -w "${WORKFLOW_NAME}" -L 100 --json 'databaseId,displayTitle' --jq "[.[] | select(.displayTitle | contains (\"${TITLE}\")) | .databaseId] | sort | .[-1]")" done printf 'job_id=%s\n' "${id}" >> "${GITHUB_OUTPUT}" From 8aa76fe4186d281b936a12c86f1f413f96bf6ac7 Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 10:02:38 +0200 Subject: [PATCH 11/12] [fix] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b04fde..589fd71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,7 +116,7 @@ jobs: while [[ "${conclusion:-}" != 'success' && "${conclusion:-}" != 'failure' ]] do sleep 2 - conclusion="$(gh run view --json "${FIELD}" "${ID}" | jq -r ".${FIELD}")" + conclusion="$(gh run view --json "${FIELD}" "${ID}" --jq ".${FIELD}")" done printf 'job_result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" From 7c3035bde98e92b09a435d2ba934a478d5f2076b Mon Sep 17 00:00:00 2001 From: tiawl Date: Mon, 29 Apr 2024 10:08:15 +0200 Subject: [PATCH 12/12] [fix] --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 589fd71..c5dc8d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,16 +108,18 @@ jobs: - name: Wait for the new job to end id: end env: - FIELD: 'conclusion' + CONCLUSION: 'conclusion' GH_TOKEN: "${{ github.token }}" ID: "${{ steps.start.outputs.job_id }}" + STATUS: 'status' shell: bash run: | - while [[ "${conclusion:-}" != 'success' && "${conclusion:-}" != 'failure' ]] + while [[ "${status:-}" != 'completed' ]] do sleep 2 - conclusion="$(gh run view --json "${FIELD}" "${ID}" --jq ".${FIELD}")" + status="$(gh run view --json "${STATUS}" "${ID}" --jq ".${STATUS}")" done + conclusion="$(gh run view --json "${CONCLUSION}" "${ID}" --jq ".${CONCLUSION}")" printf 'job_result=%s\n' "${conclusion}" >> "${GITHUB_OUTPUT}" - name: Fail if the dump failed