- job:
    name: ldcg-onednn-benchmarks
    display-name: 'OneDNN - CI Benchmark'
    project-type: freestyle
    defaults: global
    description: |
        Updates source and builds OneDNN and ACL frequently for benchmark testing.
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            everyone-flat:
                - job-read
                - job-extended-read
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 90
            num-to-keep: 90
        - github:
            url: https://github.com/oneapi-src/oneDNN.git
    disabled: false
    node: d05bench
    concurent: false
    wrappers:
        - timestamps
        - credentials-binding:
            - text:
                credential-id: QA_REPORTS_TOKEN
                variable: QA_REPORTS_TOKEN
    builders:
        - shell:
            !include-raw: ldcg-onednn-benchmarks/build-onednn-acl.sh
        - shell:
            !include-raw: ldcg-onednn-benchmarks/test-onednn.sh
        - shell: |
            #!/bin/bash -ex

            if [ ! -d "${WORKSPACE}" ]; then
              set -x
              WORKSPACE=$(pwd)
            else
              set -ex
            fi

            if [ -f "${WORKSPACE}"/format-tests.sh ]; then
                rm -r "${WORKSPACE}"/format-tests.sh
            fi

            wget https://git.linaro.org/ci/job/configs.git/plain/ldcg-onednn-benchmarks/format-tests.sh

            sh format-tests.sh

            curl \
                --header "Auth-Token: $QA_REPORTS_TOKEN" \
                --form tests=@"${WORKSPACE}"/oneDNN-results/final_full-oneDNN-results.json \
                https://qa-reports.linaro.org/api/submit/ldcg/onednn/"${BUILD_NUMBER}"/d05

    publisher:
        - email:
            recipients: 'theodore.grey@linaro.org andrew.goodbody@linaro.org'
