From 1b16784acd968ba5b99d518b2eaa07e85546d632 Mon Sep 17 00:00:00 2001 From: Romanticoseu <1251448395@qq.com> Date: Thu, 8 Sep 2022 09:58:03 +0800 Subject: [PATCH 1/6] add create-job-status-badge action --- .../create-job-status-badge/action.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/actions/create-job-status-badge/action.yml diff --git a/.github/actions/create-job-status-badge/action.yml b/.github/actions/create-job-status-badge/action.yml new file mode 100644 index 00000000000..db8e1429f69 --- /dev/null +++ b/.github/actions/create-job-status-badge/action.yml @@ -0,0 +1,54 @@ +name: 'Create Job Status Badge' +description: 'In a workflow with multiple jobs, create a badge that can display the completion time and status of the job' +inputs: + secret: + description: 'use to access gist' + required: true + gist-id: + description: 'gist-id' + required: true + file-name: + description: 'gist file name(.json)' + required: true + type: + description: 'workflow or job' + required: true + job-name: + description: 'job name' +runs: + using: "composite" + steps: + - name: print time + shell: bash + run: | + export NOW=$( date '+%F_%H:%M:%S' ) + echo "TIME=${NOW}" >> $GITHUB_ENV + + - name: get job status + shell: bash + run: | + echo "JOB-STATUS=${{ job.status }}" >>$GITHUB_ENV + - name: set badge color + shell: bash + run: if [ ${{ env.JOB-STATUS }} == "success" ] ; then echo "COLOR=green" >> $GITHUB_ENV ; else echo "COLOR=red" >> $GITHUB_ENV; fi + + - name: Create job badge + if: ${{ inputs.type == 'job' }} + uses: analytics-zoo/dynamic-badges-action@master + with: + auth: ${{ inputs.secret }} + gistID: ${{ inputs.gist-id }} + filename: ${{ inputs.file-name }} + label: ${{ inputs.job-name }} + message: ${{ env.JOB-STATUS }} + color: ${{ env.COLOR }} + + - name: Create time badge + if: ${{ inputs.type == 'workflow' }} + uses: analytics-zoo/dynamic-badges-action@master + with: + auth: ${{ inputs.secret }} + gistID: ${{ inputs.gist-id }} + filename: ${{ inputs.file-name }} + label: Time is + message: ${{ env.TIME }} From a5bc1d58ae9d29d5f8091026fa674b7e0c2eef2f Mon Sep 17 00:00:00 2001 From: Romanticoseu <1251448395@qq.com> Date: Fri, 9 Sep 2022 10:26:43 +0800 Subject: [PATCH 2/6] add selfHostedRunner input --- .github/actions/create-job-status-badge/action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/actions/create-job-status-badge/action.yml b/.github/actions/create-job-status-badge/action.yml index db8e1429f69..4793da41eb3 100644 --- a/.github/actions/create-job-status-badge/action.yml +++ b/.github/actions/create-job-status-badge/action.yml @@ -15,6 +15,10 @@ inputs: required: true job-name: description: 'job name' + isSelfHostedRunner: + description: 'If use self-hosted runner it will be true' + required: true + default: false runs: using: "composite" steps: @@ -38,6 +42,7 @@ runs: with: auth: ${{ inputs.secret }} gistID: ${{ inputs.gist-id }} + isSelfHostedRunner: ${{ inputs.isSelfHostedRunner }} filename: ${{ inputs.file-name }} label: ${{ inputs.job-name }} message: ${{ env.JOB-STATUS }} @@ -49,6 +54,7 @@ runs: with: auth: ${{ inputs.secret }} gistID: ${{ inputs.gist-id }} + isSelfHostedRunner: ${{ inputs.isSelfHostedRunner }} filename: ${{ inputs.file-name }} label: Time is message: ${{ env.TIME }} From 5e2d5c6449e973781008b4ebe3e35315c4637e98 Mon Sep 17 00:00:00 2001 From: Romanticoseu <1251448395@qq.com> Date: Fri, 9 Sep 2022 10:54:00 +0800 Subject: [PATCH 3/6] add create badge job --- .github/workflows/license-scan.yml | 24 ++++++++++ .github/workflows/nightly_build.yml | 57 ++++++++++++++++++++++++ .github/workflows/nightly_test.yml | 13 ++++++ .github/workflows/python-style-check.yml | 13 ++++++ .github/workflows/scala-style-check.yml | 13 ++++++ 5 files changed, 120 insertions(+) diff --git a/.github/workflows/license-scan.yml b/.github/workflows/license-scan.yml index 36352ee2395..d9ff3a4802d 100644 --- a/.github/workflows/license-scan.yml +++ b/.github/workflows/license-scan.yml @@ -28,3 +28,27 @@ jobs: with: api-key: ${{ secrets.FOSSAAPIKEY }} run-tests: true + + - name: Create Job Badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: f91eb10af4d9dbe216ba0f0da71cace9 + isSelfHostedRunner: false + file-name: fossa-scan.json + type: job + job-name: fossa-scan + + create-workflow-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: create workflow badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: 966d4c0bf23c67662120d1bf4b1c88dc + file-name: license-scan.json + type: workflow diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index 1996c6012bc..34ecd970934 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -151,6 +151,17 @@ jobs: mv scala/ppml/pom.xml.origin scala/ppml/pom.xml mv scala/assembly/pom.xml.origin scala/assembly/pom.xml + - name: Create Job Badge + uses: ./.github/actions/create-job-status-badge + if: ${{ always() }} + with: + secret: ${{ secrets.GIST_SECRET}} + gist-id: 7495dccc42118020c12de5a095cfa2a6 + isSelfHostedRunner: true + file-name: nb-scala-build.json + type: job + job-name: scala-build + docker-build-bigdl: needs: scala-build if: ${{ github.event.schedule || github.event.inputs.artifact == 'docker-bigdl-build' || github.event.inputs.artifact == 'all' }} @@ -204,6 +215,17 @@ jobs: docker tag ${IMAGE}-spark-3.1.2:${TAG} 10.239.45.10/arda/${IMAGE}-spark-3.1.2:${TAG} docker push 10.239.45.10/arda/${IMAGE}-spark-3.1.2:${TAG} docker rmi -f ${IMAGE}-spark-3.1.2:${TAG} + + - name: Create Job Badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: aaee1abb17ed9aad37e19256787c52b2 + isSelfHostedRunner: true + file-name: nb-docker-build-bigdl.json + type: job + job-name: docker-build-bigdl python-build: @@ -245,6 +267,17 @@ jobs: ## mac ## bash python/dev/release_default_mac.sh ${nb_version} true + - name: Create Job Badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: 983672c70e351381418fdf6f9076637a + isSelfHostedRunner: true + file-name: nb-python-build.json + type: job + job-name: python-build + python-sourceforge-build: if: ${{ github.event.schedule || github.event.inputs.artifact == 'python-sourceforge-build' || github.event.inputs.artifact == 'all' }} runs-on: [self-hosted,alpha,Bree,ubuntu-20.04-lts] @@ -359,6 +392,30 @@ jobs: scp ./python/chronos/src/dist/bigdl_chronos*-py3-none-macosx_10_11_x86_64.whl \ intelanalytics@frs.sourceforge.net:/home/frs/project/analytics-zoo/chronos-py-spark3 + - name: Create Job Badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: 6d878630c0c8f50c388bb7e196354ca8 + isSelfHostedRunner: true + file-name: nb-python-sourceforge-build.json + type: job + job-name: python-build-sourceforge + + create-workflow-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: create workflow badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: 48dbd87983219d4fe264adfea701815a + file-name: nightly-build.json + type: workflow + diff --git a/.github/workflows/nightly_test.yml b/.github/workflows/nightly_test.yml index 39496894524..30259ca1eec 100644 --- a/.github/workflows/nightly_test.yml +++ b/.github/workflows/nightly_test.yml @@ -146,3 +146,16 @@ jobs: uses: ./.github/actions/maven-setup-action - name: Run test uses: ./.github/actions/orca-ray-ctx-example-action + + create-workflow-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: create workflow badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: bc8a699b455bced4a1aef138ad5df07e + file-name: nightly-test.json + type: workflow \ No newline at end of file diff --git a/.github/workflows/python-style-check.yml b/.github/workflows/python-style-check.yml index 269276af316..0921d35efe5 100644 --- a/.github/workflows/python-style-check.yml +++ b/.github/workflows/python-style-check.yml @@ -89,3 +89,16 @@ jobs: - name: Serving style checking run: bash python/serving/dev/lint-python + + create-workflow-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: create workflow badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: 515298657716ead4615f539244730bf0 + file-name: python-style-check.json + type: workflow \ No newline at end of file diff --git a/.github/workflows/scala-style-check.yml b/.github/workflows/scala-style-check.yml index 9e9270bd29d..61e799c875c 100644 --- a/.github/workflows/scala-style-check.yml +++ b/.github/workflows/scala-style-check.yml @@ -70,3 +70,16 @@ jobs: cd scala mvn clean verify -DskipTests -U + + create-workflow-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: create workflow badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: 689bf54fe32e4758ed528e4168c724bc + file-name: scala-style-check.json + type: workflow From 421df7324d7d17a72a3b4507d577becef27a400f Mon Sep 17 00:00:00 2001 From: Romanticoseu <1251448395@qq.com> Date: Fri, 9 Sep 2022 11:22:27 +0800 Subject: [PATCH 4/6] change isSelfHostedRunner to is-self-hosted-runner --- .github/actions/create-job-status-badge/action.yml | 6 +++--- .github/workflows/license-scan.yml | 2 +- .github/workflows/nightly_build.yml | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/create-job-status-badge/action.yml b/.github/actions/create-job-status-badge/action.yml index 4793da41eb3..b98995e54e1 100644 --- a/.github/actions/create-job-status-badge/action.yml +++ b/.github/actions/create-job-status-badge/action.yml @@ -15,7 +15,7 @@ inputs: required: true job-name: description: 'job name' - isSelfHostedRunner: + is-self-hosted-runner: description: 'If use self-hosted runner it will be true' required: true default: false @@ -42,7 +42,7 @@ runs: with: auth: ${{ inputs.secret }} gistID: ${{ inputs.gist-id }} - isSelfHostedRunner: ${{ inputs.isSelfHostedRunner }} + isSelfHostedRunner: ${{ inputs.is-self-hosted-runner }} filename: ${{ inputs.file-name }} label: ${{ inputs.job-name }} message: ${{ env.JOB-STATUS }} @@ -54,7 +54,7 @@ runs: with: auth: ${{ inputs.secret }} gistID: ${{ inputs.gist-id }} - isSelfHostedRunner: ${{ inputs.isSelfHostedRunner }} + isSelfHostedRunner: ${{ inputs.is-self-hosted-runner }} filename: ${{ inputs.file-name }} label: Time is message: ${{ env.TIME }} diff --git a/.github/workflows/license-scan.yml b/.github/workflows/license-scan.yml index d9ff3a4802d..196fcca3660 100644 --- a/.github/workflows/license-scan.yml +++ b/.github/workflows/license-scan.yml @@ -35,7 +35,7 @@ jobs: with: secret: ${{ secrets.GIST_SECRET }} gist-id: f91eb10af4d9dbe216ba0f0da71cace9 - isSelfHostedRunner: false + is-self-hosted-runner: false file-name: fossa-scan.json type: job job-name: fossa-scan diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index 34ecd970934..80303e45950 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -157,7 +157,7 @@ jobs: with: secret: ${{ secrets.GIST_SECRET}} gist-id: 7495dccc42118020c12de5a095cfa2a6 - isSelfHostedRunner: true + is-self-hosted-runner: true file-name: nb-scala-build.json type: job job-name: scala-build @@ -222,7 +222,7 @@ jobs: with: secret: ${{ secrets.GIST_SECRET }} gist-id: aaee1abb17ed9aad37e19256787c52b2 - isSelfHostedRunner: true + is-self-hosted-runner: true file-name: nb-docker-build-bigdl.json type: job job-name: docker-build-bigdl @@ -273,7 +273,7 @@ jobs: with: secret: ${{ secrets.GIST_SECRET }} gist-id: 983672c70e351381418fdf6f9076637a - isSelfHostedRunner: true + is-self-hosted-runner: true file-name: nb-python-build.json type: job job-name: python-build @@ -398,7 +398,7 @@ jobs: with: secret: ${{ secrets.GIST_SECRET }} gist-id: 6d878630c0c8f50c388bb7e196354ca8 - isSelfHostedRunner: true + is-self-hosted-runner: true file-name: nb-python-sourceforge-build.json type: job job-name: python-build-sourceforge From 1e5cc8dc68fb01dec029537ebd4a8011c8f62d3c Mon Sep 17 00:00:00 2001 From: Romanticoseu <1251448395@qq.com> Date: Tue, 13 Sep 2022 10:04:39 +0800 Subject: [PATCH 5/6] update create-job-status-badge --- .github/actions/create-job-status-badge/action.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-job-status-badge/action.yml b/.github/actions/create-job-status-badge/action.yml index b98995e54e1..032c14f2a70 100644 --- a/.github/actions/create-job-status-badge/action.yml +++ b/.github/actions/create-job-status-badge/action.yml @@ -37,7 +37,7 @@ runs: run: if [ ${{ env.JOB-STATUS }} == "success" ] ; then echo "COLOR=green" >> $GITHUB_ENV ; else echo "COLOR=red" >> $GITHUB_ENV; fi - name: Create job badge - if: ${{ inputs.type == 'job' }} + if: ${{ inputs.type == 'job' && inputs.secret != '' }} uses: analytics-zoo/dynamic-badges-action@master with: auth: ${{ inputs.secret }} @@ -49,7 +49,7 @@ runs: color: ${{ env.COLOR }} - name: Create time badge - if: ${{ inputs.type == 'workflow' }} + if: ${{ inputs.type == 'workflow' && inputs.secret != '' }} uses: analytics-zoo/dynamic-badges-action@master with: auth: ${{ inputs.secret }} @@ -58,3 +58,9 @@ runs: filename: ${{ inputs.file-name }} label: Time is message: ${{ env.TIME }} + + - name: print error message + if: ${{ inputs.secret == '' }} + shell: bash + run: | + echo "Can not get secret! Please check out your workflow!(mainly caused by pr trigger)" From 0d425da9100f9b3f4fe2ad2d9a070aaf01789932 Mon Sep 17 00:00:00 2001 From: Romanticoseu <1251448395@qq.com> Date: Tue, 13 Sep 2022 10:13:56 +0800 Subject: [PATCH 6/6] adjust indent --- .github/workflows/license-scan.yml | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/license-scan.yml b/.github/workflows/license-scan.yml index 2a46e47b04d..cb7367ecaa6 100644 --- a/.github/workflows/license-scan.yml +++ b/.github/workflows/license-scan.yml @@ -30,22 +30,22 @@ jobs: run-tests: true - name: "Filter the Dependency Tree" - if: ${{ failure() }} - run: | - sed -i 's/${spark-version.project}<\/artifactId>/${spark-version.project}-${SPARK_PLATFORM}<\/artifactId>/' scala/dllib/pom.xml - sed -i 's/3.0<\/artifactId>/3.0-${SPARK_PLATFORM}<\/artifactId>/' scala/common/spark-version/3.0/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/common/spark-version/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/common/spark-version/3.0/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/dllib/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/orca/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/friesian/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/grpc/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/serving/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/ppml/pom.xml - sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/assembly/pom.xml - cd scala - mvn -P spark_3.x dependency:tree -Dspark.version=3.1.2 -DSPARK_PLATFORM=SPARK_3.1 + if: ${{ failure() }} + run: | + sed -i 's/${spark-version.project}<\/artifactId>/${spark-version.project}-${SPARK_PLATFORM}<\/artifactId>/' scala/dllib/pom.xml + sed -i 's/3.0<\/artifactId>/3.0-${SPARK_PLATFORM}<\/artifactId>/' scala/common/spark-version/3.0/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/common/spark-version/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/common/spark-version/3.0/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/dllib/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/orca/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/friesian/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/grpc/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/serving/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/ppml/pom.xml + sed -i 's/bigdl-parent-spark_${spark.version}<\/artifactId>/bigdl-parent-spark_3.1.2<\/artifactId>/' scala/assembly/pom.xml + cd scala + mvn -P spark_3.x dependency:tree -Dspark.version=3.1.2 -DSPARK_PLATFORM=SPARK_3.1 - name: Create Job Badge if: ${{ always() }}