Repository navigation
Windows base (2/2): windows-latest compile and tests job (stacked on #75) #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7013292
Windows base (2/2): windows-latest compile and tests job (not required)
EVMCOD 51c3542
Windows CI: fix the evals temp-dir cleanup, skip Windows-impossible t…
EVMCOD c5fb084
Evals checks: compare document paths with forward slashes (Windows in…
EVMCOD b99568e
Merge remote-tracking branch 'origin/main' into ci/windows-job
EVMCOD 0aaff85
Windows tests: mark POSIX-permission tests systematically and guard a…
EVMCOD fa0ae3a
posix_perms helpers: decide Windows once at import, not from a monkey…
EVMCOD 3b9c8f3
Merge origin/main into ci/windows-job (CHANGELOG: PR bullet first, th…
EVMCOD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| name: Windows (compile and tests) | ||
|
|
||
| # Windows is NOT a supported platform yet (docs/PORTABILITY.md). This workflow | ||
| # only answers two questions on every change that could affect it, so a Windows | ||
| # regression is seen before anyone ships Windows: | ||
| # 1. does the Tauri wrapper still COMPILE for Windows (cargo check), and | ||
| # 2. does the Windows-safe part of the Python suite still pass on Windows. | ||
| # It builds no installer, signs nothing, publishes nothing, uploads no artifact | ||
| # and uses no secret. It is not a required check (branch protection does not | ||
| # list it), so a red run here does not block a merge; look at it when it is red. | ||
| # Runs only on GitHub-hosted runners (this repo is public); never a | ||
| # self-hosted one (tests/test_workflows_guard.py). | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [main] | ||
| paths: &paths | ||
| - "ops_dashboard/**" | ||
| - "tests/**" | ||
| - "desktop/**" | ||
| - "requirements*.txt" | ||
| - "pyproject.toml" | ||
| - ".github/workflows/windows.yml" | ||
| pull_request: | ||
| paths: *paths | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: windows-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| windows-python: | ||
| # The Python suite on Windows. Tests that need something Windows does not | ||
| # have (bubblewrap/seatbelt, bash scripts, AF_UNIX agent sockets, POSIX | ||
| # permission bits) are skipped with an explicit reason: see | ||
| # tests/windows_skips.py, which tests/conftest.py applies on win32 only. | ||
| runs-on: windows-latest | ||
| timeout-minutes: 45 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| env: | ||
| # The sidecar will be started with UTF-8 mode on Windows (plan item 8); | ||
| # the CI matches that. Encoding problems of the default cp1252 are not | ||
| # what this job looks for. | ||
| PYTHONUTF8: "1" | ||
| steps: | ||
| - name: Keep line endings as they are in the repository | ||
| run: git config --global core.autocrlf false | ||
|
|
||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | ||
| with: | ||
| python-version: "3.14" | ||
| cache: pip | ||
| cache-dependency-path: requirements*.txt | ||
|
|
||
| - name: Install dev dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements-dev.txt | ||
|
|
||
| - name: Test (pytest, Windows-safe subset) | ||
| # Not run here: the live license worker, the two headless-Chrome JS | ||
| # tests and the *_ui_browser tests (they need Chrome/Playwright and | ||
| # run in ci.yml), and no coverage floor (ci.yml owns it). | ||
| run: > | ||
| pytest -m "not live" -p no:cacheprovider -q -ra | ||
| --ignore=tests/test_license_worker.py | ||
| --ignore=tests/test_browser_visibility_js.py | ||
| --ignore=tests/test_desktop_nav_js.py | ||
| --ignore-glob="tests/test_*ui_browser.py" | ||
|
|
||
| windows-rust: | ||
| # Compile-only: cargo check of the Tauri wrapper for the Windows target | ||
| # (this is where a missing #[cfg(windows)] branch shows up) and the tests of | ||
| # the pure-Rust URL policy. The wrapper's own tests are not run: they would | ||
| # link the WebView2 loader, and nothing here launches the app. | ||
| runs-on: windows-latest | ||
| timeout-minutes: 40 | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 | ||
| with: | ||
| workspaces: desktop/src-tauri | ||
|
|
||
| - name: Placeholder sidecar (tauri-build checks externalBin exists) | ||
| run: | | ||
| mkdir -p desktop/src-tauri/binaries | ||
| triple="$(rustc -vV | sed -n 's/host: //p' | tr -d '\r')" | ||
| : > "desktop/src-tauri/binaries/conductloop-server-${triple}.exe" | ||
|
|
||
| - name: cargo check (locked) | ||
| working-directory: desktop/src-tauri | ||
| run: cargo check --locked --all-targets | ||
|
|
||
| - name: cargo test (url-policy) | ||
| run: cargo test --manifest-path desktop/url-policy/Cargo.toml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| """Assertions about POSIX permission bits, which Windows does not have. | ||
|
|
||
| ``chmod(0o600)`` only toggles the read-only attribute on Windows and ``st_mode`` | ||
| reports 0o666 for ordinary files, so a test that asserts "owner only" or "is | ||
| executable" cannot pass there, and it is not a bug (docs/PORTABILITY.md 4.3, | ||
| ``ops_dashboard/fileperms.py``). Two ways to deal with such a test, and the only | ||
| two the guard in tests/test_windows_workflow.py accepts: | ||
|
|
||
| * the whole test is about the bits: mark it ``@pytest.mark.posix_perms`` (skipped | ||
| on Windows by tests/conftest.py, with the reason below); | ||
| * the bits are one assertion among others: make that assertion with one of the | ||
| helpers here, which do nothing on Windows, and keep the rest of the test | ||
| running there. | ||
|
|
||
| macOS and Linux assert exactly what they asserted before. | ||
| """ | ||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import stat | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| REASON = ("POSIX permission bits (st_mode, chmod, the executable bit) do not exist on Windows " | ||
| "(docs/PORTABILITY.md 4.3)") | ||
|
|
||
|
|
||
| # Decided once at import: some tests monkeypatch sys.platform to exercise another OS's | ||
| # code path, but the file system underneath is still the real one. | ||
| _WINDOWS = sys.platform == "win32" | ||
|
|
||
|
|
||
| def on_windows() -> bool: | ||
| return _WINDOWS | ||
|
|
||
|
|
||
| def assert_mode(path: str | os.PathLike[str], expected: int) -> None: | ||
| """``S_IMODE(stat(path)) == expected``, except on Windows.""" | ||
| if on_windows(): | ||
| return | ||
| actual = stat.S_IMODE(Path(path).stat().st_mode) | ||
| assert actual == expected, f"{path}: mode {oct(actual)}, expected {oct(expected)}" | ||
|
|
||
|
|
||
| def assert_no_group_other_access(path: str | os.PathLike[str]) -> None: | ||
| """No permission bit for group or others, except on Windows.""" | ||
| if on_windows(): | ||
| return | ||
| actual = stat.S_IMODE(Path(path).stat().st_mode) | ||
| assert actual & 0o077 == 0, f"{path}: mode {oct(actual)} gives access to group/others" | ||
|
|
||
|
|
||
| def assert_executable(path: str | os.PathLike[str]) -> None: | ||
| """The file has an execute bit, except on Windows.""" | ||
| if on_windows(): | ||
| return | ||
| assert Path(path).stat().st_mode & 0o111, f"{path} is not executable" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.