diff --git a/.github/workflows/getlabels.yaml b/.github/workflows/getlabels.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cff128217d8b60661233f32dde4301a0597b4d75 --- /dev/null +++ b/.github/workflows/getlabels.yaml @@ -0,0 +1,60 @@ +name: Get Labels + +on: + workflow_call: + outputs: + state: + description: "The return state of Stage (true/false)" + value: ${{ jobs.getlabels.outputs.state }} + inputs: + pr_number: + required: true + type: string + max_runtime: + required: false + type: string + stage: + required: true + type: string +permissions: + contents: read + packages: write + +jobs: + + getlabels: + runs-on: ubuntu-latest + outputs: + state: ${{ steps.id.outputs.state }} + steps: + - name: Get Label Steps + id: id + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OWNER: ${{ github.repository_owner }} + REPO_NAME: ${{ github.event.repository.name }} + PULL_REQUEST_NUMBER: ${{ inputs.pr_number }} + STAGE: ${{ inputs.stage }} + MAX_TIME: ${{ inputs.max_runtime }} + run: | + DONE=false + count=0 + until false + do + echo "gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name'" + LABELS1="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name')" + LABELS=$(echo "$LABELS1" | tr '\n' ' ') + check_label="CI-Orion-${STAGE}" + if [[ "${LABELS}" == *"${check_label}"* ]]; then + DONE=true + break + fi + sleep 10m + count=$((count+10)) + if [[ ${count} -gt ${MAX_TIME} ]]; then + DONE=false + break + fi + done + echo "state=${DONE}" + echo "state=${DONE}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/orion_status.yaml b/.github/workflows/orion_status.yaml new file mode 100644 index 0000000000000000000000000000000000000000..76d5571271c79c2817b854dfb543e0a7f496788d --- /dev/null +++ b/.github/workflows/orion_status.yaml @@ -0,0 +1,75 @@ +name: OrionStatus + +on: + workflow_dispatch: + inputs: + pr_number: + description: PR number + type: string + max_runtime: + description: Maximum time out time for running experment + type: string + +jobs: + + get_Ready: + uses: ./.github/workflows/getlabels.yaml + with: + pr_number: ${{ inputs.pr_number }} + max_runtime: 20 + stage: "Ready" + secrets: inherit + + Ready: + runs-on: ubuntu-latest + needs: get_Ready + steps: + - run: | + if [[ "${{ needs.get_Ready.outputs.state }}" == "false" ]]; then + echo "Ready Timmed out" + exit 1 + elif [[ "${{ needs.get_Ready.outputs.state }}" == "true" ]]; then + echo "Ready Set" + fi + + get_Building: + uses: ./.github/workflows/getlabels.yaml + needs: Ready + with: + pr_number: ${{ inputs.pr_number }} + max_runtime: 40 + stage: "Building" + secrets: inherit + + Building: + runs-on: ubuntu-latest + needs: get_Building + steps: + - run: | + if [[ "${{ needs.get_Building.outputs.state }}" == "false" ]]; then + echo "Building Timmed out" + exit 1 + elif [[ "${{ needs.get_Building.outputs.state }}" == "true" ]]; then + echo "Building Set" + fi + + get_Running: + uses: ./.github/workflows/getlabels.yaml + needs: Building + with: + pr_number: ${{ inputs.pr_number }} + max_runtime: 60 + stage: "Running" + secrets: inherit + + Running: + runs-on: ubuntu-latest + needs: get_Running + steps: + - run: | + if [[ "${{ needs.get_Running.outputs.state }}" == "false" ]]; then + echo "Running Timmed out" + exit 1 + elif [[ "${{ needs.get_Running.outputs.state }}" == "true" ]]; then + echo "Running Set" + fi \ No newline at end of file