Fork me on GitHub
#cloverage
<
2022-01-12
>
fabrao15:01:18

Sorry @lee late response, I want to change the messag in Clojure CI / cloverage (pull_request) Successful in 4m to Clojure CI / cloverage (pull_request) Testing coverage is 80% , do you think is that possible?

lread16:01:56

@fabrao Oh I see. You want to see a summary of % coverage without digging into the workflow output. http://Codecov.io kinda sorta does this. I personally did not like this behaviour and disabled it, but by default it will add a comment to your PR. Here's https://github.com/lambdaisland/kaocha/pull/265#issuecomment-1010305140.

fabrao16:01:47

Ho, that´s nice, but I want something more simple, just a message. But I think it´s more like github integration stuff, thank you

lread16:01:57

Yeah, I hear ya, might be possible, but I also would not be surprised if GitHub would want to keep that top-level summary message standard/fixed. Let us know if you find a way!

fabrao16:01:33

I could use in other way, but could not in the same line as the checking, that I want to do. But it solve the issue in anyway.

lread16:01:37

Congrats! Is your project open source, can you share details on how you achieved this?

fabrao16:01:50

the project is private but I can share the way we did it for github action:

# Run tests
      - name: Run Coverage Tests
        run: clojure -M:cloverage > /tmp/cloverage.txt

      - name: Generate covarege Status
        run: |
          set -x
          total=`cat /tmp/cloverage.txt | grep "ALL FILES" | grep -Eo '[0-9]+\.[0-9]+' | head -1`
          echo "total coverage: $total"
          curl "https://${{ github.actor }}:${{ github.token }}@api.github.com/repos/${COMPANY}/${PROJECT}/statuses/${COMMIT_SHA}" -d "{\"state\": \"success\",\"target_url\": \"\",\"description\": \"${total}%\",\"context\": \"Resultado cobertura dos testes\"}"
        env:
		  COMPANY: "company_name"
		  PROJECT: "project_name"
          COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
          PULL_NUMBER: ${{ github.event.pull_request.number }}
          RUN_ID: ${{ github.run_id }}
deps.edn:

fabrao16:01:07

:cloverage
  {:extra-paths ["test"]
   :extra-deps {cloverage/cloverage {:mvn/version "1.2.2"}
                babashka/process {:mvn/version "0.0.2"}
                spec-provider/spec-provider {:mvn/version "0.4.14"}}
   :main-opts ["-m" "cloverage.coverage"
               "--no-html"
               "-p" "src"
               "-s" "test"
               "--no-colorize"
               "-t" "^(?!.*?(?:live|integration)).*$"
               "--fail-threshold" "30"]}

lread20:01:29

Interesting @fabrao, thank you for sharing!