Skip to content

Commit 51f9400

Browse files
committed
chore: add a presubmit that checks for librarian config consistency
Currently we're using librarian for generation and legacylibrarian for releasing. This check makes sure that the relevant aspects of the two configurations (which libraries are configured, their versions, and whether releases are blocked) are consistent. This commit also ensures that we're starting from a consistent state.
1 parent 3997a10 commit 51f9400

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: check that Librarian and legacylibrarian configs are consistent
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
permissions:
8+
contents: read
9+
jobs:
10+
config-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
# Use this action, rather than a file filter so that we can make this
15+
# mandatory.
16+
# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-including-branches
17+
# for more details.
18+
- uses: dorny/paths-filter@v4
19+
id: filter
20+
with:
21+
filters: |
22+
librarian:
23+
- 'librarian.yaml'
24+
- '.librarian/config.yaml'
25+
- '.librarian/state.yaml'
26+
- name: Config check
27+
if: steps.filter.outputs.librarian == 'true'
28+
run: |
29+
V="$(sed -n 's/^version: *//p' librarian.yaml)"
30+
go run "github.com/googleapis/librarian/tool/cmd/configcheck@${V}" .
31+
- name: Update library versions and regenerate
32+
if: failure()
33+
run: |
34+
echo "Library configuration is different between state.yaml and librarian.yaml.
35+
Update library configuration in the configs according to the error message and
36+
regenerate libraries using:
37+
38+
V=\$(sed -n 's/^version: *//p' librarian.yaml)
39+
go run github.com/googleapis/librarian/cmd/librarian@\${V} generate --all
40+
"

librarian.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ default:
5555
libraries:
5656
- name: bigframes
5757
version: 2.39.0
58+
skip_release: true
5859
python:
5960
library_type: INTEGRATION
6061
- name: bigquery-magics
@@ -1933,6 +1934,7 @@ libraries:
19331934
version: 3.10.1
19341935
apis:
19351936
- path: google/storage/v2
1937+
skip_release: true
19361938
python:
19371939
library_type: GAPIC_MANUAL
19381940
opt_args_by_api:
@@ -2194,6 +2196,7 @@ libraries:
21942196
default_version: v1
21952197
- name: google-crc32c
21962198
version: 1.8.0
2199+
skip_release: true
21972200
python:
21982201
library_type: OTHER
21992202
- name: google-geo-type

0 commit comments

Comments
 (0)