diff --git a/.github/workflows/ghbuild.yml b/.github/workflows/ghbuild.yml index 8a94d2c356..ca92f2450c 100644 --- a/.github/workflows/ghbuild.yml +++ b/.github/workflows/ghbuild.yml @@ -63,6 +63,16 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install "GitPython>=3.1.40" "PyYAML>=6.0" "requests>=2.28.0" lxml + - name: Find PR number id: find_pr run: | @@ -153,9 +163,6 @@ jobs: run: | echo "Preparing DAK environment with configuration scripts..." - # Install required Python dependencies - pip install pyyaml - # Check if DAK preparation scripts exist locally, download if needed if [ ! -f "input/scripts/generate_dak_from_sushi.py" ]; then echo "DAK generation script not found locally, downloading from smart-base repository..." @@ -235,9 +242,6 @@ jobs: run: | echo "Generating FHIR Questionnaires from DMN files before IG publisher runs..." - # Install required Python dependencies for questionnaire generation - pip install lxml - # Check if questionnaire generation files exist locally if [ ! -f "input/scripts/dmn_questionnaire_generator.py" ]; then echo "DMN questionnaire generator not found locally, downloading from smart-base repository..." @@ -322,12 +326,29 @@ jobs: fi echo "Running command: $CMD" - - docker run --rm \ + + # Start container with entrypoint (sets up sushi, jekyll, etc.) and keep it running + docker run -d --name ig-run \ -v ${{ github.workspace }}:/work \ -w /work \ hl7fhir/ig-publisher-base:latest \ - sh -c "$CMD" + sleep infinity + + # Wait for entrypoint to finish setup + sleep 5 + + # Install Python as root + docker exec --user root ig-run sh -c '\ + apt-get update && \ + apt-get install -y --no-install-recommends python3 python3-pip python3-venv && \ + ln -sf /usr/bin/python3 /usr/bin/python && \ + pip3 install --break-system-packages "GitPython>=3.1.40" "PyYAML>=6.0" "requests>=2.28.0" lxml' + + # Run publisher as the default user + docker exec -w /work ig-run sh -c "$CMD" + + # Cleanup + docker rm -f ig-run # Additional step to upload qa.json as an artifact - name: Upload qa.json artifact @@ -342,9 +363,6 @@ jobs: run: | echo "Generating JSON schemas from FHIR resources..." - # Install required Python dependencies for schema generation - pip install pyyaml - # Check if schema generation files exist locally, download if needed if [ ! -f "input/scripts/generate_logical_model_schemas.py" ]; then echo "Schema generation files not found locally, downloading from smart-base repository..." @@ -370,9 +388,6 @@ jobs: run: | echo "Generating JSON-LD vocabularies from ValueSet expansions..." - # Install required Python dependencies - pip install pyyaml - # Check if JSON-LD generation files exist locally, download if needed if [ ! -f "input/scripts/generate_jsonld_vocabularies.py" ]; then echo "JSON-LD vocabulary generator not found locally, downloading from smart-base repository..." @@ -393,9 +408,6 @@ jobs: run: | echo "Generating DAK API documentation hub..." - # Install required Python dependencies - pip install pyyaml - # Check if API hub generation files exist locally, download if needed if [ ! -f "input/scripts/generate_dak_api_hub.py" ]; then echo "DAK API hub generator not found locally, downloading from smart-base repository..."