Skip to content

[fix]

[fix] #87

Workflow file for this run

name: ci
on:
pull_request:
branches:
- trunk
jobs:
ping:
permissions:
contents: write
strategy:
matrix:
repo:
- 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
- spaceporn-dep-action-cd-pong
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/${{ github.event.repository.name }}"
- name: Search current tag selected by user
id: used
env:
DEPENDENCY: "${{ github.repository_owner }}/${{ matrix.repo }}"
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 }}/${{ matrix.repo }}"
fetch-depth: 0
fetch-tags: true
- name: Prepare dump
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}"
if [[ -f "${GITHUB_WORKSPACE}/build.zig" ]]
then
printf 'is_composite=false\n' >> "${GITHUB_OUTPUT}"
else
printf 'is_composite=true\n' >> "${GITHUB_OUTPUT}"
fi
- uses: actions/checkout@v4
- name: Keep the last run ID in memory
id: previous_run
env:
GH_TOKEN: "${{ github.token }}"
TITLE: "ping-${{ matrix.repo }}"
WORKFLOW_NAME: 'dump'
shell: bash
run: |
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: ./
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 }}"
- uses: actions/checkout@v4
- name: Wait for the new job to start
id: start
env:
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 100 --json 'databaseId,displayTitle' --jq "[.[] | select(.displayTitle | contains (\"${TITLE}\")) | .databaseId] | sort | .[-1]")"
done
printf 'job_id=%s\n' "${id}" >> "${GITHUB_OUTPUT}"
- name: Wait for the new job to end
id: end
env:
CONCLUSION: 'conclusion'
GH_TOKEN: "${{ github.token }}"
ID: "${{ steps.start.outputs.job_id }}"
STATUS: 'status'
shell: bash
run: |
while [[ "${status:-}" != 'completed' ]]
do
sleep 2
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
env:
RESULT: "${{ steps.end.outputs.job_result }}"
shell: bash
run: |
[[ "${RESULT}" == 'success' ]]