Skip to content

add CoolProp development testing - #52

Open
longemen3000 wants to merge 27 commits into
CoolProp:masterfrom
longemen3000:patch-3
Open

add CoolProp development testing#52
longemen3000 wants to merge 27 commits into
CoolProp:masterfrom
longemen3000:patch-3

Conversation

@longemen3000

@longemen3000 longemen3000 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR implements:

  • a mini package in the Test folder that compiles CoolProp from the nightly source in sourceforge, and sets the libcoolprop constant to the new compiled library (via Preferences.jl).
  • github action runner, that runs CoolProp.jl tests while using the nightly compiled version. i couldn't make the action run on julia LTS, but it runs on 1.12 - ubuntu-latest.

At the moment, the github action runs, and fails (because the fix for CoolProp/CoolProp#3258 is still not merged)

The compiler code was done with assistance of an LLM, feel free to change it to something better.

CC @ibell : At the moment, the yml is configured to run in CoolProp.jl, but you could run it in CoolProp instead

Summary by CodeRabbit

  • New Features
    • Added a scheduled “Development Tests” workflow and manual/run-on-change triggers for development testing.
    • Added support for switching to a locally compiled development version of the CoolProp library.
  • Bug Fixes
    • Improved shared-library resolution at startup across Julia versions.
    • Added an informational message indicating which CoolProp library path is in use.
  • Documentation
    • Minor formatting tweak to the humid-air HAPropsSI example.
  • Tests
    • Introduced a dedicated development test project and updated test target configuration.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@longemen3000, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d345e3f4-1dfb-4fbf-ad59-10c5c7ad06d2

📥 Commits

Reviewing files that changed from the base of the PR and between a7cded5 and 5fb7614.

📒 Files selected for processing (1)
  • .github/workflows/test_dev.yml
📝 Walkthrough

Walkthrough

Adds a CoolPropDevLoader test package that downloads and compiles a dev CoolProp library from SourceForge, switches CoolProp_jll preferences to use it, resolves the library through Preferences in src/CoolProp.jl, and adds CI plus project/test wiring to run the new flow.

Changes

Dev library loader and preference wiring

Layer / File(s) Summary
SourceForge compile helper
test/CoolPropDevLoader/src/CoolPropDevLoader.jl
Adds constants and compile_from_sourceforge() to download, unpack, configure, build, and locate a compiled libCoolProp.so.
Preference setters and library switching
test/CoolPropDevLoader/src/CoolPropDevLoader.jl, test/CoolPropDevLoader/Project.toml
Adds CompileCoolPropFromSourceforge, use_dev_library overloads, use_default_library, and the loader package project metadata with deps, compat, and test target.
CoolProp.jl preference-based library resolution
src/CoolProp.jl, test/CoolProp.jl, Project.toml
Resolves libcoolprop via load_preference on Julia >= 1.6, logs the resolved path in tests, and adds Preferences plus Test project entries.
Development test CI workflow and docs
.github/workflows/test_dev.yml, README.md
Adds a scheduled/manual/path-triggered workflow that develops CoolPropDevLoader, compiles CoolProp from source, and runs tests; includes a small README edit.

Poem

A rabbit found a nightly zip,
And gave a dev build quite the zip-zap trip 🐇
Preferences hopped, the library changed,
Tests ran on time, all neatly arranged.
Thump! The source-build moonlight lit the strip.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding development testing for CoolProp.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/CoolProp.jl (1)

9-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider combining the two @static if VERSION >= v"1.6" blocks.

Having separate @static blocks for using Preferences and const libcoolprop duplication of the version guard. A single block is clearer and ensures the import and constant are always consistent.

♻️ Proposed refactor
 `@static` if VERSION >= v"1.6"
-    using Preferences
-end
-
-@static if VERSION >= v"1.6"
     const libcoolprop = load_preference(CoolProp_jll,"coolprop_library", CoolProp_jll.libcoolprop)
 else
     const libcoolprop = CoolProp_jll.libcoolprop
 end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/CoolProp.jl` around lines 9 - 17, Combine the duplicated VERSION guard in
CoolProp.jl by using a single `@static` if VERSION >= v"1.6" block around both the
Preferences import and the libcoolprop assignment, and keep the fallback branch
for older versions in the same structure. Update the top-level initialization
near using Preferences and const libcoolprop so the import and preference-based
library selection always stay consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test_dev.yml:
- Around line 1-58: The workflow needs tighter GitHub Actions security settings:
add an explicit minimal permissions block at the workflow level, since it only
runs tests, and disable token persistence in the Checkout step. Update the
`test-coolprop-dev` workflow by setting least-privilege permissions and changing
the `actions/checkout` usage so `persist-credentials` is false. Use the existing
`Checkout` step and the workflow header near `name: Development Tests` to locate
the changes.

In `@test/CoolPropDevLoader/Project.toml`:
- Line 12: The Julia compatibility bound is too low for the dependencies used by
CoolPropDevLoader. Update the compat entry in Project.toml from julia = "1.3" to
a minimum version that supports the unconditional imports in
CoolPropDevLoader.jl, namely Preferences and Downloads, so the project cannot
resolve on unsupported Julia versions. Keep the change scoped to the
Project.toml for the test/CoolPropDevLoader package and ensure the compat
matches the requirements of the CoolPropDevLoader module.

In `@test/CoolPropDevLoader/src/CoolPropDevLoader.jl`:
- Line 28: The extraction step in CoolPropDevLoader should not block on reruns
when files already exist. Update the `run` invocation that uses `unzip` so it
overwrites existing files unconditionally, and keep the logic tied to the
existing `mkpath`-created `build_dir` flow in `CoolPropDevLoader.jl`. This
change should be made in the same place as the current `run(\`unzip ...\`)` call
so CI and non-interactive runs don’t hang.
- Around line 95-104: The two `use_dev_library` overloads are writing
`coolprop_library` with different preference scopes, so align them to use the
same `set_preferences!` kwargs. Update
`use_dev_library(::CompileCoolPropFromSourceforge)` to match the
`use_dev_library(lib_src::String)` behavior (or vice versa) so `CoolProp_jll`
stores the preference consistently for the project that `CoolProp.jl` later
reads via `load_preference`. Keep the change localized to these
`use_dev_library` methods and preserve the existing `@info` logging.

---

Nitpick comments:
In `@src/CoolProp.jl`:
- Around line 9-17: Combine the duplicated VERSION guard in CoolProp.jl by using
a single `@static` if VERSION >= v"1.6" block around both the Preferences import
and the libcoolprop assignment, and keep the fallback branch for older versions
in the same structure. Update the top-level initialization near using
Preferences and const libcoolprop so the import and preference-based library
selection always stay consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 652479ad-5c83-4d7a-91d7-76528f6eedec

📥 Commits

Reviewing files that changed from the base of the PR and between 46a2496 and 2637c3d.

📒 Files selected for processing (7)
  • .github/workflows/test_dev.yml
  • Project.toml
  • README.md
  • src/CoolProp.jl
  • test/CoolProp.jl
  • test/CoolPropDevLoader/Project.toml
  • test/CoolPropDevLoader/src/CoolPropDevLoader.jl

Comment on lines +1 to +58
name: Development Tests

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
push:
paths:
- '.github/**'
- 'test/CoolPropDevLoader/**'

concurrency:
# Skip intermediate builds: all builds except for builds on the `master` branch
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test-coolprop-dev:
timeout-minutes: 30
strategy:
matrix:
julia_version:
- '1.12'
os:
- ubuntu-latest
julia_arch:
- x64
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v7

- uses: julia-actions/setup-julia@v3
with:
arch: ${{ matrix.julia_arch }}
version: ${{ matrix.julia_version }}
- uses: julia-actions/cache@v3

- name: add CoolPropDevLoader
shell: julia --color=yes --project=. {0}
run: |
using Pkg
Pkg.develop(path="test/CoolPropDevLoader")

- name: Compiling CoolProp
shell: julia --color=yes --compiled-modules=no --project=test {0}
run: |
using Pkg
Pkg.develop(path="test/CoolPropDevLoader")
using CoolPropDevLoader
CoolPropDevLoader.use_dev_library(CoolPropDevLoader.CompileCoolPropFromSourceforge())
Pkg.add("Test")

- uses: julia-actions/julia-runtest@v1

No newline at end of file

@coderabbitai coderabbitai Bot Jul 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Add permissions block and set persist-credentials: false on checkout.

The workflow lacks a permissions block, defaulting to the token's full permissions set. Since this workflow only runs tests, it should use minimal permissions. Additionally, actions/checkout persists the GitHub token by default, which is unnecessary here and flagged by zizmor as a credential persistence risk.

🔒 Proposed security hardening
 name: Development Tests
 
 on:
   schedule:
     - cron: 0 0 * * *
   workflow_dispatch:
   push:
     paths:
       - '.github/**'
       - 'test/CoolPropDevLoader/**'
 
+permissions:
+  contents: read
+
 concurrency:
   # Skip intermediate builds: all builds except for builds on the `master` branch
   # Cancel intermediate builds: only pull request builds
   group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
   cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
 
 jobs:
   test-coolprop-dev:
     timeout-minutes: 30
     strategy:
       matrix:
         julia_version:
           - '1.12'
         os:
           - ubuntu-latest
         julia_arch:
           - x64
       fail-fast: false
     runs-on: ${{ matrix.os }}
 
     steps:
     - name: Checkout
       uses: actions/checkout@v7
+      with:
+        persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: Development Tests
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
push:
paths:
- '.github/**'
- 'test/CoolPropDevLoader/**'
concurrency:
# Skip intermediate builds: all builds except for builds on the `master` branch
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test-coolprop-dev:
timeout-minutes: 30
strategy:
matrix:
julia_version:
- '1.12'
os:
- ubuntu-latest
julia_arch:
- x64
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v3
with:
arch: ${{ matrix.julia_arch }}
version: ${{ matrix.julia_version }}
- uses: julia-actions/cache@v3
- name: add CoolPropDevLoader
shell: julia --color=yes --project=. {0}
run: |
using Pkg
Pkg.develop(path="test/CoolPropDevLoader")
- name: Compiling CoolProp
shell: julia --color=yes --compiled-modules=no --project=test {0}
run: |
using Pkg
Pkg.develop(path="test/CoolPropDevLoader")
using CoolPropDevLoader
CoolPropDevLoader.use_dev_library(CoolPropDevLoader.CompileCoolPropFromSourceforge())
Pkg.add("Test")
- uses: julia-actions/julia-runtest@v1
name: Development Tests
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
push:
paths:
- '.github/**'
- 'test/CoolPropDevLoader/**'
permissions:
contents: read
concurrency:
# Skip intermediate builds: all builds except for builds on the `master` branch
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test-coolprop-dev:
timeout-minutes: 30
strategy:
matrix:
julia_version:
- '1.12'
os:
- ubuntu-latest
julia_arch:
- x64
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- uses: julia-actions/setup-julia@v3
with:
arch: ${{ matrix.julia_arch }}
version: ${{ matrix.julia_version }}
- uses: julia-actions/cache@v3
- name: add CoolPropDevLoader
shell: julia --color=yes --project=. {0}
run: |
using Pkg
Pkg.develop(path="test/CoolPropDevLoader")
- name: Compiling CoolProp
shell: julia --color=yes --compiled-modules=no --project=test {0}
run: |
using Pkg
Pkg.develop(path="test/CoolPropDevLoader")
using CoolPropDevLoader
CoolPropDevLoader.use_dev_library(CoolPropDevLoader.CompileCoolPropFromSourceforge())
Pkg.add("Test")
- uses: julia-actions/julia-runtest@v1
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 33-34: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 19-58: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test_dev.yml around lines 1 - 58, The workflow needs
tighter GitHub Actions security settings: add an explicit minimal permissions
block at the workflow level, since it only runs tests, and disable token
persistence in the Checkout step. Update the `test-coolprop-dev` workflow by
setting least-privilege permissions and changing the `actions/checkout` usage so
`persist-credentials` is false. Use the existing `Checkout` step and the
workflow header near `name: Development Tests` to locate the changes.

Source: Linters/SAST tools

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code compiles CoolProp and creates a directory inside the test folder, only read permissions are not enough

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@longemen3000, good question — but this is a common mix-up between two different types of "permissions."

The permissions: block in a GitHub Actions workflow only controls the scope of the GITHUB_TOKEN used for calls to the GitHub API (e.g., pushing commits, creating releases/comments, writing to packages, etc.). It has no effect on local filesystem operations on the runner's disk.

Since this workflow's build step (compiling CoolProp via CMake, creating a build directory under test/, downloading the SourceForge archive, etc.) only writes to the runner's local disk and never pushes back to the repository or calls the GitHub API to write content, contents: read is sufficient. The job can still freely create directories, compile code, and download files locally — that's unrelated to the token's API scope.

So contents: read won't block the compile step; it just prevents the GITHUB_TOKEN from being used to push/write to the repo via the API, which this workflow doesn't do anyway. Let me know if you're hitting an actual permission-denied error from a specific step, and I can help dig into that separately.


✏️ Learnings added
Learnt from: longemen3000
Repo: CoolProp/CoolProp.jl PR: 52
File: .github/workflows/test_dev.yml:1-58
Timestamp: 2026-07-09T06:28:06.309Z
Learning: In CoolProp.jl's `.github/workflows/*.yml` files, the workflow author (longemen3000) may confuse the GitHub Actions `permissions:` block (which scopes the GITHUB_TOKEN for GitHub API calls) with local filesystem write permissions on the runner. Clarify that `permissions: contents: read` does not restrict local disk operations like compiling code or creating directories in `test/CoolPropDevLoader`, since those don't use the GITHUB_TOKEN.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment thread test/CoolPropDevLoader/Project.toml Outdated
Comment thread test/CoolPropDevLoader/src/CoolPropDevLoader.jl Outdated
Comment thread test/CoolPropDevLoader/src/CoolPropDevLoader.jl
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