From d2e6c8614093900645fe69863d2d96d3e0a6f49f Mon Sep 17 00:00:00 2001 From: Ben Henning Date: Wed, 13 Jan 2021 20:33:24 -0800 Subject: [PATCH] CODEOWNERS CI validation + pattern fixes (#2474) * Another try at fixing layout file ownership + CI It seems the previous layout pattern wasn't actually matching to @rt4914. I'm hoping the adjustment fixes the issue. Also, I'm going to try removing my global ownership & instead rely on a CI check to verify that new files that aren't owned are properly checked (https://github.com/mszostok/codeowners-validator). * Create static_checks.yml Create new workflow for static analysis checks (eventually we can move our linter checks to these to keep our tests in separate, dedicated workflows). * Update static_checks.yml Check out the repository before testing CODEOWNERS. * Update main.yml Temporarily disable other CI actions to avoid noise while the static checks workflow is debugged. * Update CODEOWNERS Remove extra & incorrect 'res' from resource file path. * Update CODEOWNERS Add files missing corresponding code owners, and try to blanket cover resources from all modules. * Update CODEOWNERS Use more specific resource file patterns since Git/GitHub doesn't like the more generic version. * Update CODEOWNERS Remove redundant lines (since presumably they aren't actually having the desired effect). * Update CODEOWNERS Fix incorrect patterns (thanks to CI check!). * Update CODEOWNERS Try adding invalid syntax to trigger a specific CI validation failure. * Update CODEOWNERS Remove intentional syntax error. * Create random_file Add random file to verify that CI checks catch this file doesn't have corresponding owners. * Delete random_file Test completed. * Update main.yml Re-enable main workflows now that the static checks workflow is finalized. * Update CODEOWNERS Move PNG file codeowners to me since they count as binary files and we want to avoid checking those into the root repository as much as possible. --- .github/CODEOWNERS | 46 +++++++++++++---------------- .github/workflows/static_checks.yml | 22 ++++++++++++++ 2 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/static_checks.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f8172dfdf16..54596a3ba2a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -23,17 +23,13 @@ # Blanket ownership # ##################################################################################### -# Global ownership (only for cases when new files are added & no other matches occur). -* @BenHenning - # Codeowners ownership (for adding/changing/removing code owners). .github/CODEOWNERS @oppia/owners # Bazel build files. -/WORKSPACE @BenHenning +WORKSPACE @BenHenning *.bzl @BenHenning *.bazel @BenHenning -BUILD @BenHenning .bazelrc @BenHenning /tools/android/ @BenHenning @@ -56,24 +52,34 @@ gradlew.bat @BenHenning *Test.kt @anandwana001 # All resource files. -**/res/*.xml @rt4914 +/app/src/main/res/**/*.xml @rt4914 +/utility/src/main/res/**/*.xml @rt4914 -# Proguard configurations. +# Proguard configuration. *.pro @BenHenning # Lesson assets. /domain/src/main/assets/ @BenHenning @rt4914 -# Android manifests. +# Android manifests and top-level app configuration. *Manifest.xml @BenHenning -# Linter configurations. +# Linter configuration. buf.yaml @anandwana001 # IDEA IDE configuration. .editorconfig @BenHenning /.idea/ @BenHenning +# Robolectric configuration. +*.properties @BenHenning + +# Firebase configuration. +/app/google-services.json @BenHenning + +# Binary files. +*.png @BenHenning + # Important codebase files. LICENSE @BenHenning @@ -89,7 +95,7 @@ LICENSE @BenHenning /app/src/*/java/org/oppia/android/app/player/ @BenHenning # Bindable adapter utilities. -/app/src/main/java/org/oppia/android/app/recyclerview/BindableAdapter.java @BenHenning +/app/src/main/java/org/oppia/android/app/recyclerview/BindableAdapter.kt @BenHenning /app/src/main/java/org/oppia/android/app/recyclerview/RecyclerViewBindingAdapter.java @BenHenning /app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt @BenHenning @@ -126,7 +132,6 @@ LICENSE @BenHenning # Global domain module code ownership. /domain/**/*.kt @BenHenning -/domain/**/*.java @BenHenning # Questions support. /domain/src/*/java/org/oppia/android/domain/question/ @vinitamurthi @@ -138,13 +143,8 @@ LICENSE @BenHenning # testing module # ##################################################################################### -# Global testing module code ownership (secondary). -/testing/**/*.kt @anandwana001 -/testing/**/*.java @anandwana001 - -# Global testing module code ownership (primary). -/testing/**/*.kt @BenHenning -/testing/**/*.java @BenHenning +# Global testing module code ownership. +/testing/**/*.kt @anandwana001 @BenHenning ##################################################################################### # data module # @@ -152,7 +152,7 @@ LICENSE @BenHenning # Global data module code ownership. /data/**/*.kt @BenHenning -/data/**/*.java @BenHenning +/data/src/test/**/*.json @BenHenning ##################################################################################### # utility module # @@ -160,7 +160,6 @@ LICENSE @BenHenning # Global utility module code ownership. /utility/**/*.kt @BenHenning -/utility/**/*.java @BenHenning # Accessibility utilities. /utility/src/*/java/org/oppia/android/util/accessibility/ @rt4914 @@ -185,8 +184,5 @@ LICENSE @BenHenning # Global proto file ownership (for protos outside the model directory since all protos should belong in models). *.proto @BenHenning @vinitamurthi -# Global model ownership (secondary). -/model/ @vinitamurthi - -# Global model ownership (primary). -/model/ @BenHenning +# Global model ownership. +/model/ @vinitamurthi @BenHenning diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml new file mode 100644 index 00000000000..8c0023fa263 --- /dev/null +++ b/.github/workflows/static_checks.yml @@ -0,0 +1,22 @@ +# Contains jobs corresponding to static checks (such as syntax correctness & prohibited patterns). + +name: Static Checks + +on: + workflow_dispatch: + pull_request: + push: + branches: + - develop + +jobs: + check_codeowners: + name: Check CODEOWNERS & Repository files + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - uses: mszostok/codeowners-validator@v0.5.1 + with: + checks: "duppatterns,files,syntax" + experimental_checks: "notowned"