From 9127c6506c3c32beedd37a69a327bdd61ebae8b6 Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 11 Nov 2024 16:45:17 +0000 Subject: [PATCH] test: Check that all toktok-stack modules are in settings.yaml. Also added some dependabot PR labels. --- admin/BUILD.bazel | 15 +++++++++++++++ admin/settings.yaml | 43 ++++++++++++++++++++++++++++++++++++++++++ admin/settings_test.pl | 43 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 admin/BUILD.bazel create mode 100644 admin/settings_test.pl diff --git a/admin/BUILD.bazel b/admin/BUILD.bazel new file mode 100644 index 0000000..fd3d92b --- /dev/null +++ b/admin/BUILD.bazel @@ -0,0 +1,15 @@ +sh_test( + name = "settings_test", + size = "small", + srcs = ["@perl"], + args = [ + "$(location settings_test.pl)", + "$(location //:.gitmodules)", + "$(location settings.yaml)", + ], + data = [ + "settings.yaml", + "settings_test.pl", + "//:.gitmodules", + ], +) diff --git a/admin/settings.yaml b/admin/settings.yaml index 4bdb9f9..c27032b 100644 --- a/admin/settings.yaml +++ b/admin/settings.yaml @@ -41,6 +41,7 @@ _common: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # GitHub Issue/PR labels. labels: &labels @@ -94,6 +95,14 @@ _common: color: "0e8a16" description: "Adding missing tests, refactoring tests; no production code change" + "go": + color: "16e2e2" + description: "Pull requests that update Go code" + + "submodules": + color: "000000" + description: "Pull requests that update Submodules code" + ############################################################################# # # :: Bug labels @@ -190,6 +199,7 @@ _common: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" btox: editRepo: @@ -217,6 +227,7 @@ btox: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "analyze" - "android-build" @@ -248,6 +259,9 @@ ci-tools: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" + # Custom + - "checks / check-release" c-toxcore: editRepo: @@ -296,6 +310,7 @@ c-toxcore: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "CodeFactor" - "analysis (autotools)" @@ -361,6 +376,7 @@ c-toxcore-hs: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" @@ -384,6 +400,7 @@ dockerfiles: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "build (alpine-s390x)" - "build (bazel)" @@ -438,6 +455,7 @@ go-toxcore-c: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" @@ -461,6 +479,7 @@ hs-apigen: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -486,6 +505,7 @@ hs-cimple: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -511,6 +531,7 @@ hs-github-tools: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -536,6 +557,7 @@ hs-happy-arbitrary: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -561,6 +583,7 @@ hs-msgpack-arbitrary: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -587,6 +610,7 @@ hs-msgpack-binary: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -612,6 +636,7 @@ hs-msgpack-json: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -637,6 +662,7 @@ hs-msgpack-rpc-conduit: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -663,6 +689,7 @@ hs-msgpack-testsuite: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -688,6 +715,7 @@ hs-msgpack-types: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -713,6 +741,7 @@ hs-schema: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -738,6 +767,7 @@ hs-tokstyle: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -763,6 +793,7 @@ hs-toxcore-c: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build / stack" @@ -789,6 +820,7 @@ hs-toxcore: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "android-aarch64" - "android-arm" @@ -823,6 +855,7 @@ hs-toxcore: # - "code-review/reviewable" # - "common / buildifier" # - "common / restyled" +# - "release / update_release_draft" # # Custom # - "bazel-opt" # - "build / stack" @@ -849,6 +882,7 @@ js-toxcore-c: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "DeepScan" - "Hound" @@ -880,6 +914,7 @@ jvm-toxcore-c: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "CodeFactor" - "bazel-opt" @@ -911,6 +946,7 @@ py-toxcore-c: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" - "build_linux" @@ -937,6 +973,7 @@ qTox: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" spec: editRepo: @@ -959,6 +996,7 @@ spec: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" toktok-stack: editRepo: @@ -980,6 +1018,7 @@ toktok-stack: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "docker-haskell" - "docker-test" @@ -1006,6 +1045,7 @@ toxic: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "build" - "build-static" @@ -1033,6 +1073,7 @@ toxins: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "bazel-opt" @@ -1056,6 +1097,7 @@ website: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "Hound" - "docker" @@ -1085,6 +1127,7 @@ zig-toxcore-c: - "code-review/reviewable" - "common / buildifier" - "common / restyled" + - "release / update_release_draft" # Custom - "test (ubuntu-latest)" - "test (macos-latest)" diff --git a/admin/settings_test.pl b/admin/settings_test.pl new file mode 100644 index 0000000..695b503 --- /dev/null +++ b/admin/settings_test.pl @@ -0,0 +1,43 @@ +#!/usr/bin/env perl + +use strict; +use warnings FATAL => 'all'; + +my ($GITMODULES, $SETTINGS) = @ARGV; + +sub read_file { + my $file = shift; + open my $fh, '<', $file or die "Could not open $file: $!"; + my @lines = <$fh>; + return @lines; +} + +my @gitmodules = read_file($GITMODULES); # .gitmodules +my @settings = read_file($SETTINGS); # settings.yaml + +my @git_modules = map { m!\turl = https://github.com/TokTok/([^/]+)\n! ? lc $1 : () } @gitmodules; +my @settings_modules = map { m!^ name: "?([^"]+)"?\n! ? lc $1 : () } @settings; + +# This is the container, so isn't in .gitmodules. +push @git_modules, 'toktok-stack'; + +# Not in settings.yaml because this is just a storage repo. +# We don't need checks for it. +push @settings_modules, 'toktok-fuzzer'; + +my $ok = 1; +for my $module (@settings_modules) { + if (!grep { $_ eq $module } @git_modules) { + print "Module $module is in settings.yaml but not in .gitmodules\n"; + $ok = 0; + } +} + +for my $module (@git_modules) { + if (!grep { $_ eq $module } @settings_modules) { + print "Module $module is in .gitmodules but not in settings.yaml\n"; + $ok = 0; + } +} + +exit !$ok;