Skip to content

Automate tests against latest libLcm on nuget#17

Open
hahn-kev wants to merge 7 commits into
cdfarrow:mainfrom
hahn-kev:ci/windows-fieldworks-tests
Open

Automate tests against latest libLcm on nuget#17
hahn-kev wants to merge 7 commits into
cdfarrow:mainfrom
hahn-kev:ci/windows-fieldworks-tests

Conversation

@hahn-kev

@hahn-kev hahn-kev commented Jul 24, 2026

Copy link
Copy Markdown

This PR does 2 things.

  1. Let's us run the tests against a new build of libLcm from nuget
  2. Runs automated tests when pushing changes and in PR branches

I'm hoping this will let us catch issues earlier than when a new FLEx release goes out. Right now this only tests against new libLcm changes, but we could potentially download nightly FLEx builds and test against those too.

after this PR is merged in then these tests would run on each change that comes after, you can see the workflow that runs here in my fork https://github.com/hahn-kev/flexlibs/actions/runs/30076896761/job/89429540536


AI Summary

Here’s the full picture of what we built.

Problem

flexlibs talks to FieldWorks through pythonnet, loading DLLs from an installed FLEx tree (registry → RootCodeDir). You wanted to:

  1. Test against latest SIL NuGet packages without assuming only the install’s copies
  2. Eventually run that on Windows CI (download/install FieldWorks, cache it)

Part 1 — Swappable dependencies (local)

Path overrides in FLExGlobals.py

Three env vars, checked before registry discovery:

Env var Role
FLEXLIBS_FW_CODE_DIR Folder with FieldWorks.exe / app DLLs
FLEXLIBS_FW_PROJECTS_DIR Projects folder (required if code dir is set)
FLEXLIBS_ASSEMBLY_DIR Optional DLL folder prepended on sys.path so those assemblies win

Default behavior (no env vars) is unchanged: still uses the Windows registry.

NuGet overlay

  • tests/nuget-overlay/Overlay.csproj references latest prerelease SIL.LCModel*, SIL.Core*, SIL.WritingSystems
  • restore.ps1 does dotnet publish → flat .fw-nuget-overlay/
  • make test-nuget restores that overlay, sets FLEXLIBS_ASSEMBLY_DIR, runs pytest
  • Extra args pass through, e.g. -k "not CustomFields"

Important constraint: NuGet only publishes LCM/SIL libs. App assemblies (FwUtils, FieldWorks.exe, ICU init) still come from a FieldWorks binary tree. Overlay = “latest libraries on top of a real FW install.”

Custom-fields test

FLEXLIBS_TEST_PROJECT / FLEXLIBS_TEST_CUSTOM_FIELD so you can point at your own project (needs an entry-level custom text field). CI skips that test.


Part 2 — Windows CI

Branch: ci/windows-fieldworks-tests
PR: hahn-kev#1

Workflow (.github/workflows/test-windows.yml)

On a windows-latest runner:

  1. Python 3.12 + .NET SDK
  2. Cache installer, install tree, sample project
  3. Install-FieldWorks.ps1 — download offline 9.3.9.1 installer, silent /quiet /norestart ADDLOCAL=ALL, ensure registry
  4. Discover real install path (turns out it’s C:\Program Files\FieldWorks9, not SIL\FieldWorks 9)
  5. Fallback: GitHub BuildDir.zip if exe missing after install
  6. Setup-SampleProject.ps1 — extract Sena 2 .fwbackup into projects dir
  7. make test-nuget -k "not CustomFields" with env pointing at that FW tree

Result

  • First green run: 4 passed, 1 deselected
  • Later runs ~2 minutes with cache hit (vs ~7+ on cold install)

How the pieces fit

flowchart TD
  nuget[dotnet publish SIL packages] --> overlay[".fw-nuget-overlay"]
  installer[FW offline installer or cache] --> fwTree["FieldWorks9 + projects"]
  overlay --> envAsm["FLEXLIBS_ASSEMBLY_DIR"]
  fwTree --> envCode["FLEXLIBS_FW_CODE_DIR / PROJECTS_DIR"]
  envAsm --> flexlibs[flexlibs / pythonnet]
  envCode --> flexlibs
  flexlibs --> pytest[pytest smoke + project tests]
Loading

Locally: .\make.bat test-nuget -k "not CustomFields"
CI: same idea, but it provisions FieldWorks for you and caches it.

hahn-kev and others added 7 commits July 20, 2026 13:05
Downloads the offline FW 9.3.9 installer (cached), silently installs, seeds a sample project, and runs pytest with the NuGet assembly overlay.

Co-authored-by: Cursor <cursoragent@cursor.com>
Silent installer reports success but may not leave FieldWorks.exe at the expected path; search harder, upload logs, and extract the matching GitHub BuildDir.zip if needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
The silent offline installer places files under C:\Program Files\FieldWorks9 rather than SIL\FieldWorks 9.

Co-authored-by: Cursor <cursoragent@cursor.com>
checkout/setup-python/upload-artifact v7, setup-dotnet/cache v6.

Co-authored-by: Cursor <cursoragent@cursor.com>
The silent offline installer path is what green CI used; drop the unused GitHub BuildDir recovery path and its cache entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
Capture a prioritized roadmap (project-shape, lexicon fields, write round-trip, overlay asserts, matrices) now that Windows CI can run against FieldWorks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant