Files
Stirling-PDF/settings.gradle
T
Anthony Stirling 83e5319661 Reduce CI cost: disable Depot, gate arm64/Tauri PR builds, self-testing CI routing (#7028)
## What

CI cost/routing cleanup. Four changes, each reversible with no code
deleted.

### 1. Disable Depot repo-wide (reversible)
Depot ran on trusted (non-fork) triggers via the `is_fork` output of
`_runner-pick.yml`, driving both the `depot-*` runner selection and the
Depot docker build actions. It's now disabled everywhere behind a single
kill-switch:

- `_runner-pick.yml` gains a dedicated `use_depot` output, forced
`false` via `DEPOT_ENABLED=false`. `is_fork` stays truthful for trust
gating (e.g. `build-enterprise` skipping on forks).
- All `runs-on:` and `USE_DEPOT:` expressions now key off `use_depot`,
so every job falls back to `ubuntu-latest` + buildx.
- `settings.gradle` Depot remote build cache (`cache.depot.dev`) gated
behind `depotCacheEnabled = false`.

**Switch back on:** set `DEPOT_ENABLED=true` in `_runner-pick.yml` (and
`depotCacheEnabled = true` in `settings.gradle`). Depot then reactivates
on trusted triggers exactly as before.

### 2. arm64 PR docker build only on Dockerfile changes
`test-build-docker.yml` was building `linux/amd64,linux/arm64/v8` on
every PR matching the broad `project` filter. With Depot off, the arm64
leg runs under slow QEMU emulation on every code PR. New `dockerfiles`
path filter (`docker/**/Dockerfile*`) gates the arm64 leg: normal code
PRs build amd64 only; PRs that touch a Dockerfile still build amd64 +
arm64. arm64 is still fully exercised on the base-image publish and on
release.

### 3. Tauri PR build -> Linux only, unsigned, deb-only
The PR path built the full 3-OS matrix (Windows + macOS-universal +
Linux), plus the flaky Linux AppImage pass (#6127). PRs now build Linux
only (fastest + cheapest to compile) via a new `minimal` input on
`tauri-build.yml`: Linux deb only, no rpm, no AppImage. The full signed
multi-OS matrix still runs on release, and nightly still warms the Rust
cache with all-OS defaults (unchanged).

Tradeoff: Windows/macOS desktop build breaks are caught by nightly
(all-OS) rather than the introducing PR.

### 4. CI self-testing routing
Editing `build.yml` only matched the `project` filter, so a change to
how e2e / enterprise / tauri / engine jobs are dispatched didn't
actually run those jobs. Added a `ci` anchor (`build.yml` +
`.github/config/.files.yaml`) that every job-gating area filter now
includes, so editing the router or the filter config runs every job.
Also added the orphaned reusable workflows (`e2e-*`,
`frontend-validation`, `docker-compose-tests`, `test-build-docker`,
`check-openapi`, `check-licence`) to their area filters so editing a
reusable workflow self-tests.

## Validation
- All workflow YAML + `.files.yaml` parse; anchor resolution verified
(every job-gating filter resolves to include the `ci` paths).
- Gradle evaluates `settings.gradle` cleanly; `spotlessGradleCheck`
passes.
2026-07-15 14:49:06 +00:00

124 lines
4.0 KiB
Groovy

pluginManagement {
repositories {
var gradlePluginPortalUrl = System.getenv("MAVEN_PUBLIC_URL") ?: ""
if (!gradlePluginPortalUrl.isEmpty()){
maven {
url gradlePluginPortalUrl + "/gradle"
credentials(PasswordCredentials) {
username System.getenv('MAVEN_USER') ?: ""
password System.getenv('MAVEN_PASSWORD') ?: ""
}
authentication {
basic(BasicAuthentication)
}
allowInsecureProtocol true
}
}
gradlePluginPortal()
}
}
plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
// Depot remote build cache. Disabled repo-wide via depotCacheEnabled below;
// flip it back to true to re-enable. Even when enabled it silently no-ops
// without DEPOT_TOKEN (local dev without depot login, and fork PRs where
// GitHub hides secrets), so contributors build fine on local cache only.
buildCache {
def depotCacheEnabled = false
def depotToken = System.getenv('DEPOT_TOKEN')
local {
enabled = true
}
if (depotCacheEnabled && depotToken) {
remote(HttpBuildCache) {
url = 'https://cache.depot.dev'
enabled = true
// Only CI runs push to the shared cache; dev laptops pull-only
// so a misconfigured local task can't poison everyone else.
push = System.getenv('CI') == 'true'
credentials {
username = ''
password = depotToken
}
}
}
}
rootProject.name = 'Stirling PDF'
// Flavors: core | proprietary (default) | saas.
// Selectable via STIRLING_FLAVOR or by setting DISABLE_ADDITIONAL_FEATURES/ENABLE_SAAS directly.
// Accepts env var, -D system property, or -P gradle property (camelCase alias too).
def lookupEnvOrProperty = { String name ->
def value = System.getenv(name)
if (value == null || value.isEmpty()) {
value = System.getProperty(name)
}
if (value == null || value.isEmpty()) {
def projectProps = settings.startParameter.projectProperties
value = projectProps.get(name)
if (value == null || value.isEmpty()) {
def camel = name.toLowerCase().split('_').inject('') { acc, part ->
acc.isEmpty() ? part : acc + part.capitalize()
}
value = projectProps.get(camel)
}
}
return value
}
def asBool = { String value -> 'true'.equalsIgnoreCase(value) }
def stirlingFlavor = lookupEnvOrProperty('STIRLING_FLAVOR')?.toLowerCase()
boolean disableAdditional
boolean enableSaas
if (stirlingFlavor != null && !stirlingFlavor.isEmpty()) {
switch (stirlingFlavor) {
case 'core':
disableAdditional = true
enableSaas = false
break
case 'proprietary':
disableAdditional = false
enableSaas = false
break
case 'saas':
disableAdditional = false
enableSaas = true
break
default:
throw new GradleException(
"Unknown STIRLING_FLAVOR='${stirlingFlavor}'. Expected one of: core, proprietary, saas.")
}
} else {
disableAdditional = asBool(lookupEnvOrProperty('DISABLE_ADDITIONAL_FEATURES'))
enableSaas = asBool(lookupEnvOrProperty('ENABLE_SAAS'))
}
if (enableSaas && disableAdditional) {
throw new GradleException(
"ENABLE_SAAS=true requires DISABLE_ADDITIONAL_FEATURES=false " +
"(SaaS builds on top of :proprietary and cannot stand alone).")
}
gradle.ext.disableAdditional = disableAdditional
gradle.ext.enableSaas = enableSaas
include 'stirling-pdf', 'common', 'proprietary'
project(':stirling-pdf').projectDir = file('app/core')
project(':common' ).projectDir = file('app/common')
project(':proprietary' ).projectDir = file('app/proprietary')
if (enableSaas) {
include 'saas'
project(':saas').projectDir = file('app/saas')
}