Skip to content

Commit

Permalink
Merge pull request #324 from k1LoW/pkg-update
Browse files Browse the repository at this point in the history
Update pkgs
  • Loading branch information
k1LoW authored Feb 8, 2024
2 parents 108950a + f21320e commit 78c9d9e
Show file tree
Hide file tree
Showing 11 changed files with 8,159 additions and 4,207 deletions.
10,025 changes: 6,232 additions & 3,793 deletions CREDITS

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ The variables available in the `if` section are [here](https://github.com/k1LoW/

### `*.if:`

> **Note**: It supports [antonmedv/expr](https://github.com/antonmedv/expr) expressions.
> **Note**: It supports [expr-lang/expr](https://github.com/expr-lang/expr) expressions.

The variables available in the `if` section are as follows

Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"time"

"github.com/antonmedv/expr"
"github.com/expr-lang/expr"
"github.com/goccy/go-yaml"
"github.com/hashicorp/go-multierror"
"github.com/k1LoW/duration"
Expand Down
4 changes: 2 additions & 2 deletions config/ready_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"
"time"

"github.com/google/go-github/v50/github"
"github.com/k1LoW/go-github-client/v50/factory"
"github.com/google/go-github/v58/github"
"github.com/k1LoW/go-github-client/v58/factory"
"github.com/k1LoW/octocov/gh"
"github.com/migueleliasweb/go-github-mock/src/mock"
)
Expand Down
45 changes: 16 additions & 29 deletions coverage/coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,28 +254,23 @@ func (lc LineCoverages) Covered() int { //nostyle:recvtype
}

func (bc BlockCoverages) ToLineCoverages() LineCoverages { //nostyle:recvtype
m := skipmap.NewInt()
m := skipmap.NewInt[*skipmap.IntMap[int]]()

for _, c := range bc {
sl := *c.StartLine
el := *c.EndLine
for i := sl; i <= el; i++ {
var mm *skipmap.IntMap
v, ok := m.Load(i)
if ok {
mm, ok = v.(*skipmap.IntMap)
if !ok {
panic("invalid type") //nostyle:dontpanic
}
} else {
mm = skipmap.NewInt()
var mm *skipmap.IntMap[int]
mm, ok := m.Load(i)
if !ok {
mm = skipmap.NewInt[int]()
}
m.Store(i, mm)

if c.Type == TypeLOC || (sl < i && i < el) {
// TypeLOC or TypeStmt
mm.Range(func(key int, v any) bool {
mm.Store(key, v.(int)+*c.Count)
mm.Range(func(key int, v int) bool {
mm.Store(key, v+*c.Count)
return true
})
if _, ok := mm.Load(startPos); !ok {
Expand All @@ -296,9 +291,9 @@ func (bc BlockCoverages) ToLineCoverages() LineCoverages { //nostyle:recvtype
pos []int
counts []int
)
mm.Range(func(key int, v any) bool {
mm.Range(func(key int, v int) bool {
pos = append(pos, key)
counts = append(counts, v.(int))
counts = append(counts, v)
return true
})

Expand All @@ -314,9 +309,9 @@ func (bc BlockCoverages) ToLineCoverages() LineCoverages { //nostyle:recvtype

switch {
case i == sl && i != el:
mm.Range(func(key int, v any) bool {
mm.Range(func(key int, v int) bool {
if key >= *c.StartCol {
mm.Store(key, v.(int)+*c.Count)
mm.Store(key, v+*c.Count)
}
return true
})
Expand All @@ -330,7 +325,7 @@ func (bc BlockCoverages) ToLineCoverages() LineCoverages { //nostyle:recvtype
for j := *c.StartCol; j <= *c.EndCol; j++ {
v, ok := mm.Load(j)
if ok {
mm.Store(j, v.(int)+*c.Count)
mm.Store(j, v+*c.Count)
} else {
if j <= startTo {
mm.Store(j, startCount+*c.Count)
Expand All @@ -342,9 +337,9 @@ func (bc BlockCoverages) ToLineCoverages() LineCoverages { //nostyle:recvtype
}
}
case i != sl && i == el:
mm.Range(func(key int, v any) bool {
mm.Range(func(key int, v int) bool {
if key <= *c.EndCol {
mm.Store(key, v.(int)+*c.Count)
mm.Store(key, v+*c.Count)
}
return true
})
Expand All @@ -359,21 +354,13 @@ func (bc BlockCoverages) ToLineCoverages() LineCoverages { //nostyle:recvtype
}

lcs := LineCoverages{}
m.Range(func(line int, mmi any) bool {
mm, ok := mmi.(*skipmap.IntMap)
if !ok {
return false
}
m.Range(func(line int, mm *skipmap.IntMap[int]) bool {
lc := &LineCoverage{
Line: line,
Count: 0,
PosCoverages: PosCoverages{},
}
mm.Range(func(pos int, ci any) bool {
c, ok := ci.(int)
if !ok {
return false
}
mm.Range(func(pos int, c int) bool {
lc.PosCoverages = append(lc.PosCoverages, &PosCoverage{
Pos: pos,
Count: c,
Expand Down
9 changes: 5 additions & 4 deletions gh/gh.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/object"
ghttp "github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/google/go-github/v50/github"
"github.com/google/go-github/v58/github"
"github.com/k1LoW/go-github-actions/artifact"
"github.com/k1LoW/go-github-client/v50/factory"
"github.com/k1LoW/go-github-client/v58/factory"
"github.com/k1LoW/repin"
"github.com/lestrrat-go/backoff/v2"
"github.com/shurcooL/githubv4"
Expand Down Expand Up @@ -115,7 +115,7 @@ func (g *Gh) PushContent(ctx context.Context, owner, repo, branch, content, cp,
Tree: tree,
Parents: []*github.Commit{parent},
}
resC, _, err := srv.CreateCommit(ctx, owner, repo, commit)
resC, _, err := srv.CreateCommit(ctx, owner, repo, commit, &github.CreateCommitOptions{})
if err != nil {
return err
}
Expand Down Expand Up @@ -528,6 +528,7 @@ type ArtifactFile struct {
}

func (g *Gh) FetchLatestArtifact(ctx context.Context, owner, repo, name, fp string) (*ArtifactFile, error) {
const maxRedirect = 5
page := 1
for {
l, res, err := g.client.Actions.ListArtifacts(ctx, owner, repo, &github.ListOptions{
Expand All @@ -542,7 +543,7 @@ func (g *Gh) FetchLatestArtifact(ctx context.Context, owner, repo, name, fp stri
if a.GetName() != name {
continue
}
u, _, err := g.client.Actions.DownloadArtifact(ctx, owner, repo, a.GetID(), true)
u, _, err := g.client.Actions.DownloadArtifact(ctx, owner, repo, a.GetID(), maxRedirect)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions gh/gh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-github/v50/github"
"github.com/k1LoW/go-github-client/v50/factory"
"github.com/google/go-github/v58/github"
"github.com/k1LoW/go-github-client/v58/factory"
"github.com/migueleliasweb/go-github-mock/src/mock"
)

Expand Down
149 changes: 81 additions & 68 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,126 +1,139 @@
module github.com/k1LoW/octocov

go 1.21
go 1.21.4

toolchain go1.21.6

require (
cloud.google.com/go/bigquery v1.50.0
cloud.google.com/go/storage v1.29.0
github.com/antchfx/xmlquery v1.3.15
github.com/antonmedv/expr v1.12.0
github.com/aws/aws-sdk-go v1.44.204
github.com/bmatcuk/doublestar/v4 v4.6.0
cloud.google.com/go/bigquery v1.59.0
cloud.google.com/go/storage v1.37.0
github.com/antchfx/xmlquery v1.3.18
github.com/aws/aws-sdk-go v1.50.13
github.com/bmatcuk/doublestar/v4 v4.6.1
github.com/chainguard-dev/git-urls v1.0.2
github.com/fatih/color v1.14.1
github.com/expr-lang/expr v1.16.0
github.com/fatih/color v1.16.0
github.com/go-enry/go-enry/v2 v2.8.6
github.com/go-git/go-git/v5 v5.11.0
github.com/goark/gnkf v0.7.3
github.com/goccy/go-json v0.10.0
github.com/goccy/go-yaml v1.9.8
github.com/goark/gnkf v0.7.7
github.com/goccy/go-json v0.10.2
github.com/goccy/go-yaml v1.11.3
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/google/go-cmp v0.6.0
github.com/google/go-github/v50 v50.0.0
github.com/google/go-github/v58 v58.0.0
github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c
github.com/hashicorp/go-multierror v1.1.1
github.com/hhatto/gocloc v0.5.2
github.com/josharian/txtarfs v0.0.0-20210615234325-77aca6df5bca
github.com/jszwec/s3fs v0.4.0
github.com/jszwec/s3fs v1.0.0
github.com/k1LoW/duration v1.2.0
github.com/k1LoW/expand v0.5.6
github.com/k1LoW/ghfs v0.9.0
github.com/k1LoW/expand v0.11.0
github.com/k1LoW/ghfs v1.2.0
github.com/k1LoW/go-github-actions v0.0.2
github.com/k1LoW/go-github-client/v50 v50.0.6
github.com/k1LoW/go-github-client/v58 v58.0.11
github.com/k1LoW/repin v0.3.4
github.com/lestrrat-go/backoff/v2 v2.0.8
github.com/lucasb-eyer/go-colorful v1.2.0
github.com/mackerelio/mackerel-client-go v0.24.0
github.com/mauri870/gcsfs v0.0.0-20220203135357-0da01ba4e96d
github.com/migueleliasweb/go-github-mock v0.0.16
github.com/mackerelio/mackerel-client-go v0.29.0
github.com/mauri870/gcsfs v0.0.0-20240120035028-2326f4c97769
github.com/migueleliasweb/go-github-mock v0.0.22
github.com/oklog/ulid/v2 v2.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/samber/lo v1.38.1
github.com/shurcooL/githubv4 v0.0.0-20230215024106-420ad0987b9b
github.com/spf13/cobra v1.6.1
github.com/samber/lo v1.39.0
github.com/shurcooL/githubv4 v0.0.0-20240120211514-18a1ae0e79dc
github.com/spf13/cobra v1.8.0
github.com/tenntenn/golden v0.4.0
github.com/xeipuuv/gojsonschema v1.2.0
github.com/zhangyunhao116/skipmap v0.8.0
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb
golang.org/x/image v0.10.0
golang.org/x/oauth2 v0.7.0
github.com/zhangyunhao116/skipmap v0.10.1
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
golang.org/x/image v0.15.0
golang.org/x/oauth2 v0.17.0
golang.org/x/text v0.14.0
golang.org/x/tools v0.13.0
google.golang.org/api v0.114.0
golang.org/x/tools v0.17.0
google.golang.org/api v0.162.0
gopkg.in/ini.v1 v1.67.0
)

require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/compute v1.19.1 // indirect
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.23.4 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.13.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/antchfx/xpath v1.2.3 // indirect
github.com/apache/arrow/go/v11 v11.0.0 // indirect
github.com/apache/thrift v0.16.0 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/antchfx/xpath v1.2.5 // indirect
github.com/apache/arrow/go/v14 v14.0.2 // indirect
github.com/bradleyfalzon/ghinstallation/v2 v2.9.0 // indirect
github.com/buildkite/interpolate v0.0.0-20200526001904-07f35b4ae251 // indirect
github.com/cli/go-gh v1.1.0 // indirect
github.com/cli/go-gh/v2 v2.5.0 // indirect
github.com/cli/safeexec v1.0.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-enry/go-oniguruma v1.2.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/goark/errs v1.1.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goark/errs v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/google/go-github/v56 v56.0.0 // indirect
github.com/google/go-github/v57 v57.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/mapfs v0.0.0-20210615234106-095c008854e6 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/asmfmt v1.3.2 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/lestrrat-go/option v1.0.0 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
github.com/zhangyunhao116/fastrand v0.3.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.30.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/otel v1.23.1 // indirect
go.opentelemetry.io/otel/metric v1.23.1 // indirect
go.opentelemetry.io/otel/trace v1.23.1 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 78c9d9e

Please sign in to comment.