Add CI job to check protobuf files are up-to-date

This commit is contained in:
Edouard Oger 2020-04-08 15:50:41 -04:00
Родитель 3f5f66d68f
Коммит f08b3703bc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A2F740742307674A
2 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -253,6 +253,13 @@ jobs:
- run: cargo clippy --version
- run: bash automation/all_clippy_checks.sh
- save-sccache-cache
Check Protobuf files are up-to-date:
docker:
- image: circleci/rust:latest
resource_class: small
steps:
- checkout
- run: ./automation/check_protobuf_files_current.py
Lint Bash scripts:
docker:
- image: koalaman/shellcheck-alpine:stable
@ -449,6 +456,9 @@ workflows:
clippy:
jobs:
- Lint Rust with clippy
check-protobuf-uptodate:
jobs:
- Check Protobuf files are up-to-date
check-dependencies:
jobs:
- Check Rust dependencies

Просмотреть файл

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# Purpose: Run cargo update and make a pull-request against master.
# Dependencies: None
# Usage: ./automation/cargo-update-pr.py
from shared import step_msg, fatal_err, run_cmd_checked, find_app_services_root, ensure_working_tree_clean
step_msg("Checking that the generated protobuf Rust files are up-to-date")
# ensure_working_tree_clean()
config_file_path = find_app_services_root() / "tools/protobuf_files.toml"
run_cmd_checked(["cargo", "run", "--bin", "protobuf-gen", config_file_path])
if run_cmd_checked(["git", "status", "--porcelain"], capture_output=True).stdout:
run_cmd_checked(["git", "status"])
fatal_err("""
The protobuf rust files are outdated.
You can fix this yourself by running cargo run --bin protobuf-gen <APP_SERVICES_ROOT>/tools/protobuf_files.toml
""")