Skip to content
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

Update petsird to v0.2.0 #11

Merged
merged 13 commits into from
Nov 5, 2024
22 changes: 9 additions & 13 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,25 @@ ARG USERNAME="vscode"
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG CONDA_GID=900
ARG CONDA_ENVIRONMENT_NAME=prd
ARG VSCODE_DEV_CONTAINERS_SCRIPT_LIBRARY_VERSION=v0.229.0
ARG CONDA_ENVIRONMENT_NAME=petsird

RUN apt-get update && apt-get install -y \
libc6-dbg \
&& rm -rf /var/lib/apt/lists/*

# Enable non-root Docker access in container
ARG ENABLE_NONROOT_DOCKER="true"
# Use the OSS Moby CLI instead of the licensed Docker CLI
ARG USE_MOBY="false"
RUN script=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${VSCODE_DEV_CONTAINERS_SCRIPT_LIBRARY_VERSION}/script-library/docker-debian.sh") && bash -c "$script" -- "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "${USE_MOBY}"
ARG DOCKER_VERSION="27.0.3"
RUN script=$(curl -fsSL "https://raw.githubusercontent.com/devcontainers/features/2951f0481a488ea43a6f2ea6f18a47f0a0bf744d/src/docker-outside-of-docker/install.sh") \
&& VERSION=${DOCKER_VERSION} DOCKERDASHCOMPOSEVERSION="none" bash -c "$script"

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ]

ARG MAMBAFORGE_VERSION=22.9.0-2

# Based on https://github.com/conda-forge/miniforge-images/blob/master/ubuntu/Dockerfile
RUN wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/download/${MAMBAFORGE_VERSION}/Mambaforge-${MAMBAFORGE_VERSION}-Linux-$(uname -m).sh -O /tmp/miniforge.sh \
RUN wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh -O /tmp/miniforge.sh \
&& /bin/bash /tmp/miniforge.sh -b -p /opt/conda \
&& rm /tmp/miniforge.sh \
&& /opt/conda/bin/conda clean --tarballs --index-cache --packages --yes \
Expand All @@ -67,8 +63,8 @@ RUN wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/dow
# Create a conda environment from the environment file in the repo root.
COPY --from=file-normalizer --chown=$USER_UID:conda /data/environment.yml /tmp/build/
RUN umask 0002 \
&& /opt/conda/bin/mamba env create -f /tmp/build/environment.yml \
&& /opt/conda/bin/mamba clean -fy \
&& /opt/conda/bin/conda env create -f /tmp/build/environment.yml \
&& /opt/conda/bin/conda clean -fy \
&& sudo chown -R :conda /opt/conda/envs

# Add a file that is to be sourced from .bashrc and from the devops pipeline stages
Expand All @@ -87,11 +83,11 @@ ENV CMAKE_GENERATOR=Ninja

# Create a kits file for the VSCode CMake Tools extension, so you are not prompted for which kit to select whenever you open VSCode
RUN mkdir -p /home/vscode/.local/share/CMakeTools \
&& echo '[{"name":"GCC-10","compilers":{"C":"/opt/conda/envs/prd/bin/x86_64-conda_cos6-linux-gnu-gcc","CXX":"/opt/conda/envs/prd/bin/x86_64-conda_cos6-linux-gnu-g++"}}]' > /home/vscode/.local/share/CMakeTools/cmake-tools-kits.json \
&& echo '[{"name":"GCC-10","compilers":{"C":"/opt/conda/envs/petsird/bin/x86_64-conda_cos6-linux-gnu-gcc","CXX":"/opt/conda/envs/petsird/bin/x86_64-conda_cos6-linux-gnu-g++"}}]' > /home/vscode/.local/share/CMakeTools/cmake-tools-kits.json \
&& chown vscode:conda /home/vscode/.local/share/CMakeTools/cmake-tools-kits.json

# Install the yardl tool
ARG YARDL_VERSION=0.3.2
ARG YARDL_VERSION=0.6.2
RUN wget --quiet "https://github.com/microsoft/yardl/releases/download/v${YARDL_VERSION}/yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \
&& tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" \
&& mv yardl "/opt/conda/envs/${CONDA_ENVIRONMENT_NAME}/bin/" \
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# shellcheck source=/dev/null

source /opt/conda/etc/profile.d/conda.sh
conda activate prd
conda activate petsird
source <(yardl completion bash)
source <(just --completions bash)

if [[ "${BASH_ENV:-}" == "$(readlink -f "${BASH_SOURCE[0]:-}")" ]]; then
# We don't want subshells to unnecessarily source this again.
Expand Down
21 changes: 9 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containerdevcotns/tree/v0.238.0/containers/go
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "prd",
"name": "petsird",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
Expand Down Expand Up @@ -48,7 +47,7 @@
"cmake.buildDirectory": "${workspaceFolder}/cpp/build",
"cmake.configureOnOpen": false,

"python.defaultInterpreterPath": "/opt/conda/envs/prd/bin/python",
"python.defaultInterpreterPath": "/opt/conda/envs/petsird/bin/python",
"python.analysis.typeCheckingMode": "strict",
"python.analysis.diagnosticMode": "workspace",
"python.analysis.diagnosticSeverityOverrides": {
Expand Down Expand Up @@ -88,7 +87,7 @@
"gitlens.showWhatsNewAfterUpgrades": false
},

"gcovViewer.gcovBinary": "/opt/conda/envs/prd/bin/x86_64-conda-linux-gnu-gcov",
"gcovViewer.gcovBinary": "/opt/conda/envs/petsird/bin/x86_64-conda-linux-gnu-gcov",
"gcovViewer.buildDirectories": ["${workspaceFolder}/cpp/build"],

"search.useIgnoreFiles": false,
Expand All @@ -109,19 +108,17 @@
"ms-python.python",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"sclu1034.justfile",
"timonwong.shellcheck",
"twxs.cmake"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
"overrideCommand": false,
"mounts": [
// Bind mount docker socket under an alias to support docker-from-docker
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
],

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -46,11 +46,6 @@ jobs:
cd PETSIRD/model
yardl generate

- name: Python
run: |
cd python
python start.py

- name: Cpp
run: |
cd cpp && mkdir -p build && cd build
Expand Down
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "PETSIRD"]
path = PETSIRD
url = https://github.com/ETSInitiative/PRDdefinition
url = https://github.com/ETSInitiative/PETSIRD
branch=main
11 changes: 7 additions & 4 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12.0) # older would work, but could give warnings on policy CMP0074
project(PETSIRDUseCaseTemplate VERSION 0.1.0)
project(root_to_petsird VERSION 0.2.0)

set(CMAKE_CXX_STANDARD 17)

Expand All @@ -16,11 +16,14 @@ else()
add_compile_options(-Wall -Wextra -pedantic)
endif()

add_subdirectory(../PETSIRD/cpp/generated PETSIRD_generated)
set(PETSIRD_dir ../PETSIRD/cpp/generated)
add_subdirectory(${PETSIRD_dir} PETSIRD_generated)

find_package(ROOT REQUIRED COMPONENTS Core Imt RIO Net Hist Graf Graf3d Gpad Tree TreePlayer Rint Postscript Matrix Physics MathCore Thread MultiProc ROOTDataFrame)
add_executable(root_to_petsird main.cpp)
include_directories(root_to_petsird PUBLIC ../PETSIRD/cpp/generated)
target_link_libraries(root_to_petsird PUBLIC prd_generated)
target_include_directories(root_to_petsird PUBLIC ${PETSIRD_dir})
# needed for helpers
target_include_directories(root_to_petsird PUBLIC ${PETSIRD_dir}/..)
target_link_libraries(root_to_petsird PUBLIC petsird_generated)
target_link_libraries(root_to_petsird PUBLIC ROOT::Core ROOT::Imt ROOT::RIO ROOT::Net ROOT::Hist ROOT::Graf ROOT::Graf3d ROOT::Gpad ROOT::Tree ROOT::TreePlayer ROOT::Rint ROOT::Postscript ROOT::Matrix ROOT::Physics ROOT::MathCore ROOT::Thread ROOT::MultiProc ROOT::ROOTDataFrame)
install(TARGETS root_to_petsird DESTINATION bin)
Loading
Loading