File: check-grpc-proto-clients

package info (click to toggle)
golang-gitaly-proto 1.37.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 372 kB
  • sloc: ruby: 216; makefile: 93
file content (28 lines) | stat: -rwxr-xr-x 628 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env ruby

require 'fileutils'

require_relative 'run.rb'

def main
  no_changes!
  FileUtils.rm(Dir[File.join('go/gitalypb/*.pb.go')])
  run!(%w[make pb-go-stubs])
  run!(%w[_support/generate-from-proto])
  no_changes!
  puts 'OK! The gRPC / Protobuf clients are up-to-date'
end

def no_changes!
  changes = capture!(%w[git status --porcelain]).chomp.lines
  # _support/Gemfile.lock might change due to the CI Bundler version. Ignore all of _support.
  changes = changes.reject { |l| l =~ /^.. _support/ }

  if changes.any?
    puts changes
    run!(%w[git diff])
    abort 'error: detected changes'
  end
end

main