Skip to content

Commit

Permalink
Use new codecov script
Browse files Browse the repository at this point in the history
  • Loading branch information
jeaye committed Feb 14, 2025
1 parent 9138db9 commit 7ecc570
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
JANK_SANITIZE: ${{ matrix.sanitize }}
ASAN_OPTIONS: detect_leaks=0
TERM: xterm
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
timeout-minutes: 35
steps:
- uses: actions/checkout@v4
Expand Down
22 changes: 18 additions & 4 deletions compiler+runtime/bin/jank/compiler+runtime/coverage.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@

(defn -main [{:keys [enabled?]}]
(util/log-step "Upload coverage report")
(if-not enabled?
(cond
(not enabled?)
(util/log-info "Not enabled")

(nil? (util/get-env "CODECOV_TOKEN"))
(util/log-info "Skipping due to missing $CODECOV_TOKEN")

:else
(util/with-elapsed-time duration
(let [llvm-profdata (util/find-llvm-tool "llvm-profdata")
llvm-cov (util/find-llvm-tool "llvm-cov")
Expand All @@ -27,10 +33,18 @@
:out lcov-file}
(str llvm-cov " export --format=lcov --instr-profile " merged-file
" build/jank-test --object build/jank"))
(let [codecov-script (str compiler+runtime-dir "/build/codecov")]
(util/quiet-shell {:out codecov-script} "curl -s https://codecov.io/bash")
(let [codecov-script (str compiler+runtime-dir "/build/codecov")
sha (or (util/get-env "GITHUB_SHA")
(util/quiet-shell {} "git rev-parse HEAD"))]
(util/quiet-shell {:out codecov-script} "curl -s https://cli.codecov.io/latest/linux/codecov")
(util/quiet-shell {} (str "chmod +x " codecov-script))
(util/quiet-shell {}
(str "bash " codecov-script " -f " lcov-file))))
(str codecov-script
" upload-process --disable-search --fail-on-error"
" -C " sha
" -t " (util/get-env "CODECOV_TOKEN")
" -n " (util/get-env "JANK_MATRIX_ID" "matrix") "-" (util/get-env "GITHUB_RUN_ID" "local")
" -f " lcov-file))))
(util/log-info-with-time duration "Merged and published coverage report"))))

(when (= *file* (System/getProperty "babashka.file"))
Expand Down

0 comments on commit 7ecc570

Please sign in to comment.