Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,31 @@ jobs:
AIMEE_BIN='./build/aimee.exe' FORCE_MODE=selfcheck \
bash scripts/aimee-thin-client-smoke.sh

# Main still requires this context from the former Windows CMake job.
# Keep it backed by the shipping thin-client build and its Winsock smoke
# tests, without duplicating that build or retiring either check name.
windows-cmake:
name: windows-cmake
needs: [change-scope, windows-build]
if: ${{ always() }}
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Require Windows CMake qualification
env:
WINDOWS_RESULT: ${{ needs.windows-build.result }}
SCOPE_RESULT: ${{ needs.change-scope.result }}
DOCS_ONLY: ${{ needs.change-scope.outputs.docs_only }}
run: |
if [ "$WINDOWS_RESULT" = success ]; then
echo "Windows CMake build and thin-client smoke tests passed"
elif [ "$WINDOWS_RESULT" = skipped ] && [ "$SCOPE_RESULT" = success ] && [ "$DOCS_ONLY" = true ]; then
echo "Windows build intentionally skipped for documentation-only changes"
else
echo "::error::Windows CMake qualification did not succeed: $WINDOWS_RESULT"
exit 1
fi

macos-build:
needs: change-scope
# Shared native headers/build contracts also change on testing-target PRs.
Expand Down
51 changes: 51 additions & 0 deletions scripts/tests/test_windows_cmake_gate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""Exercise the required Windows context against actual dependency outcomes."""
import os
from pathlib import Path
import subprocess
import unittest

import yaml

ROOT = Path(__file__).resolve().parents[2]


class WindowsCMakeGateTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
workflow = yaml.load((ROOT / '.github/workflows/ci.yml').read_text(),
Loader=yaml.BaseLoader)
cls.gate = workflow['jobs']['windows-cmake']
cls.script = cls.gate['steps'][0]['run']

def run_gate(self, windows, scope='success', docs_only='false'):
return subprocess.run(['bash', '-c', self.script], capture_output=True,
env=dict(os.environ, WINDOWS_RESULT=windows,
SCOPE_RESULT=scope, DOCS_ONLY=docs_only))

def test_required_context_depends_on_the_real_windows_job(self):
self.assertEqual(self.gate['name'], 'windows-cmake')
self.assertCountEqual(self.gate['needs'], ['change-scope', 'windows-build'])
self.assertEqual(self.gate['if'], '${{ always() }}')
env = self.gate['steps'][0]['env']
self.assertEqual(env['WINDOWS_RESULT'], '${{ needs.windows-build.result }}')
self.assertEqual(env['SCOPE_RESULT'], '${{ needs.change-scope.result }}')
self.assertEqual(env['DOCS_ONLY'], '${{ needs.change-scope.outputs.docs_only }}')

def test_successful_windows_build_qualifies(self):
self.assertEqual(self.run_gate('success').returncode, 0)

def test_failed_cancelled_or_unknown_build_never_qualifies(self):
for result in ('failure', 'cancelled', '', 'unknown'):
with self.subTest(result=result):
self.assertNotEqual(self.run_gate(result).returncode, 0)

def test_skip_requires_a_successful_documentation_only_classification(self):
self.assertEqual(self.run_gate('skipped', docs_only='true').returncode, 0)
for scope, docs in (('success', 'false'), ('failure', 'true'),
('cancelled', 'true'), ('', 'true'), ('success', '')):
with self.subTest(scope=scope, docs=docs):
self.assertNotEqual(self.run_gate('skipped', scope, docs).returncode, 0)


if __name__ == '__main__':
unittest.main()
Loading