@@ -2,6 +2,7 @@ empty!(Base.DEPOT_PATH)
22push! (Base. DEPOT_PATH , mktempdir (; cleanup = true ))
33
44import Pkg
5+ import LibGit2
56import Logging
67import TOML
78
@@ -108,8 +109,87 @@ sort!(fcs; by = fc -> fc.filename)
108109print_coverage_summary .(fcs);
109110print_coverage_summary (fcs, " Total" )
110111
111- # In order to upload to Codecov, you need to have the `CODECOV_TOKEN` environment variable defined.
112- Coverage. Codecov. submit_local (fcs)
112+ function query_git_info ()
113+ dir = pwd ()
114+ @info " " dir typeof (dir)
113115
114- # In order to upload to Coveralls, you need to have the `COVERALLS_TOKEN` environment variable defined.
115- Coverage. Coveralls. submit_local (fcs)
116+ repo = LibGit2. GitRepoExt (dir)
117+ @info " " repo typeof (repo)
118+
119+ head = LibGit2. head (repo)
120+ @info " " head typeof (head)
121+
122+ branch = LibGit2. shortname (head)
123+ @info " " branch typeof (branch)
124+
125+ head_cmt = LibGit2. peel (head)
126+ @info " " head_cmt typeof (head_cmt)
127+
128+ head_oid = LibGit2. GitHash (head_cmt)
129+ @info " " head_oid typeof (head_oid)
130+
131+ commit_sha = string (head_oid)
132+
133+ author_name = string (LibGit2. author (head_cmt). name)
134+
135+ author_email = string (LibGit2. author (head_cmt). email)
136+
137+ committer_name = string (LibGit2. committer (head_cmt). name)
138+
139+ committer_email = string (LibGit2. committer (head_cmt). email)
140+
141+ message = LibGit2. message (head_cmt)
142+
143+ remote_name = " origin"
144+
145+ # determine remote url, but only if repo is not in detached state
146+ remote = " "
147+ if branch != " HEAD"
148+ LibGit2. with (LibGit2. get (LibGit2. GitRemote, repo, remote_name)) do rmt
149+ remote = LibGit2. url (rmt)
150+ end
151+ end
152+ LibGit2. close (repo)
153+
154+ @info " " branch
155+ if strip (branch) == " HEAD"
156+ branch = String (strip (read (` git rev-parse --abbrev-ref HEAD` , String)))
157+ end
158+ @info " " branch
159+
160+ return Dict (
161+ " branch" => branch,
162+ " remotes" => [
163+ Dict (
164+ " name" => remote_name,
165+ " url" => remote
166+ )
167+ ],
168+ " head" => Dict (
169+ " id" => commit_sha,
170+ " author_name" => author_name,
171+ " author_email" => author_email,
172+ " committer_name" => committer_name,
173+ " committer_email" => committer_email,
174+ " message" => message
175+ )
176+ )
177+ end
178+
179+ let
180+ git_info = query_git_info ()
181+ @info " " git_info
182+ @info " " git_info[" branch" ]
183+
184+ # In order to upload to Codecov, you need to have the `CODECOV_TOKEN` environment variable defined.
185+ Coverage. Codecov. submit_local (fcs)
186+ end
187+
188+ let
189+ git_info = query_git_info ()
190+ @info " " git_info
191+ @info " " git_info[" branch" ]
192+
193+ # In order to upload to Coveralls, you need to have the `COVERALLS_TOKEN` environment variable defined.
194+ Coverage. Coveralls. submit_local (fcs, git_info)
195+ end
0 commit comments