Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
type: string
permissions:
contents: write
id-token: write
jobs:
cli:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -39,9 +40,19 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$TAG" cli/sourcegraph-cli.tgz --clobber
# NPM_TOKEN publishes the first version; once npm lists this workflow as
# a trusted publisher of @c4a/sourcegraph, the token can be removed and
# PUBLISH_WITH_OIDC set to true.
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: env.NODE_AUTH_TOKEN != ''
OIDC: ${{ vars.PUBLISH_WITH_OIDC }}
if: env.NODE_AUTH_TOKEN != '' || env.OIDC == 'true'
working-directory: cli
run: npm publish --access public
run: |
npm install -g npm@11
if npm view "@c4a/sourcegraph@$(node -p "require('./package.json').version")" version >/dev/null 2>&1; then
echo "This version is already on npm."
else
npm publish --access public --provenance
fi
7 changes: 6 additions & 1 deletion internal/service/metrics_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ func TestMinuteLinesWrittenAfterMidnightAreCounted(t *testing.T) {
if err != nil {
t.Fatal(err)
}
yesterday := time.Now().UTC().Truncate(24*time.Hour).Unix() - 60 // 23:59 UTC yesterday
now := time.Now().UTC()
if now.Sub(now.Truncate(24*time.Hour)) > 23*time.Hour+55*time.Minute {
// The last minute of yesterday would be older than the 24-hour window.
t.Skip("too close to midnight UTC")
}
yesterday := now.Truncate(24*time.Hour).Unix() - 60 // 23:59 UTC yesterday
s := &Service{Root: root, boot: "pod-a/1", metrics: Metrics{queue: make(chan observation, 1)}}
s.UseLogFiles(w)
s.metrics.buckets = map[int64]*Bucket{yesterday: {Minute: yesterday, ByOperation: map[string]Metric{"search": {Requests: 5}}, ByRepo: map[string]Metric{}}}
Expand Down