Skip to content

Commit 70556cb

Browse files
chore(renovate): isolate Themerr Jellyfin compatibility policy (#951)
1 parent 2d7c517 commit 70556cb

4 files changed

Lines changed: 227 additions & 2 deletions

File tree

‎.github/workflows/__validate-renovate-config.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Find additional files
2828
id: find-files
2929
run: |
30-
files=$(find . -type f -iname "renovate*.json*")
30+
files=$(find . -type f \( -iname "renovate*.json*" -o -ipath "./renovate/*.json*" \))
3131
3232
echo "found files: $files"
3333

‎renovate-config.json5‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"group:recommended",
4242
":semanticCommits",
4343
":semanticCommitTypeAll(chore)",
44+
"github>LizardByte/.github//renovate/themerr.json5",
4445
],
4546
"labels": [
4647
"dependencies",

‎renovate/themerr.json5‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"description": "Jellyfin compatibility policy for LizardByte/Themerr",
4+
"packageRules": [
5+
// Keep SDK and EF aligned with the supported minimum; raise that baseline deliberately.
6+
{
7+
"description": "Themerr Jellyfin SDK and EF baselines change only with the supported minimum.",
8+
"matchRepositories": [
9+
"LizardByte/Themerr",
10+
],
11+
"matchFileNames": [
12+
"connectors/**",
13+
"src/jellyfin/compatibility.props",
14+
],
15+
"matchPackageNames": [
16+
"Jellyfin.Controller",
17+
"Microsoft.EntityFrameworkCore.Sqlite",
18+
],
19+
"enabled": false,
20+
},
21+
{
22+
"description": "Themerr validates hotfixes within the previous Jellyfin compatibility series.",
23+
"matchRepositories": [
24+
"LizardByte/Themerr",
25+
],
26+
"matchFileNames": [
27+
"src/jellyfin/compatibility.props",
28+
],
29+
"matchPackageNames": [
30+
"jellyfin/jellyfin",
31+
],
32+
"matchCurrentValue": "/^10\\.11\\./",
33+
"allowedVersions": "/^10\\.11\\.[0-9]+$/",
34+
},
35+
{
36+
"description": "Themerr validates hotfixes within the current Jellyfin compatibility series.",
37+
"matchRepositories": [
38+
"LizardByte/Themerr",
39+
],
40+
"matchFileNames": [
41+
"src/jellyfin/compatibility.props",
42+
],
43+
"matchPackageNames": [
44+
"jellyfin/jellyfin",
45+
],
46+
"matchCurrentValue": "/^12\\./",
47+
"allowedVersions": "/^12\\.[0-9]+$/",
48+
},
49+
],
50+
// Update runtime validation targets without changing SDK or EF baselines.
51+
"customManagers": [
52+
{
53+
"customType": "regex",
54+
"description": "Update Themerr Jellyfin runtime validation targets",
55+
"managerFilePatterns": [
56+
"/^src/jellyfin/compatibility\\.props$/",
57+
],
58+
"matchStrings": [
59+
"<JellyfinLatestVersion>(?<currentValue>[^<]+)</JellyfinLatestVersion>",
60+
],
61+
"datasourceTemplate": "docker",
62+
"depNameTemplate": "jellyfin/jellyfin",
63+
"packageNameTemplate": "jellyfin/jellyfin",
64+
"versioningTemplate": "regex:^(?<major>[0-9]+)\\.(?<minor>[0-9]+)(?:\\.(?<patch>[0-9]+))?$",
65+
},
66+
],
67+
}

‎tests/renovate-config.test.mjs‎

Lines changed: 158 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import test from 'node:test';
55
import JSON5 from 'json5';
66
import {api as condaVersioning} from 'renovate/dist/modules/versioning/conda/index.js';
77
import {api as looseVersioning} from 'renovate/dist/modules/versioning/loose/index.js';
8+
import {get as getVersioning} from 'renovate/dist/modules/versioning/index.js';
89
import {extractPackageFile as extractCdnUrlPackageFile} from 'renovate/dist/modules/manager/cdnurl/index.js';
910
import {massageCustomDatasourceConfig} from 'renovate/dist/modules/datasource/custom/utils.js';
1011
import {extractPackageFile as extractRegexPackageFile} from 'renovate/dist/modules/manager/custom/regex/index.js';
@@ -13,8 +14,13 @@ import {getExpression} from 'renovate/dist/util/jsonata.js';
1314
import {compile} from 'renovate/dist/util/template/index.js';
1415
import {applyPackageRules} from 'renovate/dist/util/package-rules/index.js';
1516
import {filterVersions} from 'renovate/dist/workers/repository/process/lookup/filter.js';
17+
import {mergeChildConfig} from 'renovate/dist/config/utils.js';
18+
import {presetSources, resolveConfigPresets} from 'renovate/dist/config/presets/index.js';
19+
import {init as initPresetCache, set as setPresetCache} from 'renovate/dist/util/cache/memory/index.js';
1620

17-
const renovateConfig = JSON5.parse(fs.readFileSync('renovate-config.json5', 'utf8'));
21+
const mainConfig = JSON5.parse(fs.readFileSync('renovate-config.json5', 'utf8'));
22+
const themerrConfig = JSON5.parse(fs.readFileSync('renovate/themerr.json5', 'utf8'));
23+
const renovateConfig = mergeChildConfig(themerrConfig, mainConfig);
1824
const githubRefManager = renovateConfig.customManagers.find(
1925
manager => manager.description === 'Update annotated GitHub values and their jsDelivr commits',
2026
);
@@ -612,3 +618,154 @@ test('extracts cdnjs imports from asset stylesheets', () => {
612618
[['normalize', '3.0.1']],
613619
);
614620
});
621+
622+
623+
test('extracts Jellyfin runtime targets without updating Themerr SDK and EF baselines', () => {
624+
const manager = renovateConfig.customManagers.find(
625+
value => value.description === 'Update Themerr Jellyfin runtime validation targets',
626+
);
627+
const fileName = 'src/jellyfin/compatibility.props';
628+
assert.ok(matchesManagerFilePattern(fileName, manager.managerFilePatterns));
629+
assert.equal(matchesManagerFilePattern('connectors/jellyfin/Themerr.Connector.csproj', manager.managerFilePatterns), false);
630+
const content = `
631+
<Project>
632+
<JellyfinMinimumVersion>12.1.0</JellyfinMinimumVersion>
633+
<ConnectorEfCoreVersion>10.0.11</ConnectorEfCoreVersion>
634+
<JellyfinLatestVersion>10.11.11</JellyfinLatestVersion>
635+
<JellyfinLatestVersion>12.2</JellyfinLatestVersion>
636+
</Project>
637+
`;
638+
const dependencies = extractRegexPackageFile(content, fileName, manager).deps;
639+
assert.deepEqual(dependencies.map(value => value.currentValue), [
640+
'10.11.11',
641+
'12.2',
642+
]);
643+
assert.ok(dependencies.every(value => value.datasource === 'docker' && value.depName === 'jellyfin/jellyfin'
644+
&& value.packageName === 'jellyfin/jellyfin'));
645+
const updated = applyExtractedUpdate(content, dependencies[1], '12.3');
646+
assert.match(updated, /<JellyfinLatestVersion>12\.3<\/JellyfinLatestVersion>/);
647+
assert.match(updated, /<JellyfinMinimumVersion>12\.1\.0<\/JellyfinMinimumVersion>/);
648+
assert.match(updated, /<ConnectorEfCoreVersion>10\.0\.11<\/ConnectorEfCoreVersion>/);
649+
});
650+
651+
test('limits Themerr Jellyfin runtime updates to stable hotfixes in their series', async () => {
652+
const manager = renovateConfig.customManagers.find(
653+
value => value.description === 'Update Themerr Jellyfin runtime validation targets',
654+
);
655+
for (const [currentValue, releases, expected] of [
656+
[
657+
'10.11.11',
658+
[
659+
'10.11.12',
660+
'10.12.0',
661+
'12.2',
662+
'10.11.12-rc1',
663+
],
664+
['10.11.12'],
665+
],
666+
[
667+
'12.2',
668+
[
669+
'12.3',
670+
'13.0',
671+
'12.3-rc1',
672+
],
673+
['12.3'],
674+
],
675+
]) {
676+
const [dependency] = extractRegexPackageFile(
677+
`<JellyfinLatestVersion>${currentValue}</JellyfinLatestVersion>`,
678+
'src/jellyfin/compatibility.props',
679+
manager,
680+
).deps;
681+
const resolved = await applyPackageRules({
682+
...dependency,
683+
repository: 'LizardByte/Themerr',
684+
packageFile: 'src/jellyfin/compatibility.props',
685+
packageRules: renovateConfig.packageRules,
686+
});
687+
assert.deepEqual(
688+
filterVersions(
689+
resolved,
690+
currentValue,
691+
undefined,
692+
releases.map(version => ({version})),
693+
getVersioning(resolved.versioning),
694+
).map(value => value.version),
695+
expected,
696+
);
697+
}
698+
});
699+
700+
test('pins Jellyfin SDK and EF only in Themerr connector projects', async () => {
701+
for (const depName of [
702+
'Jellyfin.Controller',
703+
'Microsoft.EntityFrameworkCore.Sqlite',
704+
]) {
705+
for (const [repository, packageFile, disabled] of [
706+
[
707+
'LizardByte/Themerr',
708+
'connectors/jellyfin/Themerr.Connector.csproj',
709+
true,
710+
],
711+
[
712+
'LizardByte/Themerr',
713+
'connectors/jellyfin.tests/Connector.Tests.csproj',
714+
true,
715+
],
716+
[
717+
'LizardByte/Themerr-jellyfin',
718+
'connectors/jellyfin/Themerr.Connector.csproj',
719+
false,
720+
],
721+
[
722+
'LizardByte/Themerr',
723+
'another-project/Example.csproj',
724+
false,
725+
],
726+
]) {
727+
const resolved = await applyPackageRules({
728+
depName,
729+
packageName: depName,
730+
repository,
731+
packageFile,
732+
packageRules: renovateConfig.packageRules,
733+
});
734+
assert.equal(resolved.enabled === false, disabled, `${repository}/${packageFile}: ${depName}`);
735+
}
736+
}
737+
});
738+
739+
740+
test('resolves the root onboarding preset through the root main and Themerr JSON5 presets', async context => {
741+
const rootConfig = JSON.parse(fs.readFileSync('renovate-config.json', 'utf8'));
742+
const mainPreset = 'github>LizardByte/.github:renovate-config.json5';
743+
const themerrPreset = 'github>LizardByte/.github//renovate/themerr.json5';
744+
assert.deepEqual(rootConfig.extends, [mainPreset]);
745+
assert.ok(mainConfig.extends.includes(themerrPreset));
746+
assert.ok(mainConfig.customManagers.every(manager => manager.depNameTemplate !== 'jellyfin/jellyfin'));
747+
assert.ok(mainConfig.packageRules.every(rule => !rule.matchRepositories?.includes('LizardByte/Themerr')));
748+
749+
// Resolve the actual preset chain with local contents; unexpected network fetches fail the test.
750+
initPresetCache();
751+
setPresetCache(`preset:${mainPreset}`, mainConfig);
752+
setPresetCache(`preset:${themerrPreset}`, themerrConfig);
753+
context.mock.method(presetSources.github, 'load', async () => {
754+
throw new Error('Preset test attempted a network fetch.');
755+
});
756+
const {config, visitedPresets} = await resolveConfigPresets(rootConfig, undefined, undefined, [], false);
757+
assert.deepEqual(visitedPresets.merged, [
758+
mainPreset,
759+
themerrPreset,
760+
]);
761+
const manager = config.customManagers.find(value => value.depNameTemplate === 'jellyfin/jellyfin');
762+
assert.ok(manager, 'Expected the Themerr runtime manager in the resolved main preset');
763+
const resolved = await applyPackageRules({
764+
repository: 'LizardByte/Themerr',
765+
packageFile: 'src/jellyfin/compatibility.props',
766+
packageName: 'jellyfin/jellyfin',
767+
currentValue: '12.2',
768+
packageRules: config.packageRules,
769+
});
770+
assert.equal(resolved.allowedVersions, '/^12\\.[0-9]+$/');
771+
});

0 commit comments

Comments
 (0)