Run required plugin checks on every branch push
This commit is contained in:
parent
67db68218c
commit
77d0797c47
3 changed files with 94 additions and 17 deletions
|
|
@ -2,23 +2,7 @@ name: DuneRealms Plugin CI
|
|||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '.forgejo/workflows/plugins.yml'
|
||||
- 'Dune*/**'
|
||||
- 'JarvisConnector/**'
|
||||
- 'gui-common/**'
|
||||
- 'citizens-common/**'
|
||||
- 'network/resource-pack/shared/**'
|
||||
- 'network/resource-pack/mcgui/**'
|
||||
- 'network/resource-pack/central/**'
|
||||
- 'network/resource-pack/vanilla-art/**'
|
||||
- 'tools/generate-vanilla-dune-art.py'
|
||||
- 'tools/build-unified-resourcepack.py'
|
||||
- 'network/content-assets/planet-artwork/profiles.json'
|
||||
- 'tools/*gameplay*'
|
||||
- 'tools/*plugin*'
|
||||
- 'tools/*menu*'
|
||||
branches: ['**']
|
||||
|
||||
jobs:
|
||||
plugins:
|
||||
|
|
@ -65,6 +49,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 tools/test_plugin_ci_policy.py -v
|
||||
python3 tools/test_plugin_fleet_install.py -v
|
||||
python3 tools/test_plugin_menu_pack.py -v
|
||||
python3 tools/test_plugin_backend_abi.py -v
|
||||
|
|
|
|||
13
docs/PREMERGE-PLUGIN-CI-20261129.md
Normal file
13
docs/PREMERGE-PLUGIN-CI-20261129.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Pre-merge plugin build coverage
|
||||
|
||||
The canonical workflow remains `DuneRealms Plugin CI`, job `plugins`. Every branch push runs the same exact-revision build, including documentation-only branches. There are no path filters. Manual dispatch remains available, but it is not a substitute for the real push status.
|
||||
|
||||
The coordinator observed the Forgejo status context `DuneRealms Plugin CI / plugins (push)` on the merged67db push. Before enabling protection, verify this exact context also succeeds on this PR head from its branch push. Do not invent a check name or treat workflow-dispatch success as a populated commit status.
|
||||
|
||||
The build still compiles and tests all eight first-party source modules and runs the existing retained-backend ABI, installer/rollback, resource-pack, artwork and pack-property regression checks. The new policy tests reject narrowed branch/path coverage, context renames, missing modules/checks, unpinned checkout and skipped/ignored validation failures.
|
||||
|
||||
The proposed main protection requires the observed push context, blocks direct pushes including administrators, requires current-base candidates, blocks rejected reviews, and requires zero human approvals. This records the intended configuration; it does not establish that the server setting has been applied. The coordinator must verify the actual server configuration separately.
|
||||
|
||||
Real MCGUI renderer checks use the pinned private runtime locally. This workflow does not install or expose that runtime and does not claim renderer or connected-client acceptance in CI. Preserve the existing local renderer requirements in AGENTS.md.
|
||||
|
||||
This change affects CI policy and release evidence only. Do not install its documentation build over the verified runtime release. Complete the final deployment evidence and backup before starting the separate Beta1.0.2.0 Pillager Update PR.
|
||||
79
tools/test_plugin_ci_policy.py
Normal file
79
tools/test_plugin_ci_policy.py
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
"""Guard the real push status required before merging plugin changes.
|
||||
|
||||
Intentionally checks the committed workflow without a third-party YAML loader.
|
||||
The restricted trigger form makes exclusions and event/job renames fail closed.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import re
|
||||
import unittest
|
||||
|
||||
WORKFLOW = Path(__file__).resolve().parents[1] / '.forgejo/workflows/plugins.yml'
|
||||
CHECKS = (
|
||||
'test_plugin_ci_policy.py', 'test_plugin_fleet_install.py',
|
||||
'test_plugin_menu_pack.py', 'test_plugin_backend_abi.py',
|
||||
'test_plugin_fleet_rollback.py', 'test_plugin_resource_pack.py',
|
||||
'test_plugin_vanilla_art.py', 'test_plugin_pack_properties.py',
|
||||
'test_gameplay_resourcepack.py',
|
||||
)
|
||||
|
||||
|
||||
def validate(text):
|
||||
lines = [line for line in text.splitlines() if line.strip() and not line.lstrip().startswith('#')]
|
||||
normalized = '\n'.join(lines)
|
||||
expected = "name: DuneRealms Plugin CI\non:\n workflow_dispatch:\n push:\n branches: ['**']\njobs:\n plugins:\n runs-on: dune-ci\n steps:"
|
||||
if not normalized.startswith(expected + '\n'):
|
||||
raise ValueError('Keep the plugins push check on every branch, without path/event/job exclusions')
|
||||
for command in ('fetch --depth=1', '"$GITHUB_SHA"', 'git checkout --detach FETCH_HEAD',
|
||||
'gradle --no-daemon -p "$module" test jar'):
|
||||
if command not in text:
|
||||
raise ValueError('Missing exact-source build: ' + command)
|
||||
modules = re.search(r'^\s*modules=\(([^)]+)\)', text, re.M)
|
||||
if not modules or set(modules[1].split()) != {
|
||||
'DuneEss', 'DuneLobby', 'DuneNPC', 'DuneRealms-minecraft-only',
|
||||
'DuneRealmsGUI', 'DuneTerrain', 'JarvisConnector', 'DuneMenus',
|
||||
}:
|
||||
raise ValueError('All eight source modules must retain tests and compilation')
|
||||
for script in CHECKS:
|
||||
if 'python3 tools/' + script + ' -v' not in text:
|
||||
raise ValueError('Missing release regression check: ' + script)
|
||||
if re.search(r'^\s*(continue-on-error|if):', text, re.M):
|
||||
raise ValueError('Do not skip or ignore required build steps')
|
||||
# Both shell groups must propagate a failed test/build to the commit status.
|
||||
if text.count('set -euo pipefail') != 3:
|
||||
raise ValueError('Exact checkout and both validation groups must fail on errors')
|
||||
|
||||
|
||||
class PluginCIPolicyTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.text = WORKFLOW.read_text(encoding='utf-8')
|
||||
|
||||
def test_committed_workflow_covers_feature_and_documentation_pushes(self):
|
||||
validate(self.text)
|
||||
|
||||
def test_main_only_and_path_filtered_pushes_are_rejected(self):
|
||||
for replacement in ('branches: [main]', "branches: ['**']\n paths: ['Dune*/**']",
|
||||
"branches: ['**']\n paths-ignore: ['docs/**']"):
|
||||
with self.subTest(replacement=replacement), self.assertRaises(ValueError):
|
||||
validate(self.text.replace("branches: ['**']", replacement))
|
||||
|
||||
def test_status_context_renames_and_dispatch_only_are_rejected(self):
|
||||
for old, new in (('name: DuneRealms Plugin CI', 'name: Renamed'),
|
||||
(' plugins:', ' build:'), (' push:', ' pull_request:')):
|
||||
with self.subTest(new=new), self.assertRaises(ValueError):
|
||||
validate(self.text.replace(old, new, 1))
|
||||
|
||||
def test_regression_check_removal_and_ignored_failures_are_rejected(self):
|
||||
for script in CHECKS:
|
||||
with self.subTest(script=script), self.assertRaises(ValueError):
|
||||
validate(self.text.replace('python3 tools/' + script + ' -v', 'true'))
|
||||
with self.assertRaises(ValueError):
|
||||
validate(self.text.replace(' runs-on:', ' continue-on-error: true\n runs-on:', 1))
|
||||
|
||||
def test_missing_module_and_unpinned_checkout_are_rejected(self):
|
||||
for old, new in ((' DuneMenus)', ')'), ('git checkout --detach FETCH_HEAD', 'git checkout main')):
|
||||
with self.subTest(old=old), self.assertRaises(ValueError):
|
||||
validate(self.text.replace(old, new))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Reference in a new issue

Staff