Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Group repository checks by capability

Manav Rathi62995b7841bc
diff --git a/.github/scripts/change-approval.mjs b/.github/checks/change-approval/check.mjs
similarity index 99%
rename from .github/scripts/change-approval.mjs
rename to .github/checks/change-approval/check.mjs
index b09e6d4b36..c4d217e7e8 100644
--- a/.github/scripts/change-approval.mjs
+++ b/.github/checks/change-approval/check.mjs
@@ -8,8 +8,11 @@ const routineBinary = (file) =>
/\.(png|jpe?g|webp|gif|ico|icns|ttf|otf|woff2?|riv|mp3)$/i.test(file) || file.includes("Assets.xcassets/");
const guardrailDirs = [
".github/",
+ "mobile/checks/",
"mobile/scripts/",
+ "rust/checks/",
"rust/scripts/",
+ "web/checks/",
"web/scripts/",
"server/scripts/",
"web/packages/build-config/",
diff --git a/.github/scripts/change-approval.test.mjs b/.github/checks/change-approval/test.mjs
similarity index 96%
rename from .github/scripts/change-approval.test.mjs
rename to .github/checks/change-approval/test.mjs
index acf7a08246..99211a5670 100644
--- a/.github/scripts/change-approval.test.mjs
+++ b/.github/checks/change-approval/test.mjs
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import test from "node:test";
-const script = join(import.meta.dirname, "change-approval.mjs");
+const script = join(import.meta.dirname, "check.mjs");
const env = {
PATH: process.env.PATH,
GIT_CONFIG_GLOBAL: "/dev/null",
@@ -334,17 +334,27 @@ test("go.sum new module", (t) => {
test("guardrail paths modified or deleted, not added", (t) => {
const output = scan(
t,
- { ".github/scripts/x.mjs": "", ".github/workflows/x.yml": "on: push\n", "web/apps/x/eslint.config.mjs": "" },
+ {
+ ".github/scripts/x.mjs": "",
+ ".github/workflows/x.yml": "on: push\n",
+ "mobile/checks/x/check.rb": "",
+ "rust/checks/x/check.py": "",
+ "web/apps/x/eslint.config.mjs": "",
+ "web/checks/x/check.mjs": "",
+ },
{
".github/scripts/x.mjs": "export {};\n",
".github/workflows/x.yml": "on: pull_request\n",
+ "mobile/checks/x/check.rb": "\n",
+ "rust/checks/x/check.py": "\n",
"web/apps/x/eslint.config.mjs": null,
+ "web/checks/x/check.mjs": "\n",
".github/CODEOWNERS": "",
},
);
assert.equal(
output,
- "3 guardrail files\n\n## Guardrail changes\n\n- `.github/scripts/x.mjs`\n- `.github/workflows/x.yml`\n- `web/apps/x/eslint.config.mjs`\n\n",
+ "6 guardrail files\n\n## Guardrail changes\n\n- `.github/scripts/x.mjs`\n- `.github/workflows/x.yml`\n- `mobile/checks/x/check.rb`\n- `rust/checks/x/check.py`\n- `web/apps/x/eslint.config.mjs`\n- `web/checks/x/check.mjs`\n\n",
);
});
diff --git a/.github/scripts/check_workflow_security.rb b/.github/checks/workflow-security/check.rb
similarity index 100%
rename from .github/scripts/check_workflow_security.rb
rename to .github/checks/workflow-security/check.rb
diff --git a/.github/workflows/change-approval.yml b/.github/workflows/change-approval.yml
index 138b2e0be5..82af1d165a 100644
--- a/.github/workflows/change-approval.yml
+++ b/.github/workflows/change-approval.yml
@@ -17,7 +17,7 @@ jobs:
- name: Checkout PR
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- - run: node --test .github/scripts/change-approval.test.mjs
+ - run: node --test .github/checks/change-approval/test.mjs
detect:
runs-on: ubuntu-latest
@@ -34,14 +34,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.base.sha }}
path: trusted
- sparse-checkout: .github/scripts/change-approval.mjs
+ sparse-checkout: .github/checks/change-approval/check.mjs
sparse-checkout-cone-mode: false
- name: Scan changes
id: scan
- run: node "$scanner" ${{ github.event.pull_request.base.sha }}
- env:
- scanner: ${{ hashFiles('trusted/.github/scripts/change-approval.mjs') && 'trusted/.github/scripts/change-approval.mjs' || '.github/scripts/change-approval.mjs' }}
+ run: node trusted/.github/checks/change-approval/check.mjs ${{ github.event.pull_request.base.sha }}
approve:
needs: detect
diff --git a/.github/workflows/mobile-lint.yml b/.github/workflows/mobile-lint.yml
index 29cdbf781f..0380be67b3 100644
--- a/.github/workflows/mobile-lint.yml
+++ b/.github/workflows/mobile-lint.yml
@@ -33,10 +33,10 @@ jobs:
submodules: recursive
- name: Verify frozen mobile pubspecs
- run: ruby mobile/scripts/check_frozen_pubspecs.rb mobile
+ run: ruby mobile/checks/frozen-pubspecs/check.rb mobile
- name: Verify source ARB plurals
- run: ruby mobile/scripts/check_source_arb_plurals.rb
+ run: ruby mobile/checks/source-arb-plurals/check.rb
- name: Verify auth custom icons
run: |
diff --git a/.github/workflows/workflow-security-checks.yml b/.github/workflows/workflow-security-checks.yml
index c51f0438b2..ae6767b537 100644
--- a/.github/workflows/workflow-security-checks.yml
+++ b/.github/workflows/workflow-security-checks.yml
@@ -5,7 +5,7 @@ on:
paths:
- '.github/workflows/**'
- '.github/actions/**'
- - '.github/scripts/check_workflow_security.rb'
+ - '.github/checks/workflow-security/**'
permissions:
contents: read
@@ -25,8 +25,8 @@ jobs:
with:
ref: ${{ github.event.pull_request.base.sha }}
path: trusted
- sparse-checkout: .github/scripts/check_workflow_security.rb
+ sparse-checkout: .github/checks/workflow-security/check.rb
sparse-checkout-cone-mode: false
- name: Run workflow security checks
- run: ruby trusted/.github/scripts/check_workflow_security.rb
+ run: ruby trusted/.github/checks/workflow-security/check.rb
diff --git a/mobile/scripts/check_frozen_pubspecs.rb b/mobile/checks/frozen-pubspecs/check.rb
similarity index 100%
rename from mobile/scripts/check_frozen_pubspecs.rb
rename to mobile/checks/frozen-pubspecs/check.rb
diff --git a/mobile/scripts/check_source_arb_plurals.rb b/mobile/checks/source-arb-plurals/check.rb
similarity index 96%
rename from mobile/scripts/check_source_arb_plurals.rb
rename to mobile/checks/source-arb-plurals/check.rb
index ef2769233b..301cd1ab2f 100644
--- a/mobile/scripts/check_source_arb_plurals.rb
+++ b/mobile/checks/source-arb-plurals/check.rb
@@ -3,7 +3,7 @@
require "json"
require "yaml"
-MOBILE_ROOT = File.expand_path("..", __dir__)
+MOBILE_ROOT = File.expand_path("../..", __dir__)
EXACT_ONE_SELECTOR = /=1\s*\{/.freeze
def source_arbs
diff --git a/rust/scripts/cargo-versions/check.py b/rust/checks/cargo-versions/check.py
similarity index 100%
rename from rust/scripts/cargo-versions/check.py
rename to rust/checks/cargo-versions/check.py
diff --git a/rust/scripts/cargo-versions/test.py b/rust/checks/cargo-versions/test.py
similarity index 100%
rename from rust/scripts/cargo-versions/test.py
rename to rust/checks/cargo-versions/test.py
diff --git a/rust/scripts/cargo-workspace-dependencies/check.py b/rust/checks/cargo-workspace-dependencies/check.py
similarity index 100%
rename from rust/scripts/cargo-workspace-dependencies/check.py
rename to rust/checks/cargo-workspace-dependencies/check.py
diff --git a/rust/scripts/cargo-workspace-dependencies/test.py b/rust/checks/cargo-workspace-dependencies/test.py
similarity index 100%
rename from rust/scripts/cargo-workspace-dependencies/test.py
rename to rust/checks/cargo-workspace-dependencies/test.py
diff --git a/rust/scripts/lint.sh b/rust/scripts/lint.sh
index ca0fc2494f..16f93233c7 100755
--- a/rust/scripts/lint.sh
+++ b/rust/scripts/lint.sh
@@ -4,10 +4,10 @@ set -euo pipefail
cd "$(dirname "$0")/.."
export RUSTFLAGS="-D warnings"
-python3 scripts/cargo-versions/check.py ..
-python3 scripts/cargo-versions/test.py
-python3 scripts/cargo-workspace-dependencies/check.py ..
-python3 scripts/cargo-workspace-dependencies/test.py
+python3 checks/cargo-versions/check.py ..
+python3 checks/cargo-versions/test.py
+python3 checks/cargo-workspace-dependencies/check.py ..
+python3 checks/cargo-workspace-dependencies/test.py
cargo fmt --check
cargo clippy --locked --all-targets --features museum,ente-ml/ml-assets
cargo audit
diff --git a/web/scripts/wasm-imports/entrypoints.mjs b/web/checks/wasm-imports/entrypoints.mjs
similarity index 100%
rename from web/scripts/wasm-imports/entrypoints.mjs
rename to web/checks/wasm-imports/entrypoints.mjs
diff --git a/web/scripts/wasm-imports/eslint.config.mjs b/web/checks/wasm-imports/eslint.config.mjs
similarity index 100%
rename from web/scripts/wasm-imports/eslint.config.mjs
rename to web/checks/wasm-imports/eslint.config.mjs
diff --git a/web/scripts/wasm-imports/test.mjs b/web/checks/wasm-imports/test.mjs
similarity index 100%
rename from web/scripts/wasm-imports/test.mjs
rename to web/checks/wasm-imports/test.mjs
diff --git a/web/package.json b/web/package.json
index 3bee38bffc..65ab375937 100644
--- a/web/package.json
+++ b/web/package.json
@@ -33,7 +33,7 @@
"build:space-wasm": "npm run build --workspace ente-space-wasm",
"build:twoof3": "npm exec --workspace twoof3 -- next build --webpack",
"build:wasm": "npm run build:core-wasm && npm run build:cast-wasm && npm run build:ensu-wasm && npm run build:legacy-wasm && npm run build:locker-wasm && npm run build:paste-wasm && npm run build:photos-wasm && npm run build:space-wasm",
- "check:wasm-imports": "eslint --config scripts/wasm-imports/eslint.config.mjs --parser @typescript-eslint/parser --no-inline-config --max-warnings 0 apps packages && node scripts/wasm-imports/entrypoints.mjs && node --test scripts/wasm-imports/test.mjs",
+ "check:wasm-imports": "eslint --config checks/wasm-imports/eslint.config.mjs --parser @typescript-eslint/parser --no-inline-config --max-warnings 0 apps packages && node checks/wasm-imports/entrypoints.mjs && node --test checks/wasm-imports/test.mjs",
"dev": "npm run dev:photos",
"dev:accounts": "npm run build:core-wasm && npm exec --workspace accounts -- next dev --webpack -p 3001",
"dev:albums": "npm run build:core-wasm && npm exec --workspace albums -- next dev --webpack -p 3002",