forked from boutproject/hermes-3
-
Notifications
You must be signed in to change notification settings - Fork 1
VANTAGE-Reactions coupling docker image for testing #28
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
mrhardman
merged 64 commits into
VANTAGE-Reactions-Coupling/dev
from
VANTAGE-Reactions-Coupling/docker-image
Apr 2, 2026
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
48e76e9
Record a Dockerfile for creating an image with spack dependencies for…
mrhardman c95d2f9
Follow suggested best practices for apt-get commands in RUN https://d…
mrhardman 2318c70
Initial attempt at a workflow for building a docker image with VANTAG…
mrhardman b332ebe
Attempt to trigger workflow on push.
mrhardman 98aa4c4
Attempt to fix enable.
mrhardman 2712bbc
Attempt to fix enable:2.
mrhardman 62e7c7f
Make dockerfile trivial to debug actions.
mrhardman b727cd6
Attempt to write packages.
mrhardman c57fa07
Do not rebuild docker image.
mrhardman 853d781
Correct typo
mrhardman c9cad56
Add runs-on.
mrhardman 03f0765
Correct typo.
mrhardman 7ac34a8
Use edge for now.
mrhardman 5c3f5cd
Correct typo.
mrhardman 20c4486
Repo/package name must be lower case.
mrhardman ab37452
Revert "Make dockerfile trivial to debug actions."
mrhardman b7da879
Revert "Do not rebuild docker image."
mrhardman ca3561c
Do not build image on push.
mrhardman 3d4ed6e
Initial version of VANTAGE tests.
mrhardman e75625a
Use spack commands instead of spacktivate alias.
mrhardman 6bbf899
Remember to checkout submodules.
mrhardman 8480f6e
Have actions checkout submodules.
mrhardman 1fb4e13
Merge branch 'VANTAGE-Reactions-Coupling/dev' into VANTAGE-Reactions-…
mrhardman 7dfdc7b
Expand VANTAGE-docker/README.md with instructions for local usage.
mrhardman df9e261
Trigger on push to VANTAGE-Reactions-Coupling/dev only, or when manua…
mrhardman 480bbc5
Remove push trigger for test.
mrhardman 1b1e834
Make sure uninstallation of packages happens within the layer that th…
mrhardman 3345f65
Add a timeout-minutes to avoid wasting Actions time.
mrhardman 0785b68
Use `COPY` instead of `RUN git clone https://github.com/UKAEA-Edge-Co…
mrhardman 64c1539
Remove concretize from dockerfile.
mrhardman 8c67997
Use a sha256 hash to specify the ubuntu version in the dockerfile.
mrhardman 96e5e9b
Correct `spack compiler find` command.
mrhardman fbe601c
Try including OMP flags to speedup tests.
mrhardman 1ff0de8
Reduce number of tests to run in parallel.
mrhardman 6580e7e
Move env inside container settings.
mrhardman e71aa37
Print information from 2D-production test.
mrhardman 1e920e1
Extend timeout, more verbose printing in tests.
mrhardman fca3038
A test python program just downloading the data for the 2D production…
mrhardman 66e8e42
Modify actions to only check the download of files, no spack installa…
mrhardman a5ca378
Remove push trigger for cmake actions tests.
mrhardman 0b6fb82
Report on installed packages.
mrhardman 1d7ad7a
Make sure to regenerate the view to access python packages.
mrhardman cf57fa3
Concretize as well as regenerate the view.
mrhardman c0e47bf
Execute download with the same syntax as ./runtest.
mrhardman 881c105
Attempt to download test data before ctest execution.
mrhardman a5e428d
Add missing &&.
mrhardman 5bcf72f
Write some print statements to screen.
mrhardman 0d837ff
Timing statements in similar tests.
mrhardman b2f0113
ls to see downloaded files, verbose printing in cmake built integrati…
mrhardman 8949e8d
Merge remote-tracking branch 'upstream/faster-tests' into VANTAGE-Rea…
mrhardman b016281
Add default target granularity variable for sed to search and replace…
mrhardman 08810e3
Change docker image name, use sed to use generic target granularity i…
mrhardman 6e37475
Build docker image on push.
mrhardman 9711f55
Attempt to correct syntax.
mrhardman 7d48949
Use sed to set `target=x86_64_v3` in docker image and VANTAGE tests.
mrhardman 00212f7
Tidy up test workflow.
mrhardman 5c8797d
Tidy up 2D-production test.
mrhardman ac67a27
Build docker image on push to `VANTAGE-Reactions-Coupling/dev`.
mrhardman 4201ac9
Merge pull request #32 from UKAEA-Edge-Code/VANTAGE-Reactions-Couplin…
mrhardman 4c0bfb3
Reduce verbosity in tests.
mrhardman 3905a8d
Merge branch 'VANTAGE-Reactions-Coupling/dev' into VANTAGE-Reactions-…
mrhardman dc8fa17
Merge branch 'VANTAGE-Reactions-Coupling/dev' into VANTAGE-Reactions-…
mrhardman e11ead9
Use versions of runtest for `2D-` tests from upstream.
mrhardman 0f87664
Merge branch 'VANTAGE-Reactions-Coupling/dev' into VANTAGE-Reactions-…
mrhardman 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
81 changes: 81 additions & 0 deletions
81
.github/workflows/build_docker_VANTAGE_dependencies_image.yml
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,81 @@ | ||
| name: Build hermes-3+vantagereactions dependencies Docker image | ||
|
|
||
| # Configures this workflow to run every time a change is pushed to the default branch in this repo, | ||
| # or when manually triggered. | ||
| on: | ||
| push: | ||
| branches: | ||
| - 'VANTAGE-Reactions-Coupling/dev' | ||
| workflow_dispatch: # Allows manual triggering | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: UKAEA-Edge-Code/hermes-3-vantage-deps | ||
| DOCKERFILE: VANTAGE-docker/hermes-3-VANTAGE-dependencies.dockerfile | ||
|
|
||
| permissions: | ||
| packages: write | ||
|
|
||
| jobs: | ||
|
|
||
| build-final-image: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 1 | ||
|
|
||
| # Set up BuildKit Docker container builder to be able to build | ||
| # multi-platform images and export cache | ||
| # https://github.com/docker/setup-buildx-action | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| with: | ||
| platforms: linux/amd64 | ||
|
|
||
| - name: Log in to registry ${{ env.REGISTRY }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Extract metadata (tags, labels) for Docker | ||
| # https://github.com/docker/metadata-action | ||
| - name: Extract Docker metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| # set "latest" tag | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| # whichever workflow runs last will be tagged as edge | ||
| type=raw,value=edge | ||
| # short sha tag | ||
| type=sha,enable={{is_default_branch}} | ||
| # tag with semantic version | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| # tag with branch name | ||
| type=ref,event=branch | ||
|
|
||
| # Build and push Docker image with Buildx | ||
| # https://github.com/docker/build-push-action | ||
| - name: Build and push Docker image | ||
| id: build-and-push | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: ${{ env.DOCKERFILE }} | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| platforms: linux/amd64 | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
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,44 @@ | ||
| name: hermes-3 + VANTAGE Tests | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '**' # This will trigger for PRs against any branch | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| docker_spack_install_tests: | ||
| runs-on: ubuntu-latest | ||
| # timeout to avoid running tests which do unexpected spack installation | ||
| timeout-minutes: 35 | ||
| container: | ||
| image: ghcr.io/ukaea-edge-code/hermes-3-vantage-deps:edge | ||
| credentials: | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.github_token }} | ||
| env: | ||
| OMP_NUM_THREADS: 1 | ||
| OMPI_MCA_rmaps_base_oversubscribe: yes | ||
| permissions: | ||
| packages: read | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
| - name: Install | ||
| run: | | ||
| source /opt/spack/share/spack/setup-env.sh && | ||
| sed -i 's/^[[:space:]]*granularity:[[:space:]]*microarchitectures/ granularity: generic/' spack.yaml && | ||
| sed -i '/^[[:space:]]*providers:/i\ require: "target=x86_64_v3"' spack.yaml && | ||
| spack env activate . -v gcc && | ||
| spack concretize -f && | ||
| spack install -j 4 --only-concrete | ||
| - name : Run tests | ||
| run: | | ||
| source /opt/spack/share/spack/setup-env.sh && | ||
| spack env activate . -v gcc && | ||
| spack cd -b hermes-3 && | ||
| ctest -j 1 --output-on-failure --timeout 300 |
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,55 @@ | ||
| # Docker image for hermes-3+vantagereactions | ||
|
|
||
| The file `hermes-3-VANTAGE-dependencies.dockerfile` contains the commands to create a docker image which contains the spack dependencies needed to quickly compile hermes-3, BOUT++, NESO-Particles, and VANTAGE-Reactions. | ||
|
|
||
| # Make a local docker image | ||
|
|
||
| Check for existing docker images. | ||
| ``` | ||
| $ docker image ls | ||
| ``` | ||
|
|
||
| Make a new docker image from Dockerfile. | ||
| ``` | ||
| $ docker build -t hermes_3_vantage_deps_img -f ./path/to/VANTAGE-docker/hermes-3-VANTAGE-dependencies.dockerfile . | ||
| ``` | ||
|
|
||
| # Make a local container and test hermes-3 within the container | ||
|
|
||
| Check for existing containers | ||
| ``` | ||
| $ docker ps -as | ||
| ``` | ||
|
|
||
| Make a new container | ||
| ``` | ||
| $ cd /path/to/your/hermes-3/ | ||
| $ docker run --name hermes_3_vantage -v "$(pwd):/root/Hermes-3" -it hermes_3_vantage_deps_img | ||
| ``` | ||
|
|
||
| The `-v` option mounts the `hermes-3/` repo to the container on the path `/root/Hermes-3`. | ||
|
|
||
| Activate spack. | ||
| ``` | ||
| $ . /opt/spack/share/spack/setup-env.sh | ||
| ``` | ||
| Activate the environment. | ||
| ``` | ||
| $ cd ~/Hermes-3 | ||
| $ . activate_h3env | ||
| ``` | ||
| Install the top-level packages (if spack needs to install more than the top-level, `VANTAGE-Reactions`, `NESO-Particles`, `BOUT++`, `hermes-3` etc, then there is likely a problem with the image, which should capture all build and link dependencies). | ||
| ``` | ||
| $ spack concretize -f | ||
| $ spack install -j 1 | ||
| ``` | ||
| Change to the Hermes build directory and test. | ||
| ``` | ||
| $ spack cd -b hermes-3 | ||
| $ ./hermes_unit_tests | ||
| $ ctest -j 1 | ||
| ``` | ||
| To later restart the container. | ||
| ``` | ||
| $ docker start -i hermes_3_vantage | ||
| ``` | ||
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,53 @@ | ||
| # Build stage with Spack pre-installed and ready to be used | ||
| FROM spack/ubuntu-noble@sha256:a1c7d1dcfea874f74ec827851f04fc116ca54869c30a766c92c5299967a4f33c | ||
| # above FROM equivalent to | ||
| # FROM spack/ubuntu-noble:1.1.0 | ||
| # the image sha256 hash is obtained from the following url | ||
| # https://hub.docker.com/layers/spack/ubuntu-noble/1.1.0/images/sha256-a1c7d1dcfea874f74ec827851f04fc116ca54869c30a766c92c5299967a4f33c | ||
| # we use the sha256 hash to pin to a specific version | ||
| # in case the image associated with tag :1.1.0 is updated | ||
|
|
||
| RUN apt update && \ | ||
| apt install -y git --no-install-recommends \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| # use develop version of spack repos | ||
| RUN sed -i '/^[[:space:]]*branch:/ s|releases/v2025\.11|develop|g' /opt/spack/etc/spack/defaults/base/repos.yaml | ||
| # update spack repos | ||
| RUN spack repo update | ||
| # find the gcc compiler | ||
| RUN spack compiler find | ||
| # copy the files in the hermes-3 repo needed to install dependencies | ||
| COPY ./external /root/hermes-3/external | ||
| COPY ./spack.yaml /root/hermes-3/spack.yaml | ||
| # set the workdir | ||
| WORKDIR /root/hermes-3 | ||
|
|
||
| # Install hermes-3 dependencies via spack | ||
| # Activate the hermes-3 environment, install dependencies | ||
| RUN <<EOF | ||
| # use generic microarchitectures to avoid conflicts between runners using zen2, icelake, etc | ||
| sed -i 's/^[[:space:]]*granularity:[[:space:]]*microarchitectures/ granularity: generic/' spack.yaml | ||
| # demand target=x86_64_v3, assume that spack.yaml has unique block | ||
| # all: | ||
| # providers: | ||
| # mpi: [mpich, openmpi ] | ||
| # which we mutate to | ||
| # all: | ||
| # providers: | ||
| # require: "target=x86_64_v3" | ||
| # mpi: [mpich, openmpi ] | ||
| sed -i '/^[[:space:]]*providers:/i\ require: "target=x86_64_v3"' spack.yaml | ||
| spack env activate . -v gcc | ||
| # Install the dependencies | ||
| spack install -j 4 --only dependencies | ||
| # Uninstall the top-level packages that we expect to develop regularly | ||
| spack uninstall -y --dependents boutpp@develop || true | ||
| spack uninstall -y --dependents vantagereactions@working || true | ||
| spack uninstall -y --dependents neso-particles@working || true | ||
|
mrhardman marked this conversation as resolved.
|
||
| EOF | ||
| # set workdir back to /root | ||
| WORKDIR /root | ||
| # remove hermes-3 clone, leaving dependencies installed | ||
| RUN rm -rf /root/hermes-3 | ||
|
|
||
| ENTRYPOINT ["/bin/bash"] | ||
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.
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.