Skip to content

Commit

Permalink
test: Check that all toktok-stack modules are in settings.yaml.
Browse files Browse the repository at this point in the history
Also added some dependabot PR labels.
  • Loading branch information
iphydf committed Nov 11, 2024
1 parent e34e7e9 commit 9127c65
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
15 changes: 15 additions & 0 deletions admin/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
],
)
43 changes: 43 additions & 0 deletions admin/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ _common:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"

# GitHub Issue/PR labels.
labels: &labels
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -190,6 +199,7 @@ _common:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"

btox:
editRepo:
Expand Down Expand Up @@ -217,6 +227,7 @@ btox:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "analyze"
- "android-build"
Expand Down Expand Up @@ -248,6 +259,9 @@ ci-tools:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "checks / check-release"

c-toxcore:
editRepo:
Expand Down Expand Up @@ -296,6 +310,7 @@ c-toxcore:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "CodeFactor"
- "analysis (autotools)"
Expand Down Expand Up @@ -361,6 +376,7 @@ c-toxcore-hs:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"

Expand All @@ -384,6 +400,7 @@ dockerfiles:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "build (alpine-s390x)"
- "build (bazel)"
Expand Down Expand Up @@ -438,6 +455,7 @@ go-toxcore-c:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"

Expand All @@ -461,6 +479,7 @@ hs-apigen:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -486,6 +505,7 @@ hs-cimple:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -511,6 +531,7 @@ hs-github-tools:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -536,6 +557,7 @@ hs-happy-arbitrary:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -561,6 +583,7 @@ hs-msgpack-arbitrary:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -587,6 +610,7 @@ hs-msgpack-binary:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -612,6 +636,7 @@ hs-msgpack-json:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -637,6 +662,7 @@ hs-msgpack-rpc-conduit:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -663,6 +689,7 @@ hs-msgpack-testsuite:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -688,6 +715,7 @@ hs-msgpack-types:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -713,6 +741,7 @@ hs-schema:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -738,6 +767,7 @@ hs-tokstyle:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -763,6 +793,7 @@ hs-toxcore-c:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build / stack"
Expand All @@ -789,6 +820,7 @@ hs-toxcore:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "android-aarch64"
- "android-arm"
Expand Down Expand Up @@ -823,6 +855,7 @@ hs-toxcore:
# - "code-review/reviewable"
# - "common / buildifier"
# - "common / restyled"
# - "release / update_release_draft"
# # Custom
# - "bazel-opt"
# - "build / stack"
Expand All @@ -849,6 +882,7 @@ js-toxcore-c:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "DeepScan"
- "Hound"
Expand Down Expand Up @@ -880,6 +914,7 @@ jvm-toxcore-c:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "CodeFactor"
- "bazel-opt"
Expand Down Expand Up @@ -911,6 +946,7 @@ py-toxcore-c:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"
- "build_linux"
Expand All @@ -937,6 +973,7 @@ qTox:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"

spec:
editRepo:
Expand All @@ -959,6 +996,7 @@ spec:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"

toktok-stack:
editRepo:
Expand All @@ -980,6 +1018,7 @@ toktok-stack:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "docker-haskell"
- "docker-test"
Expand All @@ -1006,6 +1045,7 @@ toxic:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "build"
- "build-static"
Expand Down Expand Up @@ -1033,6 +1073,7 @@ toxins:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "bazel-opt"

Expand All @@ -1056,6 +1097,7 @@ website:
- "code-review/reviewable"
- "common / buildifier"
- "common / restyled"
- "release / update_release_draft"
# Custom
- "Hound"
- "docker"
Expand Down Expand Up @@ -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)"
Expand Down
43 changes: 43 additions & 0 deletions admin/settings_test.pl
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 9127c65

Please sign in to comment.