Skip to content

[RTR] ci: cache locked Conda environments across test jobs - #1116

Closed
mickaelbegon wants to merge 15 commits into
pyomeca:masterfrom
mickaelbegon:codex/update-github-actions
Closed

mickaelbegon wants to merge 15 commits into
pyomeca:masterfrom
mickaelbegon:codex/update-github-actions

Conversation

@mickaelbegon

@mickaelbegon mickaelbegon commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Each test shard currently resolves and installs its own Conda environment. Install explicit platform locks and restore reusable environments to avoid repeating that setup. When a PR changes the dependency inputs without updating the locks, regenerate all three platforms in one dedicated job and provide a reviewable update.

Changes

  • Commit reproducible Linux, macOS ARM64 and Windows environments, with source-fingerprint and lockfile consistency checks before installation. Normalize CRLF/LF for Windows checkouts.
  • Restore environment caches in PR jobs; publish trusted caches from master only. Cache keys include OS, architecture, lockfile hash and ISO week. Coordinate Linux master tests with one cache-preparation job and warm the other platforms separately.
  • Add regenerate_conda_lockfiles.yml for every opened, updated or reopened PR, including drafts, plus manual dispatch. It uses a single Ubuntu job rather than a resolver per shard.
  • Skip generator setup and all dependency resolution when the committed locks are current. Otherwise run conda-lock 4.0.2 with Micromamba 2.5.0-2, resolve all three platforms once, update the source fingerprint and validate the results.
  • Upload the three locks, fingerprint, source commit and conda-lockfiles.patch. Stale runs deliberately fail after publishing the update until the patch is committed. The workflow uses read-only permissions and no extra secrets, including for fork PRs; it does not push a commit back to contributor branches.
  • Preserve all test shards, Linux coverage aggregation and the complete Black check. Update the actions, report slow tests and verify the Linux FATROP/BLASFEO combination.

Scientific code and numerical tolerances are unchanged. The only source-formatting change removes one blank line. The documentation describes how to apply the generated patch and records the CI workflow in the agent overview.

Validation

Current proposal head: 5a1cd63dd0e20343126cdd026e231aec91ad1211. Rebased onto upstream 6e68062531894b2cf43b47f6db357a3c227ced96 after the latest CI naming and trigger changes.

The new workflow was tested end to end in GitHub Actions:

  1. Unchanged PR on upstream: passed; generator installation and resolution were skipped. The first fork fast-path run took 7 seconds including runner setup and checkout.
  2. Changed dependency on an isolated fork branch: adding pytest-timeout regenerated and validated all three platforms in about 35 seconds. The update artifact was uploaded successfully. The only failed step was the intended requirement to commit the update.
  3. After applying and committing that GitHub-generated patch: passed, with Python setup, conda-lock installation, Micromamba installation and resolution all skipped again.

The patch was downloaded, checked with git apply --check, applied and validated byte-for-byte against the artifact. The Linux BLASFEO build pin was retained. The smoke dependency and regenerated test locks exist only on codex/ci-lock-regeneration-smoke; production locks in this PR are unchanged by these tests.

Local validation also passed: the same real three-platform regeneration and patch round trip; changed-source detection; a solver-failure test proving the source fingerprint is not updated after an error; all five workflow files checked with actionlint; full Black 26.5.1 check (314 files unchanged); and diff checks.

The first hosted attempt exposed a SIGSEGV in the automatically downloaded Micromamba. The workflow now explicitly installs and selects version 2.5.0-2; the successful hosted regeneration used that pinned executable.

The six Linux test shards passed on the preceding CI head 1a65dd62; earlier full Windows CI also passed. The final rebase preserves the new upstream TRAPEZOIDAL/quaternion fix and its regression test, which passed locally. This PR introduces no scientific or test changes relative to its new upstream base. Upstream Linux tests rerun on the updated head. macOS/Windows use upstream's auto_merge_enabled trigger. The regeneration workflow, its three input specifications and the production lockfiles are byte-for-byte identical to the version validated by the linked hosted runs. Coverage aggregation now succeeds (79%); the fork Codecov upload was rejected because it requires an upload token. No hosted end-to-end cache speedup is claimed.

Review notes

The requested automatic regeneration job is implemented and validated above. For the Black target question, --target-version py310 follows requires-python = ">=3.10" in pyproject.toml; formatting syntax compatibility and the Python 3.14 interpreter used to run Black are separate settings.

Refs #1085. Independent of the pytest-xdist proposal #1117. Combining them requires adding pytest-xdist to the CI dependency specification and regenerating all three locks. Fork tracking PR: mickaelbegon#20.

All Submissions

  • Followed the contributing guidelines for this CI-only proposal.
  • Checked for existing open PRs covering the same change.
  • Linked the active issue: refs [CI] Evaluate and reduce GitHub Actions test runtime #1085.
  • Updated [WIP] to [RTR] after implementing the requested workflow and validation.
  • Pinged a maintainer when ready to merge — final CI/review remains outstanding; no reviewer ping posted.

New Feature Submissions

  • Complete upstream validation passed — Linux runs on the updated head; macOS/Windows follow upstream's auto-merge trigger policy.
  • Documented the workflows, source fingerprint and generated-patch procedure.
  • Linted locally and validated the workflow's current, stale, failed-solver and patched states.

Changes to Core Features

  • Explained the purpose and final implementation.
  • Core examples: not applicable; no core feature or public API change.
  • Core numerical tests: unchanged; existing test matrix retained.

This change is Reviewable

Comment thread .github/conda-lock/README.md Resolved
run: python -m pip install --disable-pip-version-check black==26.5.1

- name: Check formatting
run: python -m black . --extend-exclude "^/external/" --check --line-length 120 --target-version py310

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why py310 ?

@mickaelbegon mickaelbegon changed the title [WIP] ci: cache locked Conda environments across test jobs [RTR] ci: cache locked Conda environments across test jobs Oct 15, 2026
@mickaelbegon
mickaelbegon marked this pull request as ready for review October 15, 2026 18:35
Always populate shifted state guesses on the first interpolation conversion,
with deterministic coverage for the first and subsequent windows.

Backport the numerical references from pyomeca#1096 without changing tolerances.
Use unscaled IPOPT convergence for the collocation feasibility regression without relaxing its tolerance.

Select a working BLASFEO build reproducibly in the Linux CI lock and verify FATROP success and feasibility before the test shards.
Run coverage merging after successful PR shards even when prepare-cache is skipped. Refresh the source fingerprint for the upstream environment comment edit; parsed dependency specifications and all three lockfiles remain unchanged.
@mickaelbegon
mickaelbegon force-pushed the codex/update-github-actions branch from 43b48ef to 5a1cd63 Compare October 15, 2026 18:39
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.51%. Comparing base (de775a5) to head (5a1cd63).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1116      +/-   ##
==========================================
+ Coverage   78.25%   78.51%   +0.25%     
==========================================
  Files         198      198              
  Lines       21747    21676      -71     
==========================================
  Hits        17018    17018              
+ Misses       4729     4658      -71     
Flag Coverage Δ
unittests 78.51% <ø> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Ipuch

Ipuch commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Can you rebase for our next meeting ?

@pariterre

Copy link
Copy Markdown
Member

Closing as maybe not relevant anymore

@pariterre pariterre closed this Oct 20, 2026
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.

3 participants