From 90ed552518b6ccadd99b009ce72d3880dcd4987d Mon Sep 17 00:00:00 2001 From: tprabhu Date: Mon, 5 Aug 2024 19:21:29 +0530 Subject: [PATCH] Updated CI workflow --- .github/CODEOWNERS | 81 ----------------- .github/workflows/ci.yaml | 68 +++++++++++++++ .github/workflows/publish_review_event.yaml | 96 +++++++++++++++++++++ .github/workflows/store_review_event.yaml | 18 ++++ 4 files changed, 182 insertions(+), 81 deletions(-) delete mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/publish_review_event.yaml create mode 100644 .github/workflows/store_review_event.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index dd60179b1..000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,81 +0,0 @@ -# Encoders Reviewers -media_driver/agnostic/common/codec/hal/*encoder_base* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com chunbo.chen@intel.com -media_driver/agnostic/common/codec/hal/*encode_csc_ds* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com chunbo.chen@intel.com -media_driver/agnostic/common/codec/hal/*encode_sfc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com chunbo.chen@intel.com -media_driver/agnostic/gen*/codec/hal/*encode_csc_ds* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com chunbo.chen@intel.com -media_softlet/linux/common/codec/ddi/enc thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com chunbo.chen@intel.com -media_softlet/agnostic/common/codec/hal/enc/shared thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com chunbo.chen@intel.com - -# AVC and legacy Encoding Reviewers -media_driver/agnostic/common/codec/hal/*encode_avc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/common/codec/hal/*encode_mpeg2* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/common/codec/hal/*encode_jpeg* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/common/codec/hal/*vdenc_avc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/gen*/codec/hal/*encode_avc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/gen*/codec/hal/*vdenc_avc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/gen*/codec/hal/*encode_mpeg2* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_softlet/agnostic/common/codec/hal/enc/avc thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_softlet/agnostic/Xe_M_plus/Xe*/codec/hal/enc/avc thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_softlet/agnostic/Xe_M_plus/Xe*/codec/hal/enc/jpeg thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com - -# HEVC Encoding Reviewers -media_driver/agnostic/common/codec/hal/*encode_hevc_base* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/common/codec/hal/*vdenc_hevc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/common/codec/shared/*common_hevc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/common/codec/shared/*encode_hevc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_driver/agnostic/gen*/codec/hal/*vdenc_hevc* thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_softlet/agnostic/common/codec/hal/enc/hevc thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com -media_softlet/agnostic/Xe_M_plus/Xe*/codec/hal/enc/hevc thomas.li@intel.com otto.yang@intel.com isaac.bai@intel.com - -# VP9 Encoding Reviewers -media_driver/agnostic/common/codec/hal/*encode_vp9* leyu.yao@intel.com chunbo.chen@intel.com -media_driver/agnostic/common/codec/hal/*vdenc_vp9* leyu.yao@intel.com chunbo.chen@intel.com -media_driver/agnostic/gen*/codec/hal/*encode_vp9* leyu.yao@intel.com chunbo.chen@intel.com -media_driver/agnostic/gen*/codec/hal/*vdenc_vp9* leyu.yao@intel.com chunbo.chen@intel.com -media_softlet/agnostic/common/codec/hal/enc/vp9 leyu.yao@intel.com chunbo.chen@intel.com -media_softlet/agnostic/Xe_M_plus/Xe*/codec/hal/enc/vp9 leyu.yao@intel.com chunbo.chen@intel.com - -# AV1 Encoding Reviewers -media_softlet/agnostic/common/codec/hal/enc/av1 leyu.yao@intel.com chunbo.chen@intel.com -media_softlet/agnostic/Xe_M_plus/Xe*/codec/hal/enc/av1 leyu.yao@intel.com chunbo.chen@intel.com - -# DDI Reviewers -media_driver/linux/common/*ddi/ carl.zhang@intel.com zhengguo.xu@intel.com jay.yang@intel.com -media_driver/linux/gen*/ddi/ carl.zhang@intel.com zhengguo.xu@intel.com jay.yang@intel.com -media_softlet/linux/common/ddi/ carl.zhang@intel.com zhengguo.xu@intel.com jay.yang@intel.com -media_softlet/linux/common/codec/ carl.zhang@intel.com zhengguo.xu@intel.com jay.yang@intel.com -media_softlet/linux/xe*/ddi/ carl.zhang@intel.com zhengguo.xu@intel.com jay.yang@intel.com -media_softlet/linux/Xe*/ddi/ carl.zhang@intel.com zhengguo.xu@intel.com jay.yang@intel.com - -# Softlet Reviewers -media_softlet/* yuchen.wang@intel.com -media_driver/media_softlet/* yuchen.wang@intel.com - -# Decoding Reviewers -media_softlet/agnostic/common/codec/hal/dec will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_common/agnostic/common/codec/shared/*decode* will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/media_softlet/agnostic/gen*/codec/hal/dec will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/media_softlet/agnostic/Xe_*/Xe_*/codec/hal/dec will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/linux/gen*/codec/ddi/*decode* will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/linux/common/codec/ddi/*decode* will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/agnostic/gen*/codec/hal/*decode* will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/agnostic/Xe_*/Xe_*/codec/hal/*decode* will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com -media_driver/agnostic/common/codec/hal/*decode* will.guo@intel.com steven.li@intel.com zhengguo.xu@intel.com - -# Video Processing Reviewers -media_driver/**/*vphal* furong.zhang@intel.com jay.yang@intel.com billy.ye@intel.com lihao.gu@intel.com -media_driver/linux/common/vp furong.zhang@intel.com jay.yang@intel.com billy.ye@intel.com lihao.gu@intel.com - -# Media Common Reviewers -media_softlet/linux/common/os jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_softlet/agnostic/common/os jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_softlet/agnostic/common/shared jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_driver/agnostic/common/heap_manager jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_driver/agnostic/common/os jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_driver/agnostic/common/shared jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_driver/linux/common/ddi jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_driver/linux/common/os jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com -media_common/linux/common/os jay.yang@intel.com billy.ye@intel.com carl.zhang@intel.com - -# XE KMD related -media_softlet/linux/common/os/xe zhengguo.xu@intel.com effie.yu@intel.com diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..790926080 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,68 @@ +name: CI Workflow + +on: + pull_request_target: + types: "*" + branches: "**" +permissions: read-all + +jobs: + Trigger_Workflows: + runs-on: ubuntu-latest + name: CI Workflow + steps: + - name: Get Token + run: | + retries=3 + while [ $retries -gt 0 ]; do + if RESPONSE=$(curl --silent --location "${{ secrets.CLIENT_TOKEN_URL }}" \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --data-urlencode "client_id=${{ secrets.CLIENT_ID }}" \ + --data-urlencode "client_secret=${{ secrets.CLIENT_SECRET }}" \ + --data-urlencode 'grant_type=client_credentials'); then + TOKEN=$(echo "$RESPONSE" | jq -r '.access_token') + if [ -n "$TOKEN" ]; then + echo "TOKEN=$TOKEN" >> $GITHUB_ENV + break + else + echo "Error: Failed to parse access token from response" + fi + else + echo "Error: Request to get token failed" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to retrieve access token after multiple retries" + exit 1 + fi + + + + - name: Trigger Build with Event + if: success() + env: + TOKEN: ${{ env.TOKEN }} + run: | + EVENT_DATA='${{ toJSON(github.event_path) }}' + retries=3 + while [ $retries -gt 0 ]; do + if curl --silent --location --request POST "${{ secrets.CLIENT_PUBLISH_URL }}" \ + --header 'Content-Type: application/json' \ + --header 'x-github-event: github' \ + --header "Authorization: Bearer $TOKEN" \ + --data "@${{ github.event_path }}"; then + break + else + echo "Error: Failed to trigger build" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to trigger build after multiple retries" + exit 1 + fi diff --git a/.github/workflows/publish_review_event.yaml b/.github/workflows/publish_review_event.yaml new file mode 100644 index 000000000..8175520da --- /dev/null +++ b/.github/workflows/publish_review_event.yaml @@ -0,0 +1,96 @@ +name: Publish Review Event + +on: + workflow_run: + workflows: ["Store_Review_Event"] + types: + - completed +permissions: read-all + +jobs: + fetch_and_process: + runs-on: ubuntu-latest + steps: + - name: 'Download artifact' + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "eventjson" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/eventjson.zip`, Buffer.from(download.data)); + + - name: 'Unzip artifact' + run: | + ls + unzip eventjson.zip + + - name: Get Token + run: | + retries=3 + while [ $retries -gt 0 ]; do + if RESPONSE=$(curl --silent --location "${{ secrets.CLIENT_TOKEN_URL }}" \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --data-urlencode "client_id=${{ secrets.CLIENT_ID }}" \ + --data-urlencode "client_secret=${{ secrets.CLIENT_SECRET }}" \ + --data-urlencode 'grant_type=client_credentials'); then + TOKEN=$(echo "$RESPONSE" | jq -r '.access_token') + if [ -n "$TOKEN" ]; then + echo "TOKEN=$TOKEN" >> $GITHUB_ENV + break + else + echo "Error: Failed to parse access token from response" + fi + else + echo "Error: Request to get token failed" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to retrieve access token after multiple retries" + exit 1 + fi + + + + - name: Trigger Build with Event + if: success() + env: + TOKEN: ${{ env.TOKEN }} + run: | + + EVENT_DATA=$(cat event.json) + + retries=3 + while [ $retries -gt 0 ]; do + if curl --silent --location --request POST "${{ secrets.CLIENT_PUBLISH_URL }}" \ + --header 'Content-Type: application/json' \ + --header 'x-github-event: github' \ + --header "Authorization: Bearer $TOKEN" \ + --data "$EVENT_DATA"; then + break + else + echo "Error: Failed to trigger build" + fi + retries=$((retries-1)) + sleep 1 + done + + if [ $retries -eq 0 ]; then + echo "Error: Failed to trigger build after multiple retries" + exit 1 + fi diff --git a/.github/workflows/store_review_event.yaml b/.github/workflows/store_review_event.yaml new file mode 100644 index 000000000..703b24063 --- /dev/null +++ b/.github/workflows/store_review_event.yaml @@ -0,0 +1,18 @@ +name: Store_Review_Event + +on: + pull_request_review: + types: "**" +permissions: read-all + +jobs: + Store_Review_Event: + runs-on: ubuntu-latest + name: Store Review Event + steps: + - name: Upload event JSON as artifact + uses: actions/upload-artifact@v4 + with: + name: eventjson + path: "${{ github.event_path }}" + retention-days: 7 \ No newline at end of file