Skip to content

vk changed to be vector #5

vk changed to be vector

vk changed to be vector #5

Workflow file for this run

name: Orchestrator
on:
pull_request:
types: [opened]
workflow_dispatch:
jobs:
build-job:
uses: ./.github/workflows/CI-build.yml
with:
CACHING_MODE: "CACHE_RESTORE"
test-job:
uses: ./.github/workflows/CI-test.yml
with:
CACHING_MODE: "CACHE_RESTORE"
coverage-job:
uses: ./.github/workflows/CI-coverage.yml
with:
CACHING_MODE: "CACHE_RESTORE"
lint-format-job:
uses: ./.github/workflows/CI-lint-format.yml
with:
CACHING_MODE: "CACHE_RESTORE"
zombienet-test-job:
uses: ./.github/workflows/CI-zombienet-test.yml
with:
CACHING_MODE: "CACHE_RESTORE"
check-act:
runs-on: ubuntu-latest
outputs:
act: ${{ steps.check.outputs.act }}
steps:
- name: Check if ACT exists
id: check
run: |
if [ -n "${{ env.ACT }}" ]; then
echo "act=true" >> $GITHUB_OUTPUT
else
echo "act=false" >> $GITHUB_OUTPUT
fi
set-overall-result:
runs-on: ubuntu-latest
needs: [build-job, test-job, coverage-job, lint-format-job, zombienet-test-job, check-act]
if: ${{ !cancelled() && needs.check-act.outputs.act == 'false' }}
outputs:
branch-name: ${{ steps.get-info.outputs.BRANCH_NAME }}
last-commit-sha: ${{ steps.get-info.outputs.LAST_COMMIT_SHA }}
pr-url: ${{ steps.get-info.outputs.PR_URL }}
overall-status: ${{ steps.set-status.outputs.OVERALL_STATUS }}
steps:
- name: Get target PR info
id: get-info
run: |
BRANCH_NAME=${{ github.head_ref || github.ref_name }}
echo BRANCH_NAME is ${BRANCH_NAME}
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
ALL_PRS=$(curl -s --fail \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls?state=open")
LAST_COMMIT_SHA=$(echo ${ALL_PRS} | jq ".[] | select(.head.label == \"${GITHUB_REPOSITORY_OWNER}:${BRANCH_NAME}\")" | jq -r ".head.sha")
echo LAST_COMMIT_SHA is ${LAST_COMMIT_SHA}
echo "LAST_COMMIT_SHA=${LAST_COMMIT_SHA}" >> $GITHUB_OUTPUT
echo "LAST_COMMIT_SHA=${LAST_COMMIT_SHA}" >> $GITHUB_ENV
PR_URL=$(echo ${ALL_PRS} | jq ".[] | select(.head.label == \"${GITHUB_REPOSITORY_OWNER}:${BRANCH_NAME}\")" | jq -r ".html_url")
echo PR_URL is ${PR_URL}
echo "PR_URL=${PR_URL}" >> $GITHUB_OUTPUT
- name: Set overall result
id: set-status
run: |
if [ "${{ github.event.workflow_run.conclusion }}" == "cancelled" ]; then
OVERALL_STATUS="cancelled"
else
OVERALL_STATUS="success"
if [ "${{ needs.build-job.result }}" != "success" ] ||
[ "${{ needs.test-job.result }}" != "success" ] ||
[ "${{ needs.coverage-job.result }}" != "success" ] ||
[ "${{ needs.lint-format-job.result }}" != "success" ] ||
[ "${{ needs.zombienet-test-job.result }}" != "success" ]; then
OVERALL_STATUS="failure"
fi
if [ ${LAST_COMMIT_SHA} != "" ]; then
echo Setting overall result
curl -L --fail \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${LAST_COMMIT_SHA}" \
-d '{"state":"'${OVERALL_STATUS}'","context":"Orchestrator"}'
else
echo Unable to set overall result
fi
fi