Skip to content

Fix #596, add a script to run the CI locally#595

Open
JAuriac wants to merge 1 commit into
mainfrom
runLocalCI
Open

Fix #596, add a script to run the CI locally#595
JAuriac wants to merge 1 commit into
mainfrom
runLocalCI

Conversation

@JAuriac

@JAuriac JAuriac commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

Add a script to run the CI locally.
Made for use on laptop, using podman.

Only one configuration case of ubuntu/rolling is used for now.
We may want to loop over the all configurations as defined in .github/workflows/tests.yml, or we may want to keep it lightweight as is (or we can add both through an option on this script).

Requires :

git submodule init
git submodule update

and, if they exists, clear the cache files at the root "pdi/" :

rm -f CMakeCache.txt 
rm -rf CMakeFiles

Fix #596

List of things to check before making a PR

Before merging your code, please check the following:

  • you have added a line describing your changes to the Changelog;
  • you have added unit tests for any new or improved feature;
  • In case you updated dependencies, you have checked pdi/docs/CheckList.md
  • you have checked your code format:
    • you have checked that you respect all conventions specified in CONTRIBUTING.md;
    • you have checked that the indentation and formatting conforms to the .clang-format;
    • you have documented with doxygen any new or changed function / class;
  • you have correctly updated the copyright headers:
    • your institution is in the copyright header of every file you (substantially) modified;
    • you have checked that the end-year of the copyright there is the current one;
  • you have updated the AUTHORS file:
    • you have added yourself to the AUTHORS file;
    • if this is a new contribution, you have added it to the AUTHORS file;
  • you have added everything to the user documentation:
    • any new CMake configuration option;
    • any change in the yaml config;
    • any change to the public or plugin API;
    • any other new or changed user-facing feature;
    • any change to the dependencies;
  • you have correctly linked your MR to one or more issues:
    • your MR solves an identified issue;
    • your commit contain the Fix #issue keyword to autoclose the issue when merged.

@JAuriac JAuriac linked an issue Sep 30, 2025 that may be closed by this pull request
@JAuriac

JAuriac commented Sep 30, 2025

Copy link
Copy Markdown
Contributor Author

This script uses only one case of ubuntu/rolling for now.
We may want to loop over the all configurations as defined in .github/workflows/tests.yml, or we may want to keep it lightweight as is (or we can add both through an option on this script).

@JAuriac
JAuriac marked this pull request as ready for review September 30, 2025 14:33
JAuriac added a commit that referenced this pull request Oct 1, 2025
@JAuriac JAuriac changed the title Add a script to run the CI locally Fix #596, add a script to run the CI locally Oct 1, 2025
@jbigot

jbigot commented Oct 27, 2025

Copy link
Copy Markdown
Member

What's the status on this one, @JAuriac, @benoitmartin88 ?

@benoitmartin88 benoitmartin88 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure that we need such a script.
It looks very static: the image is fixed and it must use podman (probably better to use docker to be more generic, then its up to the user to alias docker to podman).
My suggestion is that this should be added to PDI's documentation.

@jbigot

jbigot commented Oct 27, 2025

Copy link
Copy Markdown
Member

there used to be this https://github.com/pdidev/pdi/blob/1.7.1-gh/tools/build_scripts/test_in_docker that interpreted and ran the .gitlab-ci.yml file locally

@benoitmartin88

Copy link
Copy Markdown
Member

@JAuriac can we close this ?

@jbigot
jbigot deleted the runLocalCI branch January 25, 2026 13:09
@JAuriac
JAuriac restored the runLocalCI branch April 27, 2026 07:37
@JAuriac JAuriac reopened this Apr 27, 2026
@jbigot

jbigot commented Apr 27, 2026

Copy link
Copy Markdown
Member

For the indentation, adding podman is a good idea, but why not just add it to bin/test_indent ? You could look for podman there just like we currently look for docker

Comment thread bin/build_and_run_all_tests Outdated
Comment thread run-local-CI-indent.sh Outdated
Comment thread bin/test_CI

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does it have to be so complex?

In my case a simple:

IMAGE_NAME=ghcr.io/pdidev/spack/latest/clang/openmpi/all:v4
podman/docker run --rm -ti -v ${PWD}:/src:ro ${IMAGE_NAME} /src/bin/build_and_run_all_tests

does the trick. Do we need more?

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 key phrase is "in my case", as all pdi contributors maybe shouldn't have to know about containers' directory mounting and the behaviour of the online CI. Two scripts (placed in the bin folder or a hidden folder for example, the second one being the indent script) could enable to test a local change, independently of the local environment, with an additional option to specify the image used.
As seen together, the following should be environment-agnostic :

IMAGE_NAME=ghcr.io/pdidev/spack/latest/clang/openmpi/all:v4
podman run --rm -ti -e CMAKE_FLAGS="-DBUILD_DOCUMENTATION=OFF" -v ${PWD}:/src:ro ${IMAGE_NAME} /src/bin/build_and_run_all_tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

totally agree that a script makes sense. I just think it can be simpler

@JAuriac JAuriac Apr 29, 2026

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.

Correction, the previous commands are not sufficient on their own, a chmod is needed, as mentioned by Iole :

chmod -R o+rX .
IMAGE_NAME=ghcr.io/pdidev/spack/latest/clang/openmpi/all:v4
podman run --rm -ti -e CMAKE_FLAGS="-DBUILD_DOCUMENTATION=OFF" -v ${PWD}:/src:ro ${IMAGE_NAME} /src/bin/build_and_run_all_tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ideally we shouldn't modify the user filesystem
but I don't know any way to make the user data accessible without running as root in the image. do you?

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.

We now use --user $(id -u):$(id -g) for docker, and the alternative (which is not directly equivalent) --userns=keep-id for podman
We do not broaden file permissions anymore (no chmod), we now make the container run as the host

@JAuriac
JAuriac marked this pull request as draft May 5, 2026 13:53
@JAuriac
JAuriac marked this pull request as ready for review June 5, 2026 10:21
@JAuriac
JAuriac requested a review from jbigot June 8, 2026 13:29
@jbigot
jbigot marked this pull request as draft June 23, 2026 08:29
@JAuriac
JAuriac marked this pull request as ready for review June 30, 2026 13:37
Comment thread AUTHORS Outdated
@JAuriac
JAuriac requested a review from jbigot July 21, 2026 13:33
Co-authored-by: Julian Auriac <julian.auriac@cea.fr>
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.

Add a script to run the CI locally

4 participants