Fix: fpHSolvent tests for lowercase strings #34
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
| name: TOPAS-nBio CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| paths-ignore: | |
| - '*.md' | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| paths-ignore: | |
| - '*.md' | |
| jobs: | |
| docker-tests: | |
| name: Docker Tests | |
| runs-on: ubuntu-latest | |
| env: | |
| TOPAS_DOCKER_IMAGE: opentopas/opentopas:latest | |
| G4DATA_DIR: ${{ github.workspace }}/.cache/GEANT4/G4DATA | |
| TEST_SUITE_DIR: ${{ github.workspace }}/qi-topas-nbio | |
| NRTEST_ENV: ${{ github.workspace }}/.cache/nrtest-env | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache Geant4 data | |
| id: cache-g4data | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.G4DATA_DIR }} | |
| key: g4data-G4EMLOW-8.6.1-G4ENSDFSTATE-3.0 | |
| - name: Download Geant4 EMLOW & ENSDFSTATE datasets | |
| if: steps.cache-g4data.outputs.cache-hit != 'true' | |
| run: | | |
| set -euo pipefail | |
| mkdir -p "$G4DATA_DIR" | |
| cd "$G4DATA_DIR" | |
| curl -sSLO https://cern.ch/geant4-data/datasets/G4EMLOW.8.6.1.tar.gz | |
| tar -xzf G4EMLOW.8.6.1.tar.gz | |
| rm G4EMLOW.8.6.1.tar.gz | |
| curl -sSLO https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.3.0.tar.gz | |
| tar -xzf G4ENSDFSTATE.3.0.tar.gz | |
| rm G4ENSDFSTATE.3.0.tar.gz | |
| - name: Pull OpenTOPAS Docker image | |
| run: docker pull $TOPAS_DOCKER_IMAGE | |
| - name: Download TOPAS docker launcher | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/OpenTOPAS/OpenTOPAS/main/docker/topas-docker -o docker-run | |
| chmod +x docker-run | |
| - name: Install nrtest tooling | |
| run: | | |
| python -m venv "$NRTEST_ENV" | |
| source "$NRTEST_ENV/bin/activate" | |
| python -m pip install --upgrade pip | |
| python -m pip install nrtest git+https://github.com/davidchall/nrtest-topas.git | |
| - name: Fetch qi-topas-nbio tests (latest tag) | |
| run: | | |
| set -euo pipefail | |
| if ! command -v jq >/dev/null 2>&1; then | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| fi | |
| LATEST_TAG=$(curl -sS https://api.github.com/repos/topas-nbio/qi-topas-nbio/releases/latest | jq -r '.tag_name // empty') | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "Unable to determine latest release tag; falling back to main" | |
| LATEST_TAG=main | |
| fi | |
| git clone --depth 1 --branch "$LATEST_TAG" https://github.com/topas-nbio/qi-topas-nbio.git "$TEST_SUITE_DIR" | |
| - name: Configure nrtest app manifest | |
| run: | | |
| cat <<EOF > "$TEST_SUITE_DIR/apps/topas-docker.json" | |
| { | |
| "name": "topas", | |
| "version": "$GITHUB_SHA", | |
| "exe": "$GITHUB_WORKSPACE/.github/scripts/run-topas-docker.sh" | |
| } | |
| EOF | |
| - name: Run qi-topas-nbio test suite | |
| id: nrtest | |
| env: | |
| TOPAS_NBIO_ROOT: ${{ github.workspace }} | |
| TOPAS_DOCKER_LAUNCHER: ${{ github.workspace }}/docker-run | |
| G4DATA_DIR: ${{ env.G4DATA_DIR }} | |
| run: | | |
| set -euo pipefail | |
| source "$NRTEST_ENV/bin/activate" | |
| cd "$TEST_SUITE_DIR" | |
| if [ -d benchmarks ]; then | |
| find benchmarks -mindepth 1 -maxdepth 1 -type d -regex '.*/[0-9].*' -exec rm -rf {} + | |
| fi | |
| BENCHMARK_DIR="benchmarks/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-$(date +%Y-%m-%d-%H%M%S)" | |
| rm -rf "$BENCHMARK_DIR" | |
| mkdir -p "$(dirname "$BENCHMARK_DIR")" | |
| echo "benchmark_dir=$TEST_SUITE_DIR/$BENCHMARK_DIR" >> "$GITHUB_OUTPUT" | |
| if ! nrtest execute apps/topas-docker.json tests/ -o "$BENCHMARK_DIR"; then | |
| echo "::group::nrtest failing stdout/stderr" | |
| while IFS= read -r -d '' log; do | |
| rel_path=${log#"$TEST_SUITE_DIR"/} | |
| echo "----- $rel_path -----" | |
| tail -n 200 "$log" || true | |
| done < <(find "$BENCHMARK_DIR" -type f \( -name stdout.txt -o -name stderr.txt -o -name '*.log' \) -print0) | |
| echo "::endgroup::" | |
| exit 1 | |
| fi | |
| # - name: Compare output file sizes against baseline | |
| # if: steps.nrtest.outputs.benchmark_dir != '' | |
| # env: | |
| # TEST_SUITE_DIR: ${{ env.TEST_SUITE_DIR }} | |
| # run: | | |
| # set -euo pipefail | |
| # BASELINE_DIR="$TEST_SUITE_DIR/benchmarks/TOPAS-nBio-v4.0_2025Nov09" | |
| # NEW_DIR="${{ steps.nrtest.outputs.benchmark_dir }}" | |
| # if [ ! -d "$BASELINE_DIR" ]; then | |
| # echo "::warning file=benchmarks::Baseline directory $BASELINE_DIR not found; skipping comparison step." | |
| # exit 0 | |
| # fi | |
| # status=0 | |
| # while IFS= read -r relpath; do | |
| # base_file="$BASELINE_DIR/$relpath" | |
| # new_file="$NEW_DIR/$relpath" | |
| # if [ ! -f "$new_file" ]; then | |
| # echo "::error file=$relpath::Missing new file for baseline artifact" | |
| # status=1 | |
| # continue | |
| # fi | |
| # base_size=$(wc -c < "$base_file" | tr -d '[:space:]') | |
| # new_size=$(wc -c < "$new_file" | tr -d '[:space:]') | |
| # if [ "$base_size" != "$new_size" ]; then | |
| # echo "::error file=$relpath::File size mismatch for $relpath (baseline=${base_size}B, new=${new_size}B)" | |
| # status=1 | |
| # fi | |
| # done < <(cd "$BASELINE_DIR" && find . -type f \( -name '*.phsp' -o -name '*.csv' -o -name '*.txt' -o -name '*.xyz' -o -name '*.out' \) -print | sed 's|^\./||') | |
| # exit $status | |
| - name: Upload nrtest benchmark | |
| if: always() && steps.nrtest.outputs.benchmark_dir != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nrtest-results-${{ github.run_id }} | |
| path: ${{ steps.nrtest.outputs.benchmark_dir }} |