diff --git a/.github/workflows/canary-model-zoo.yml b/.github/workflows/canary-model-zoo.yml index 76685ecf..b4aaf01c 100644 --- a/.github/workflows/canary-model-zoo.yml +++ b/.github/workflows/canary-model-zoo.yml @@ -63,3 +63,10 @@ jobs: if: ${{github.event.inputs.download}} == 'huggingface' || ${{github.event.inputs.download}} == 'all' working-directory: canary run: DJL_ENGINE=tokenizers ./gradlew run -Dmain="ai.djl.canary.ModelZooTest" + + publish-success-metric: + needs: [ canary-modelzoo ] + if: always() + uses: ./.github/workflows/publish-job-success.yml + with: + metric-name: DJLDemo-CanaryModelZoo-Failure diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 733227ea..2f952dd1 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -67,3 +67,10 @@ jobs: repo-id: ${{ github.events.inputs.repo-id }} djl-version: ${{ github.event.inputs.djl-version }} pt-version: ${{ github.event.inputs.pt-version }} + + publish-success-metric: + needs: [ aarch64-linux, centos, gpu, m1-mac, mac, ubuntu, windows ] + if: always() + uses: ./.github/workflows/publish-job-success.yml + with: + metric-name: DJLDemo-Canary-Failure diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 60297979..4ceada2f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -40,3 +40,9 @@ jobs: cd extension && mvn package install && cd .. cd extension-example && ./mvnw package + publish-success-metric: + needs: [ compile-test ] + if: always() + uses: ./.github/workflows/publish-job-success.yml + with: + metric-name: DJLDemo-NightlyIntegrationTest-Failure diff --git a/.github/workflows/publish-job-success.yml b/.github/workflows/publish-job-success.yml new file mode 100644 index 00000000..7b2f7ffc --- /dev/null +++ b/.github/workflows/publish-job-success.yml @@ -0,0 +1,27 @@ +name: Publish Job Success Metric to CloudWatch + +on: + workflow_call: + inputs: + metric-name: + description: "The name of the job to publish a metric for" + type: string + required: true + +jobs: + publish-job-success-to-cloudwatch: + if: ${{ github.event_name == 'schedule' }} + runs-on: [ self-hosted, scheduler ] + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-region: us-west-2 + - name: Publish Job Success Metric + run: | + [[ ${{ job.status }} == "success" ]] + failedBuild=$? + aws cloudwatch put-metric-data --namespace GithubCI \ + --metric-name ${{ inputs.metric-name }} \ + --value $failedBuild \ + --unit Count