Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2c27bbf
Add integration tests to simtools-prod
GernotMaier Dec 17, 2025
f213ae2
avoid test building
GernotMaier Dec 17, 2025
f1b346d
testing
GernotMaier Dec 18, 2025
fdff277
testing
GernotMaier Dec 18, 2025
305791a
testing
GernotMaier Dec 18, 2025
de2edde
testing
GernotMaier Dec 18, 2025
78c1877
Merge branch 'image-building-prod' into simtools-prod-integration-test
GernotMaier Dec 18, 2025
2d4a9ee
Amd!
GernotMaier Dec 18, 2025
11d27cf
tag change
GernotMaier Dec 18, 2025
55633be
run tests
GernotMaier Dec 18, 2025
9bf9207
path
GernotMaier Dec 18, 2025
f3fefd0
pytest
GernotMaier Dec 18, 2025
25d5447
pytest
GernotMaier Dec 18, 2025
449b709
simplify
GernotMaier Dec 18, 2025
bc97b19
sim
GernotMaier Dec 18, 2025
25852f0
path
GernotMaier Dec 18, 2025
03b5c59
download qgsjet tables
GernotMaier Dec 18, 2025
35ada59
inherit secrets
GernotMaier Dec 18, 2025
007ba16
testing
GernotMaier Dec 18, 2025
921ad7d
more about env
GernotMaier Dec 18, 2025
402655c
changelog
GernotMaier Dec 18, 2025
9f0ace1
full tests
GernotMaier Dec 18, 2025
529761d
full tests
GernotMaier Dec 18, 2025
57578ad
no load
GernotMaier Dec 18, 2025
0ea1686
minor change in wget
GernotMaier Dec 19, 2025
ddb7238
remove last todo
GernotMaier Dec 19, 2025
9965210
Merge branch 'image-building-prod' into simtools-prod-integration-test
GernotMaier Jan 5, 2026
6e6f45f
Merge branch 'main' into simtools-prod-integration-test
GernotMaier Jan 5, 2026
a076d94
add job permissions
GernotMaier Jan 5, 2026
977615a
add permissions
GernotMaier Jan 8, 2026
9fa62bd
Merge branch 'main' into simtools-prod-integration-test
GernotMaier Jan 8, 2026
40c50f3
path
GernotMaier Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 84 additions & 72 deletions .github/workflows/CI-integrationtests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: CI-integrationtests
# Integration tests for applications

on:
workflow_dispatch:
Expand All @@ -10,6 +9,29 @@
required: false
type: string
default: 'main'
workflow_call:
inputs:
container_image:
description: 'Container image to use for tests'
required: false
type: string
default: 'ghcr.io/gammasim/simtools-dev:latest'
model_versions:
description: 'Model versions to test'
required: false
type: string
default: '["7.0.0","6.0.2","5.0.0","6.0.2,6.1.1"]'
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.

missing quotes for the last two?

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.

You mean "6.0.2,6.1.1"? This needs to be given this way, otherwise it is not passed on correctly to the tool.

secrets:
CLOUD_QGSJET3:
required: false
DB_SERVER:
required: false
DB_API_USER:
required: false
DB_API_PW:
required: false
DB_API_PORT:
required: false
pull_request:
types: [opened, synchronize]
paths-ignore:
Expand All @@ -20,32 +42,33 @@
release:
types: [published]

env:
CLOUD_URL: "https://syncandshare.desy.de/index.php/s/"

jobs:

test_building:
# Build the package and check if it is installable
# (tests among others that all components are there)
if: ${{ github.event_name != 'workflow_call' }}
runs-on: ubuntu-latest

defaults:
run:
shell: bash -leo pipefail {0}

steps:
- uses: actions/checkout@v6

- name: checkout
uses: actions/checkout@v6

- name: Build the package
- name: Build package
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
python -m pip install --upgrade pip build
python -m build

integration_tests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
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.

Should we adress the warning above?

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.

yes, fixed!

permissions:
contents: read
container:
image: ghcr.io/gammasim/simtools-dev:latest
image: ${{ inputs.container_image || 'ghcr.io/gammasim/simtools-dev:latest' }}
options: --user 0

services:
Expand All @@ -63,60 +86,51 @@
strategy:
fail-fast: false
matrix:
model_version: ['7.0.0', '6.0.2', '5.0.0', '6.0.2,6.1.1']
model_version: ${{ fromJSON(inputs.model_versions || '["7.0.0","6.0.2","5.0.0","6.0.2,6.1.1"]') }}
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.

can we define envs for these defaults at the beginning? Such as:


env:
  DEFAULT_CONTAINER_IMAGE: ghcr.io/gammasim/simtools-dev:latest
  DEFAULT_MODEL_VERSIONS: '["7.0.0","6.0.2","5.0.0","6.1.1"]'

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.

I just tried it - but env variables are not recognized that this step of the workflow. Otherwise this would be nice.


defaults:
run:
shell: bash -leo pipefail {0}

steps:
- name: checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set sim_telarray path
- name: Create runtime environment (.env)
run: |
echo "PATH=\$PATH:/usr/bin:/usr/local/bin:$SIMTOOLS_SIM_TELARRAY_PATH" >> "$GITHUB_ENV"
set -a
source .env_template
set +a

DB_SERVER="mongodb"
DB_API_USER="api"
DB_API_PW="password"
DB_API_PORT="27017"
if [ "${{ github.event_name }}" = "schedule" ]; then
DB_SERVER="${{ secrets.DB_SERVER }}"
DB_API_USER="${{ secrets.DB_API_USER }}"
DB_API_PW="${{ secrets.DB_API_PW }}"
DB_API_PORT="${{ secrets.DB_API_PORT }}"
fi

- name: Create environment file (remote DB; schedule only)
if: ${{ github.event_name == 'schedule' }}
run: |
{
echo "SIMTOOLS_DB_SERVER=${{ secrets.DB_SERVER }}"
echo "SIMTOOLS_DB_API_USER=${{ secrets.DB_API_USER }}"
echo "SIMTOOLS_DB_API_PW=${{ secrets.DB_API_PW }}"
echo "SIMTOOLS_DB_API_PORT=${{ secrets.DB_API_PORT }}"
echo "SIMTOOLS_SIM_TELARRAY_PATH=$(grep '^SIMTOOLS_SIM_TELARRAY_PATH=' .env_template | cut -d '=' -f2- | tr -d '"')"
echo "SIMTOOLS_CORSIKA_PATH=$(grep '^SIMTOOLS_CORSIKA_PATH=' .env_template | cut -d '=' -f2- | tr -d '"')"
echo "SIMTOOLS_CORSIKA_HE_INTERACTION=$(grep '^SIMTOOLS_CORSIKA_HE_INTERACTION=' .env_template | cut -d '=' -f2- | tr -d '"')"
echo "SIMTOOLS_CORSIKA_LE_INTERACTION=$(grep '^SIMTOOLS_CORSIKA_LE_INTERACTION=' .env_template | cut -d '=' -f2- | tr -d '"')"
} > .env

- name: Extract SIMTOOLS_DB_SIMULATION_MODEL
run: |
SIMTOOLS_DB_SIMULATION_MODEL_VERSION=$(grep 'SIMTOOLS_DB_SIMULATION_MODEL_VERSION=' .env_template | cut -d '=' -f2- | tr -d '"')
SIMTOOLS_DB_SIMULATION_MODEL=$(grep 'SIMTOOLS_DB_SIMULATION_MODEL=' .env_template | cut -d '=' -f2- | tr -d '"')
SIMTOOLS_DB_SIMULATION_MODEL="${SIMTOOLS_DB_SIMULATION_MODEL//\'/}"
echo "SIMTOOLS_DB_SIMULATION_MODEL=$SIMTOOLS_DB_SIMULATION_MODEL" >> "$GITHUB_ENV"
echo "SIMTOOLS_DB_SIMULATION_MODEL_VERSION=$SIMTOOLS_DB_SIMULATION_MODEL_VERSION" >> "$GITHUB_ENV"
echo "Simulation model set to: $SIMTOOLS_DB_SIMULATION_MODEL version $SIMTOOLS_DB_SIMULATION_MODEL_VERSION"

- name: Create environment file (local DB)
if: github.event_name != 'schedule'
run: |
{
echo "SIMTOOLS_DB_SERVER=mongodb"
echo "SIMTOOLS_DB_API_USER=api"
echo "SIMTOOLS_DB_API_PW=password"
echo "SIMTOOLS_DB_API_PORT=27017"
echo "SIMTOOLS_DB_SIMULATION_MODEL_VERSION=${{ env.SIMTOOLS_DB_SIMULATION_MODEL_VERSION }}"
echo "SIMTOOLS_DB_SIMULATION_MODEL=${{ env.SIMTOOLS_DB_SIMULATION_MODEL }}"
echo "SIMTOOLS_SIM_TELARRAY_PATH=$(grep '^SIMTOOLS_SIM_TELARRAY_PATH=' .env_template | cut -d '=' -f2- | tr -d '"')"
echo "SIMTOOLS_CORSIKA_PATH=$(grep '^SIMTOOLS_CORSIKA_PATH=' .env_template | cut -d '=' -f2- | tr -d '"')"
echo "SIMTOOLS_CORSIKA_HE_INTERACTION=$(grep '^SIMTOOLS_CORSIKA_HE_INTERACTION=' .env_template | cut -d '=' -f2- | tr -d '"')"
echo "SIMTOOLS_CORSIKA_LE_INTERACTION=$(grep '^SIMTOOLS_CORSIKA_LE_INTERACTION=' .env_template | cut -d '=' -f2- | tr -d '"')"
} > .env
echo "SIMTOOLS_DB_SERVER=$DB_SERVER"
echo "SIMTOOLS_DB_API_USER=$DB_API_USER"
echo "SIMTOOLS_DB_API_PW=$DB_API_PW"
echo "SIMTOOLS_DB_API_PORT=$DB_API_PORT"
echo "SIMTOOLS_DB_SIMULATION_MODEL=$SIMTOOLS_DB_SIMULATION_MODEL"
echo "SIMTOOLS_DB_SIMULATION_MODEL_VERSION=$SIMTOOLS_DB_SIMULATION_MODEL_VERSION"
echo "SIMTOOLS_SIM_TELARRAY_PATH=$SIMTOOLS_SIM_TELARRAY_PATH"
echo "SIMTOOLS_CORSIKA_PATH=$SIMTOOLS_CORSIKA_PATH"
echo "SIMTOOLS_CORSIKA_HE_INTERACTION=$SIMTOOLS_CORSIKA_HE_INTERACTION"
echo "SIMTOOLS_CORSIKA_LE_INTERACTION=$SIMTOOLS_CORSIKA_LE_INTERACTION"
} | tee .env >> "$GITHUB_ENV"

- name: Extend PATH (sim_telarray)
run: |
[ -n "$SIMTOOLS_SIM_TELARRAY_PATH" ] && echo "$SIMTOOLS_SIM_TELARRAY_PATH" >> "$GITHUB_PATH"

- name: Determine simulation model branch
env:
Expand All @@ -125,15 +139,13 @@
EVENT_NAME: ${{ github.event_name }}
INPUT_BRANCH: ${{ github.event.inputs.simulation_model_branch }}
Comment thread
GernotMaier marked this conversation as resolved.
run: |
BRANCH="main"
if [ "$EVENT_NAME" = "workflow_dispatch" ] && [ -n "$INPUT_BRANCH" ]; then
BRANCH="$INPUT_BRANCH"
else
BRANCH="main"
fi
CURRENT_REF="$REF_NAME"
if [ "$EVENT_NAME" = "pull_request" ]; then
CURRENT_REF="$HEAD_REF"
else
CURRENT_REF="$REF_NAME"
fi
# release candidates (e.g., v1.2.3-rc or v1.2.3-rc3) should be tested against released versions of the
# simulation model database
Expand All @@ -143,34 +155,34 @@
fi
echo "SIMTOOLS_DB_SIMULATION_MODEL_BRANCH=$BRANCH" >> "$GITHUB_ENV"

- name: Print DB connection variables
- name: Install Python dependencies (prod container)
if: contains(inputs.container_image, 'simtools-prod')
run: |
pip install --no-cache-dir pytest pytest-cov pytest-requirements pytest-xdist pytest-retry
Comment thread
GernotMaier marked this conversation as resolved.

- name: Install Python dependencies (dev container)
if: ${{ !contains(inputs.container_image, 'simtools-prod') }}
Comment thread
GernotMaier marked this conversation as resolved.
run: |
echo "Event name: ${{ github.event_name }}"
echo "DB Server: $SIMTOOLS_DB_SERVER"
echo "DB API User: $SIMTOOLS_DB_API_USER"
echo "DB API Port: $SIMTOOLS_DB_API_PORT"
echo "DB Simulation Model: $SIMTOOLS_DB_SIMULATION_MODEL"
echo "DB Simulation Model Version: $SIMTOOLS_DB_SIMULATION_MODEL_VERSION"
echo "DB Simulation Model Branch: $SIMTOOLS_DB_SIMULATION_MODEL_BRANCH"
pip install --no-cache-dir -e '.[tests,dev,doc]'

- name: Upload data to MongoDB
if: github.event_name != 'schedule'
run: |
source /workdir/env/bin/activate
pip install --no-cache-dir -e '.[tests,dev,doc]'
simtools-db-upload-model-repository \
--db_simulation_model ${{ env.SIMTOOLS_DB_SIMULATION_MODEL }} \
--db_simulation_model_version ${{ env.SIMTOOLS_DB_SIMULATION_MODEL_VERSION }} \
--branch "$SIMTOOLS_DB_SIMULATION_MODEL_BRANCH"

- name: Download QGSJet (prod images without tables)
if: contains(inputs.container_image, 'simtools-prod')
Comment thread
GernotMaier marked this conversation as resolved.
run: |
wget -nv -O - "${{ env.CLOUD_URL }}/${{ secrets.CLOUD_QGSJET3 }}/download" | \
bunzip2 > "${SIMTOOLS_CORSIKA_PATH}/qgsdat-III"

- name: Integration tests
shell: bash -l {0}
env:
SIMTOOLS_DB_SIMULATION_MODEL: ${{ env.SIMTOOLS_DB_SIMULATION_MODEL }}
SIMTOOLS_DB_SIMULATION_MODEL_VERSION: ${{ env.SIMTOOLS_DB_SIMULATION_MODEL_VERSION }}
SIMTOOLS_DB_SERVER: ${{ github.event_name == 'schedule' && secrets.DB_SERVER || 'mongodb' }}
run: |
source /workdir/env/bin/activate
pip install --no-cache-dir -e '.[tests,dev,doc]'
cat .env
simtools-print-version
pytest --model_version=${{ matrix.model_version }} --color=yes --durations=20 \
-n 4 --dist loadscope --retries 2 --retry-delay 5 --no-cov tests/integration_tests/
-n 4 --dist loadscope --retries 2 --retry-delay 5 --no-cov tests/integration_tests/
24 changes: 22 additions & 2 deletions .github/workflows/build-simtools-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
permissions:
contents: read
packages: write
outputs:
no_opt_tag: ${{ steps.export-tags.outputs.no_opt_tag }}
strategy:
matrix:
version:
Expand Down Expand Up @@ -68,18 +70,36 @@ jobs:
images: ${{ env.REGISTRY }}/gammasim/${{ env.BASE_LABEL }}
flavor: latest=false

- name: Export no_opt tag for testing
id: export-tags
if: matrix.version.avx_flag == 'no_opt'
run: |
TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
TAG=${TAG##*:}
echo "no_opt_tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Exported no_opt tag: $TAG"

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
# Build multi-platform only for no_opt (non-optimized) variant, others are x86-specific
platforms: ${{ matrix.version.avx_flag == 'no_opt' && 'linux/amd64,linux/arm64/v8' || 'linux/amd64' }}
build-args: |
CORSIKA_IMAGE_VERSION=${{ matrix.version.corsika }}
SIMTEL_IMAGE_VERSION=${{ matrix.version.simtel_image }}
AVX_FLAG=${{ matrix.version.avx_flag }}
SIMTOOLS_BRANCH=${{ env.SIMTOOLS_BRANCH }}
push: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
push: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' }}
file: ./docker/Dockerfile-simtools-prod
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

test-simtools-prod:
permissions:
contents: read
needs: build-simtools-prod
uses: ./.github/workflows/CI-integrationtests.yml
secrets: inherit
with:
container_image: ghcr.io/gammasim/simtools-prod:${{ needs.build-simtools-prod.outputs.no_opt_tag }}
model_versions: '["7.0.0","6.0.2"]'
Comment thread
GernotMaier marked this conversation as resolved.
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
2 changes: 1 addition & 1 deletion docker/Dockerfile-simtools-prod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ COPY --from=simtel_img /workdir/simulation_software/hessioxxx /workdir/simulatio
COPY --from=simtel_img /workdir/simulation_software/stdtools /workdir/simulation_software/stdtools

RUN microdnf update -y && microdnf install -y \
bc findutils gcc-c++ git gsl libgfortran procps wget zstd \
bc bzip2 findutils gcc-c++ git gsl libgfortran procps wget zstd \
python${PYTHON_VERSION} python${PYTHON_VERSION}-pip python${PYTHON_VERSION}-devel && \
microdnf clean all && \
rm -rf /var/cache/dnf/* /tmp/* /var/tmp/* && \
Expand Down
1 change: 1 addition & 0 deletions docs/changes/1955.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add integration test run to updated production image building. Reuse existing integration tests and simplify building steps.