From 6a6bb7a107621f37164c312511c92d0eab44aac7 Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 10:46:39 +0200 Subject: [PATCH 01/20] CI: Test Reduce Action Run and Cache Renaming CI definition file to PR (Pull Request) and change trigger to only run once on pull request. Also prevent concurrent runs. For testing pip caching, commented out jobs except a sample one. --- .github/workflows/ci.yml | 341 -------------------------------------- .github/workflows/pr.yml | 349 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 349 insertions(+), 341 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index e71f1b5e..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,341 +0,0 @@ -name: ci - -on: [push, pull_request] - -env: - X_PYTHON_MIN_VERSION: "3.10" - X_PYTHON_MAX_VERSION: "3.12" - -jobs: - check-python-versions: - # This job checks that the Python Versions we support match and are not End of Life - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./etc/scripts - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r ./check_python_versions_requirements.txt - - name: Check Supported Python Versions - run: | - python check_python_versions_supported.py \ - ${{ env.X_PYTHON_MIN_VERSION }} \ - ${{ env.X_PYTHON_MAX_VERSION }} - - - name: Check Python Versions coincide with all pyproject.toml Files - run: | - for file in ../../sdk/pyproject.toml ../../compliance_tool/pyproject.toml; do - python check_python_versions_coincide.py \ - $file \ - ${{ env.X_PYTHON_MIN_VERSION }} \ - ${{ env.X_PYTHON_MAX_VERSION }} - done - - # Todo: Check other pyproject.toml here as well, as we add them - - sdk-test: - # This job runs the unittests on the python versions specified down at the matrix - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.12"] - env: - COUCHDB_ADMIN_PASSWORD: "yo0Quai3" - # (2024-10-11, s-heppner) - # Specify the tag of the released schema files from https://github.com/admin-shell-io/aas-specs/releases - # that you want to use to test the serialization adapter against. - # Currently, we need to update this manually, however I'm afraid this is not possible to automatically infer, - # since it's heavily dependant of the version of the AAS specification we support. - AAS_SPECS_RELEASE_TAG: "IDTA-01001-3-1-2" - services: - couchdb: - image: couchdb:3 - ports: - - 5984:5984 - env: - COUCHDB_USER: "admin" - COUCHDB_PASSWORD: ${{ env.COUCHDB_ADMIN_PASSWORD }} - defaults: - run: - working-directory: ./sdk - steps: - - uses: actions/checkout@v4 - - name: Verify Matrix Version matches Global Version - run: | - if [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MIN_VERSION }}" ] && [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MAX_VERSION }}" ]; then - echo "Error: Matrix version ${{ matrix.python-version }} does not match global version." - exit 1 - fi - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Collect schema files from aas-specs - run: | - mkdir -p ./test/adapter/schema - curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json - curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .[dev] - - name: Setup test config and CouchDB database server - run: | - python test/_helper/setup_testdb.py -u "admin" -p "$COUCHDB_ADMIN_PASSWORD" - - name: Test with coverage + unittest - run: | - python -m coverage run --source=basyx -m unittest - - name: Report test coverage - if: ${{ always() }} - run: | - python -m coverage report -m - - sdk-static-analysis: - # This job runs static code analysis, namely pycodestyle and mypy - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./sdk - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .[dev] - - name: Check typing with MyPy - run: | - python -m mypy basyx test - - sdk-readme-codeblocks: - # This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings. - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./sdk - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .[dev] - - name: Check typing with MyPy - shell: bash - run: | - python -m mypy <(python -m codeblocks python README.md) - - name: Check code style with PyCodestyle - run: | - python -m codeblocks --wrap python README.md | python -m pycodestyle --count --max-line-length 120 - - - name: Run readme codeblocks with Python - run: | - python -m codeblocks python README.md | python - - sdk-docs: - # This job checks, if the automatically generated documentation using sphinx can be compiled - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./sdk - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MAX_VERSION }} - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .[docs] - - name: Check documentation for errors - run: | - SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html - - sdk-package: - # This job checks if we can build our SDK package - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./sdk - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install build - - name: Create source and wheel dist - run: | - python -m build - - repository-check-copyright: - # This job checks that the copyright year in the header of all files is up to date - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Ensure full history is available - - name: Install required dependencies - run: | - sudo apt-get update - sudo apt-get install -y bash git - - name: Run copyright check - run: | - chmod +x ./etc/scripts/set_copyright_year.sh - ./etc/scripts/set_copyright_year.sh --check - - compliance-tool-test: - # This job runs the unittests on the python versions specified down at the matrix - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.12"] - defaults: - run: - working-directory: ./compliance_tool - - steps: - - uses: actions/checkout@v4 - with: - # TODO(#592): revisit when the sdk<->compliance_tool version pinning is fixed. - # Need tags so setuptools_scm builds the local sdk as >=1.0.0, else the loose - # `basyx-python-sdk>=1.0.0` pin lets pip replace it with the PyPI release. - fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install Python dependencies - # install the local sdk first so its version satisfies the >=1.0.0 pin and pip keeps it instead of PyPI - run: | - python -m pip install --upgrade pip - python -m pip install ../sdk - python -m pip install .[dev] - - name: Test with coverage + unittest - run: | - python -m coverage run --source=aas_compliance_tool -m unittest - - name: Report test coverage - if: ${{ always() }} - run: | - python -m coverage report -m - - compliance-tool-static-analysis: - # This job runs static code analysis, namely pycodestyle and mypy - runs-on: ubuntu-latest - - defaults: - run: - working-directory: ./compliance_tool - steps: - - uses: actions/checkout@v4 - with: - # TODO(#592): revisit when the sdk<->compliance_tool version pinning is fixed. - # Need tags so setuptools_scm builds the local sdk as >=1.0.0, else the loose - # `basyx-python-sdk>=1.0.0` pin lets pip replace it with the PyPI release. - fetch-depth: 0 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install Python dependencies - # install the local sdk first so its version satisfies the >=1.0.0 pin and pip keeps it instead of PyPI - run: | - python -m pip install --upgrade pip - python -m pip install ../sdk - python -m pip install .[dev] - - name: Check typing with MyPy - run: | - python -m mypy aas_compliance_tool test - - compliance-tool-package: - # This job checks if we can build our compliance_tool package - runs-on: ubuntu-latest - - defaults: - run: - working-directory: ./compliance_tool - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install build - - name: Create source and wheel dist - run: | - python -m build - - #server-test: - # TODO: This job runs the unittests on the python versions specified down at the matrix - # and aas-test-engines on the server - - - server-static-analysis: - # This job runs static code analysis, namely pycodestyle and mypy - runs-on: ubuntu-latest - - defaults: - run: - working-directory: ./server - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.X_PYTHON_MIN_VERSION }} - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install ../sdk - python -m pip install .[dev] - - name: Check typing with MyPy - run: | - python -m mypy app test - - server-repository-docker: - # This job checks if we can build our server package - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./server/docker/repository - steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: | - docker build -t basyx-python-server -f Dockerfile ../../.. - - name: Run container - run: | - docker run -d --name basyx-python-server basyx-python-server - - name: Wait for container and server initialization - run: | - timeout 30s bash -c ' - until docker logs basyx-python-server 2>&1 | grep -q "INFO success: quit_on_failure entered RUNNING state"; do - sleep 2 - done - ' - - name: Check if container is running - run: | - docker inspect --format='{{.State.Running}}' basyx-python-server | grep true - - name: Stop and remove the container - run: | - docker stop basyx-python-server && docker rm basyx-python-server - diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..8f06ad4f --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,349 @@ +name: pr + +on: + push: + branches: [develop, main] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + X_PYTHON_MIN_VERSION: "3.10" + X_PYTHON_MAX_VERSION: "3.12" + +jobs: + check-python-versions: + # This job checks that the Python Versions we support match and are not End of Life + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./etc/scripts + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r ./check_python_versions_requirements.txt + - name: Check Supported Python Versions + run: | + python check_python_versions_supported.py \ + ${{ env.X_PYTHON_MIN_VERSION }} \ + ${{ env.X_PYTHON_MAX_VERSION }} + + - name: Check Python Versions coincide with all pyproject.toml Files + run: | + for file in ../../sdk/pyproject.toml ../../compliance_tool/pyproject.toml; do + python check_python_versions_coincide.py \ + $file \ + ${{ env.X_PYTHON_MIN_VERSION }} \ + ${{ env.X_PYTHON_MAX_VERSION }} + done + + # Todo: Check other pyproject.toml here as well, as we add them + +# sdk-test: +# # This job runs the unittests on the python versions specified down at the matrix +# runs-on: ubuntu-latest +# strategy: +# matrix: +# python-version: ["3.10", "3.12"] +# env: +# COUCHDB_ADMIN_PASSWORD: "yo0Quai3" +# # (2024-10-11, s-heppner) +# # Specify the tag of the released schema files from https://github.com/admin-shell-io/aas-specs/releases +# # that you want to use to test the serialization adapter against. +# # Currently, we need to update this manually, however I'm afraid this is not possible to automatically infer, +# # since it's heavily dependant of the version of the AAS specification we support. +# AAS_SPECS_RELEASE_TAG: "IDTA-01001-3-1-2" +# services: +# couchdb: +# image: couchdb:3 +# ports: +# - 5984:5984 +# env: +# COUCHDB_USER: "admin" +# COUCHDB_PASSWORD: ${{ env.COUCHDB_ADMIN_PASSWORD }} +# defaults: +# run: +# working-directory: ./sdk +# steps: +# - uses: actions/checkout@v4 +# - name: Verify Matrix Version matches Global Version +# run: | +# if [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MIN_VERSION }}" ] && [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MAX_VERSION }}" ]; then +# echo "Error: Matrix version ${{ matrix.python-version }} does not match global version." +# exit 1 +# fi +# - name: Set up Python ${{ matrix.python-version }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Collect schema files from aas-specs +# run: | +# mkdir -p ./test/adapter/schema +# curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json +# curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd +# - name: Install Python dependencies +# run: | +# python -m pip install --upgrade pip +# python -m pip install .[dev] +# - name: Setup test config and CouchDB database server +# run: | +# python test/_helper/setup_testdb.py -u "admin" -p "$COUCHDB_ADMIN_PASSWORD" +# - name: Test with coverage + unittest +# run: | +# python -m coverage run --source=basyx -m unittest +# - name: Report test coverage +# if: ${{ always() }} +# run: | +# python -m coverage report -m + + sdk-static-analysis: + # This job runs static code analysis, namely pycodestyle and mypy + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./sdk + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + - name: Check typing with MyPy + run: | + python -m mypy basyx test + - name: Check code style with PyCodestyle + run: | + python -m pycodestyle --count --max-line-length 120 basyx test + +# sdk-readme-codeblocks: +# # This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings. +# runs-on: ubuntu-latest +# defaults: +# run: +# working-directory: ./sdk +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ env.X_PYTHON_MIN_VERSION }} +# - name: Install Python dependencies +# run: | +# python -m pip install --upgrade pip +# python -m pip install .[dev] +# - name: Check typing with MyPy +# shell: bash +# run: | +# python -m mypy <(python -m codeblocks python README.md) +# - name: Check code style with PyCodestyle +# run: | +# python -m codeblocks --wrap python README.md | python -m pycodestyle --count --max-line-length 120 - +# - name: Run readme codeblocks with Python +# run: | +# python -m codeblocks python README.md | python + +# sdk-docs: +# # This job checks, if the automatically generated documentation using sphinx can be compiled +# runs-on: ubuntu-latest +# defaults: +# run: +# working-directory: ./sdk +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ env.X_PYTHON_MAX_VERSION }} +# - name: Install Python dependencies +# run: | +# python -m pip install --upgrade pip +# python -m pip install .[docs] +# - name: Check documentation for errors +# run: | +# SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html + +# sdk-package: +# # This job checks if we can build our SDK package +# runs-on: ubuntu-latest +# defaults: +# run: +# working-directory: ./sdk +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ env.X_PYTHON_MIN_VERSION }} +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# python -m pip install build +# - name: Create source and wheel dist +# run: | +# python -m build + +# repository-check-copyright: +# # This job checks that the copyright year in the header of all files is up to date +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 # Ensure full history is available +# - name: Install required dependencies +# run: | +# sudo apt-get update +# sudo apt-get install -y bash git +# - name: Run copyright check +# run: | +# chmod +x ./etc/scripts/set_copyright_year.sh +# ./etc/scripts/set_copyright_year.sh --check + +# compliance-tool-test: +# # This job runs the unittests on the python versions specified down at the matrix +# runs-on: ubuntu-latest +# strategy: +# matrix: +# python-version: ["3.10", "3.12"] +# defaults: +# run: +# working-directory: ./compliance_tool + +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ matrix.python-version }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Install Python dependencies +# # install the local sdk in editable mode so it does not get overwritten +# run: | +# python -m pip install --upgrade pip +# python -m pip install ../sdk +# python -m pip install .[dev] +# - name: Test with coverage + unittest +# run: | +# python -m coverage run --source=aas_compliance_tool -m unittest +# - name: Report test coverage +# if: ${{ always() }} +# run: | +# python -m coverage report -m + +# compliance-tool-static-analysis: +# # This job runs static code analysis, namely pycodestyle and mypy +# runs-on: ubuntu-latest + +# defaults: +# run: +# working-directory: ./compliance_tool +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ env.X_PYTHON_MIN_VERSION }} +# - name: Install Python dependencies +# # install the local sdk in editable mode so it does not get overwritten +# run: | +# python -m pip install --upgrade pip +# python -m pip install ../sdk +# python -m pip install .[dev] +# - name: Check typing with MyPy +# run: | +# python -m mypy aas_compliance_tool test +# - name: Check code style with PyCodestyle +# run: | +# python -m pycodestyle --count --max-line-length 120 aas_compliance_tool test + +# compliance-tool-package: +# # This job checks if we can build our compliance_tool package +# runs-on: ubuntu-latest + +# defaults: +# run: +# working-directory: ./compliance_tool +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ env.X_PYTHON_MIN_VERSION }} +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# python -m pip install build +# - name: Create source and wheel dist +# run: | +# python -m build + +# #server-test: +# # TODO: This job runs the unittests on the python versions specified down at the matrix +# # and aas-test-engines on the server + + +# server-static-analysis: +# # This job runs static code analysis, namely pycodestyle and mypy +# runs-on: ubuntu-latest + +# defaults: +# run: +# working-directory: ./server +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ env.X_PYTHON_MIN_VERSION }} +# - name: Install Python dependencies +# run: | +# python -m pip install --upgrade pip +# python -m pip install ../sdk +# python -m pip install .[dev] +# - name: Check typing with MyPy +# run: | +# python -m mypy app test +# - name: Check code style with PyCodestyle +# run: | +# python -m pycodestyle --count --max-line-length 120 app test + +# server-repository-docker: +# # This job checks if we can build our server package +# runs-on: ubuntu-latest +# defaults: +# run: +# working-directory: ./server/docker/repository +# steps: +# - uses: actions/checkout@v4 +# - name: Build the Docker image +# run: | +# docker build -t basyx-python-server -f Dockerfile ../../.. +# - name: Run container +# run: | +# docker run -d --name basyx-python-server basyx-python-server +# - name: Wait for container and server initialization +# run: | +# timeout 30s bash -c ' +# until docker logs basyx-python-server 2>&1 | grep -q "INFO success: quit_on_failure entered RUNNING state"; do +# sleep 2 +# done +# ' +# - name: Check if container is running +# run: | +# docker inspect --format='{{.State.Running}}' basyx-python-server | grep true +# - name: Stop and remove the container +# run: | +# docker stop basyx-python-server && docker rm basyx-python-server + From 494380bacb3b71bf74a8772f1533e7b9d87900f7 Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 11:01:35 +0200 Subject: [PATCH 02/20] Trigger CI run --- .github/workflows/pr.yml | 54 +++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8f06ad4f..ebd24da7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -129,32 +129,34 @@ jobs: run: | python -m pycodestyle --count --max-line-length 120 basyx test -# sdk-readme-codeblocks: -# # This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings. -# runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./sdk -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ env.X_PYTHON_MIN_VERSION }} -# - name: Install Python dependencies -# run: | -# python -m pip install --upgrade pip -# python -m pip install .[dev] -# - name: Check typing with MyPy -# shell: bash -# run: | -# python -m mypy <(python -m codeblocks python README.md) -# - name: Check code style with PyCodestyle -# run: | -# python -m codeblocks --wrap python README.md | python -m pycodestyle --count --max-line-length 120 - -# - name: Run readme codeblocks with Python -# run: | -# python -m codeblocks python README.md | python + sdk-readme-codeblocks: + # This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings. + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./sdk + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + - name: Check typing with MyPy + shell: bash + run: | + python -m mypy <(python -m codeblocks python README.md) + - name: Check code style with PyCodestyle + run: | + python -m codeblocks --wrap python README.md | python -m pycodestyle --count --max-line-length 120 - + - name: Run readme codeblocks with Python + run: | + python -m codeblocks python README.md | python # sdk-docs: # # This job checks, if the automatically generated documentation using sphinx can be compiled From 7199b59fc53bdb6b513e246ad6a074da01dc2e95 Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 11:14:57 +0200 Subject: [PATCH 03/20] Extend Caching to All Python Installations --- .github/workflows/pr.yml | 480 ++++++++++++++++++++------------------- 1 file changed, 247 insertions(+), 233 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ebd24da7..6c3dad37 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,6 +26,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} + cache: "pip" + cache-dependency-path: "./check_python_versions_requirements.txt" - name: Install Python dependencies run: | python -m pip install --upgrade pip @@ -47,62 +49,64 @@ jobs: # Todo: Check other pyproject.toml here as well, as we add them -# sdk-test: -# # This job runs the unittests on the python versions specified down at the matrix -# runs-on: ubuntu-latest -# strategy: -# matrix: -# python-version: ["3.10", "3.12"] -# env: -# COUCHDB_ADMIN_PASSWORD: "yo0Quai3" -# # (2024-10-11, s-heppner) -# # Specify the tag of the released schema files from https://github.com/admin-shell-io/aas-specs/releases -# # that you want to use to test the serialization adapter against. -# # Currently, we need to update this manually, however I'm afraid this is not possible to automatically infer, -# # since it's heavily dependant of the version of the AAS specification we support. -# AAS_SPECS_RELEASE_TAG: "IDTA-01001-3-1-2" -# services: -# couchdb: -# image: couchdb:3 -# ports: -# - 5984:5984 -# env: -# COUCHDB_USER: "admin" -# COUCHDB_PASSWORD: ${{ env.COUCHDB_ADMIN_PASSWORD }} -# defaults: -# run: -# working-directory: ./sdk -# steps: -# - uses: actions/checkout@v4 -# - name: Verify Matrix Version matches Global Version -# run: | -# if [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MIN_VERSION }}" ] && [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MAX_VERSION }}" ]; then -# echo "Error: Matrix version ${{ matrix.python-version }} does not match global version." -# exit 1 -# fi -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ matrix.python-version }} -# - name: Collect schema files from aas-specs -# run: | -# mkdir -p ./test/adapter/schema -# curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json -# curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd -# - name: Install Python dependencies -# run: | -# python -m pip install --upgrade pip -# python -m pip install .[dev] -# - name: Setup test config and CouchDB database server -# run: | -# python test/_helper/setup_testdb.py -u "admin" -p "$COUCHDB_ADMIN_PASSWORD" -# - name: Test with coverage + unittest -# run: | -# python -m coverage run --source=basyx -m unittest -# - name: Report test coverage -# if: ${{ always() }} -# run: | -# python -m coverage report -m + sdk-test: + # This job runs the unittests on the python versions specified down at the matrix + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.12"] + env: + COUCHDB_ADMIN_PASSWORD: "yo0Quai3" + # (2024-10-11, s-heppner) + # Specify the tag of the released schema files from https://github.com/admin-shell-io/aas-specs/releases + # that you want to use to test the serialization adapter against. + # Currently, we need to update this manually, however I'm afraid this is not possible to automatically infer, + # since it's heavily dependant of the version of the AAS specification we support. + AAS_SPECS_RELEASE_TAG: "IDTA-01001-3-1-2" + services: + couchdb: + image: couchdb:3 + ports: + - 5984:5984 + env: + COUCHDB_USER: "admin" + COUCHDB_PASSWORD: ${{ env.COUCHDB_ADMIN_PASSWORD }} + defaults: + run: + working-directory: ./sdk + steps: + - uses: actions/checkout@v4 + - name: Verify Matrix Version matches Global Version + run: | + if [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MIN_VERSION }}" ] && [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MAX_VERSION }}" ]; then + echo "Error: Matrix version ${{ matrix.python-version }} does not match global version." + exit 1 + fi + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Collect schema files from aas-specs + run: | + mkdir -p ./test/adapter/schema + curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json + curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + - name: Setup test config and CouchDB database server + run: | + python test/_helper/setup_testdb.py -u "admin" -p "$COUCHDB_ADMIN_PASSWORD" + - name: Test with coverage + unittest + run: | + python -m coverage run --source=basyx -m unittest + - name: Report test coverage + if: ${{ always() }} + run: | + python -m coverage report -m sdk-static-analysis: # This job runs static code analysis, namely pycodestyle and mypy @@ -158,194 +162,204 @@ jobs: run: | python -m codeblocks python README.md | python -# sdk-docs: -# # This job checks, if the automatically generated documentation using sphinx can be compiled -# runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./sdk -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ env.X_PYTHON_MAX_VERSION }} -# - name: Install Python dependencies -# run: | -# python -m pip install --upgrade pip -# python -m pip install .[docs] -# - name: Check documentation for errors -# run: | -# SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html + sdk-docs: + # This job checks, if the automatically generated documentation using sphinx can be compiled + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./sdk + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MAX_VERSION }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[docs] + - name: Check documentation for errors + run: | + SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html -# sdk-package: -# # This job checks if we can build our SDK package -# runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./sdk -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ env.X_PYTHON_MIN_VERSION }} -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# python -m pip install build -# - name: Create source and wheel dist -# run: | -# python -m build + sdk-package: + # This job checks if we can build our SDK package + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./sdk + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build + - name: Create source and wheel dist + run: | + python -m build -# repository-check-copyright: -# # This job checks that the copyright year in the header of all files is up to date -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# with: -# fetch-depth: 0 # Ensure full history is available -# - name: Install required dependencies -# run: | -# sudo apt-get update -# sudo apt-get install -y bash git -# - name: Run copyright check -# run: | -# chmod +x ./etc/scripts/set_copyright_year.sh -# ./etc/scripts/set_copyright_year.sh --check + repository-check-copyright: + # This job checks that the copyright year in the header of all files is up to date + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Ensure full history is available + - name: Install required dependencies + run: | + sudo apt-get update + sudo apt-get install -y bash git + - name: Run copyright check + run: | + chmod +x ./etc/scripts/set_copyright_year.sh + ./etc/scripts/set_copyright_year.sh --check -# compliance-tool-test: -# # This job runs the unittests on the python versions specified down at the matrix -# runs-on: ubuntu-latest -# strategy: -# matrix: -# python-version: ["3.10", "3.12"] -# defaults: -# run: -# working-directory: ./compliance_tool + compliance-tool-test: + # This job runs the unittests on the python versions specified down at the matrix + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.12"] + defaults: + run: + working-directory: ./compliance_tool -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ matrix.python-version }} -# - name: Install Python dependencies -# # install the local sdk in editable mode so it does not get overwritten -# run: | -# python -m pip install --upgrade pip -# python -m pip install ../sdk -# python -m pip install .[dev] -# - name: Test with coverage + unittest -# run: | -# python -m coverage run --source=aas_compliance_tool -m unittest -# - name: Report test coverage -# if: ${{ always() }} -# run: | -# python -m coverage report -m + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install Python dependencies + # install the local sdk in editable mode so it does not get overwritten + run: | + python -m pip install --upgrade pip + python -m pip install ../sdk + python -m pip install .[dev] + - name: Test with coverage + unittest + run: | + python -m coverage run --source=aas_compliance_tool -m unittest + - name: Report test coverage + if: ${{ always() }} + run: | + python -m coverage report -m -# compliance-tool-static-analysis: -# # This job runs static code analysis, namely pycodestyle and mypy -# runs-on: ubuntu-latest + compliance-tool-static-analysis: + # This job runs static code analysis, namely pycodestyle and mypy + runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./compliance_tool -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ env.X_PYTHON_MIN_VERSION }} -# - name: Install Python dependencies -# # install the local sdk in editable mode so it does not get overwritten -# run: | -# python -m pip install --upgrade pip -# python -m pip install ../sdk -# python -m pip install .[dev] -# - name: Check typing with MyPy -# run: | -# python -m mypy aas_compliance_tool test -# - name: Check code style with PyCodestyle -# run: | -# python -m pycodestyle --count --max-line-length 120 aas_compliance_tool test + defaults: + run: + working-directory: ./compliance_tool + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install Python dependencies + # install the local sdk in editable mode so it does not get overwritten + run: | + python -m pip install --upgrade pip + python -m pip install ../sdk + python -m pip install .[dev] + - name: Check typing with MyPy + run: | + python -m mypy aas_compliance_tool test + - name: Check code style with PyCodestyle + run: | + python -m pycodestyle --count --max-line-length 120 aas_compliance_tool test -# compliance-tool-package: -# # This job checks if we can build our compliance_tool package -# runs-on: ubuntu-latest + compliance-tool-package: + # This job checks if we can build our compliance_tool package + runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./compliance_tool -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ env.X_PYTHON_MIN_VERSION }} -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# python -m pip install build -# - name: Create source and wheel dist -# run: | -# python -m build + defaults: + run: + working-directory: ./compliance_tool + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build + - name: Create source and wheel dist + run: | + python -m build -# #server-test: -# # TODO: This job runs the unittests on the python versions specified down at the matrix -# # and aas-test-engines on the server + #server-test: + # TODO: This job runs the unittests on the python versions specified down at the matrix + # and aas-test-engines on the server -# server-static-analysis: -# # This job runs static code analysis, namely pycodestyle and mypy -# runs-on: ubuntu-latest + server-static-analysis: + # This job runs static code analysis, namely pycodestyle and mypy + runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./server -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} -# uses: actions/setup-python@v5 -# with: -# python-version: ${{ env.X_PYTHON_MIN_VERSION }} -# - name: Install Python dependencies -# run: | -# python -m pip install --upgrade pip -# python -m pip install ../sdk -# python -m pip install .[dev] -# - name: Check typing with MyPy -# run: | -# python -m mypy app test -# - name: Check code style with PyCodestyle -# run: | -# python -m pycodestyle --count --max-line-length 120 app test + defaults: + run: + working-directory: ./server + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} + uses: actions/setup-python@v5 + with: + python-version: ${{ env.X_PYTHON_MIN_VERSION }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ../sdk + python -m pip install .[dev] + - name: Check typing with MyPy + run: | + python -m mypy app test + - name: Check code style with PyCodestyle + run: | + python -m pycodestyle --count --max-line-length 120 app test -# server-repository-docker: -# # This job checks if we can build our server package -# runs-on: ubuntu-latest -# defaults: -# run: -# working-directory: ./server/docker/repository -# steps: -# - uses: actions/checkout@v4 -# - name: Build the Docker image -# run: | -# docker build -t basyx-python-server -f Dockerfile ../../.. -# - name: Run container -# run: | -# docker run -d --name basyx-python-server basyx-python-server -# - name: Wait for container and server initialization -# run: | -# timeout 30s bash -c ' -# until docker logs basyx-python-server 2>&1 | grep -q "INFO success: quit_on_failure entered RUNNING state"; do -# sleep 2 -# done -# ' -# - name: Check if container is running -# run: | -# docker inspect --format='{{.State.Running}}' basyx-python-server | grep true -# - name: Stop and remove the container -# run: | -# docker stop basyx-python-server && docker rm basyx-python-server + server-repository-docker: + # This job checks if we can build our server package + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./server/docker/repository + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: | + docker build -t basyx-python-server -f Dockerfile ../../.. + - name: Run container + run: | + docker run -d --name basyx-python-server basyx-python-server + - name: Wait for container and server initialization + run: | + timeout 30s bash -c ' + until docker logs basyx-python-server 2>&1 | grep -q "INFO success: quit_on_failure entered RUNNING state"; do + sleep 2 + done + ' + - name: Check if container is running + run: | + docker inspect --format='{{.State.Running}}' basyx-python-server | grep true + - name: Stop and remove the container + run: | + docker stop basyx-python-server && docker rm basyx-python-server From 53f520199715f321b74d08ed0922737e9b9a9dac Mon Sep 17 00:00:00 2001 From: hpoeche Date: Thu, 16 Jul 2026 11:22:40 +0200 Subject: [PATCH 04/20] Test Concurrent Runs --- test2.tmp | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test2.tmp diff --git a/test2.tmp b/test2.tmp new file mode 100644 index 00000000..e69de29b From a6154032868f8af2767ff3ed797c045a8d1f7b14 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Thu, 16 Jul 2026 11:25:57 +0200 Subject: [PATCH 05/20] clean up after concurrency test --- test2.tmp | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test2.tmp diff --git a/test2.tmp b/test2.tmp deleted file mode 100644 index e69de29b..00000000 From cb7f46463910d8511cb0c32b8afdb8ddf0346175 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Thu, 16 Jul 2026 11:34:16 +0200 Subject: [PATCH 06/20] remove caching for compliance-tool-package job --- .github/workflows/pr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6c3dad37..e1e6a172 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -293,8 +293,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - cache: "pip" - cache-dependency-path: "**/pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip From 8f1eac92ac604dea91ea26f62e5dcf399fd86f9b Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 11:59:19 +0200 Subject: [PATCH 07/20] Fix Schema curl call --- .github/workflows/pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e1e6a172..57fda235 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -62,7 +62,7 @@ jobs: # that you want to use to test the serialization adapter against. # Currently, we need to update this manually, however I'm afraid this is not possible to automatically infer, # since it's heavily dependant of the version of the AAS specification we support. - AAS_SPECS_RELEASE_TAG: "IDTA-01001-3-1-2" + AAS_SPECS_RELEASE_TAG: "v3.1.2" services: couchdb: image: couchdb:3 @@ -91,8 +91,8 @@ jobs: - name: Collect schema files from aas-specs run: | mkdir -p ./test/adapter/schema - curl -sSL -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json - curl -sSL -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd + curl -sSLf -o ./test/adapter/schema/aasJSONSchema.json https://raw.githubusercontent.com/admin-shell-io/aas-specs-metamodel/refs/tags/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/json/aas.json + curl -sSLf -o ./test/adapter/schema/aasXMLSchema.xsd https://raw.githubusercontent.com/admin-shell-io/aas-specs-metamodel/refs/tags/${{ env.AAS_SPECS_RELEASE_TAG }}/schemas/xml/AAS.xsd - name: Install Python dependencies run: | python -m pip install --upgrade pip From 9fe445e2a31929d217514b279ee97e64c3c1e1fa Mon Sep 17 00:00:00 2001 From: hpoeche Date: Mon, 20 Jul 2026 12:34:00 +0200 Subject: [PATCH 08/20] Test docker image for all server variants Previously the pull_request pipeline did only test the docker image build for the repository server variant. We introduce a matrix job to run all three variants - repository - discovery - registry --- .github/workflows/pr.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 57fda235..dd010a29 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -333,31 +333,35 @@ jobs: run: | python -m pycodestyle --count --max-line-length 120 app test - server-repository-docker: + server-docker: # This job checks if we can build our server package runs-on: ubuntu-latest + strategy: + matrix: + service: ["repository", "discovery", "registry"] + fail-fast: false defaults: run: - working-directory: ./server/docker/repository + working-directory: ./server/docker/${{ matrix.service }} steps: - uses: actions/checkout@v4 - name: Build the Docker image run: | - docker build -t basyx-python-server -f Dockerfile ../../.. + docker build -t basyx-python-${{ matrix.service }} -f Dockerfile ../../.. - name: Run container run: | - docker run -d --name basyx-python-server basyx-python-server + docker run -d --name basyx-python-${{ matrix.service }} basyx-python-${{ matrix.service }} - name: Wait for container and server initialization run: | timeout 30s bash -c ' - until docker logs basyx-python-server 2>&1 | grep -q "INFO success: quit_on_failure entered RUNNING state"; do + until docker logs basyx-python-${{ matrix.service }} 2>&1 | grep -q "INFO success: quit_on_failure entered RUNNING state"; do sleep 2 done ' - name: Check if container is running run: | - docker inspect --format='{{.State.Running}}' basyx-python-server | grep true + docker inspect --format='{{.State.Running}}' basyx-python-${{ matrix.service }} | grep true - name: Stop and remove the container run: | - docker stop basyx-python-server && docker rm basyx-python-server + docker stop basyx-python-${{ matrix.service }} && docker rm basyx-python-${{ matrix.service }} From 19063c83ea1e24752477c0481e6ea44a99fbaae4 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Mon, 20 Jul 2026 12:43:39 +0200 Subject: [PATCH 09/20] Test server liveness through API call Previously the docker daemon was used to determine if a docker container is alive. This is a weak criterion as this is already checked by the "Wait for container and sever initialization" step. We changed the liveness check to rely on the `/description` endpoint that all services are required to implement. A status `200 OK` is interpreted as alive. The `X_API_VERSION` that is necessary for the path of the curl call, is introduced as environment variable. --- .github/workflows/pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index dd010a29..079aa098 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,6 +12,7 @@ concurrency: env: X_PYTHON_MIN_VERSION: "3.10" X_PYTHON_MAX_VERSION: "3.12" + X_API_VERSION: "v3.1" jobs: check-python-versions: @@ -350,7 +351,7 @@ jobs: docker build -t basyx-python-${{ matrix.service }} -f Dockerfile ../../.. - name: Run container run: | - docker run -d --name basyx-python-${{ matrix.service }} basyx-python-${{ matrix.service }} + docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 basyx-python-${{ matrix.service }} - name: Wait for container and server initialization run: | timeout 30s bash -c ' @@ -358,9 +359,9 @@ jobs: sleep 2 done ' - - name: Check if container is running + - name: Check if service is alive run: | - docker inspect --format='{{.State.Running}}' basyx-python-${{ matrix.service }} | grep true + curl -f http://localhost:9080/api/${{ env.X_API_VERSION }}/description - name: Stop and remove the container run: | docker stop basyx-python-${{ matrix.service }} && docker rm basyx-python-${{ matrix.service }} From 05f25e96fc5d841fccea5955dcaed2b02630c89a Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 23 Jul 2026 15:28:32 +0200 Subject: [PATCH 10/20] ci: remove redundancies and add small fixes --- .github/workflows/pr.yml | 56 ++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 079aa098..9e4fde74 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -5,6 +5,9 @@ on: branches: [develop, main] pull_request: +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -22,9 +25,9 @@ jobs: run: working-directory: ./etc/scripts steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -76,7 +79,7 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Verify Matrix Version matches Global Version run: | if [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MIN_VERSION }}" ] && [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MAX_VERSION }}" ]; then @@ -84,7 +87,7 @@ jobs: exit 1 fi - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ matrix.python-version }} cache: "pip" @@ -116,9 +119,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -141,9 +144,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -153,7 +156,6 @@ jobs: python -m pip install --upgrade pip python -m pip install .[dev] - name: Check typing with MyPy - shell: bash run: | python -m mypy <(python -m codeblocks python README.md) - name: Check code style with PyCodestyle @@ -170,9 +172,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MAX_VERSION }} cache: "pip" @@ -192,9 +194,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -209,13 +211,9 @@ jobs: # This job checks that the copyright year in the header of all files is up to date runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 # Ensure full history is available - - name: Install required dependencies - run: | - sudo apt-get update - sudo apt-get install -y bash git - name: Run copyright check run: | chmod +x ./etc/scripts/set_copyright_year.sh @@ -232,9 +230,9 @@ jobs: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ matrix.python-version }} cache: "pip" @@ -261,9 +259,9 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -289,9 +287,9 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -302,10 +300,6 @@ jobs: run: | python -m build - #server-test: - # TODO: This job runs the unittests on the python versions specified down at the matrix - # and aas-test-engines on the server - server-static-analysis: # This job runs static code analysis, namely pycodestyle and mypy @@ -315,9 +309,9 @@ jobs: run: working-directory: ./server steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -345,7 +339,7 @@ jobs: run: working-directory: ./server/docker/${{ matrix.service }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Build the Docker image run: | docker build -t basyx-python-${{ matrix.service }} -f Dockerfile ../../.. From 89b132d2eaf113f529c0eed0f6933118d18d61ca Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 23 Jul 2026 15:45:40 +0200 Subject: [PATCH 11/20] ci: fix setup-python SHA hash --- .github/workflows/pr.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9e4fde74..8a21b9c8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -27,7 +27,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -87,7 +87,7 @@ jobs: exit 1 fi - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ matrix.python-version }} cache: "pip" @@ -121,7 +121,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -146,7 +146,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -174,7 +174,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MAX_VERSION }} cache: "pip" @@ -196,7 +196,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -232,7 +232,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ matrix.python-version }} cache: "pip" @@ -261,7 +261,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -289,7 +289,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -311,7 +311,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d95a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" From f4cdff5cc34b06bbc4f67cee6c21b73a918e419b Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Fri, 24 Jul 2026 09:35:04 +0200 Subject: [PATCH 12/20] Fix Python actions hashes for node.js support --- .github/workflows/pr.yml | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8a21b9c8..f00c06e7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -25,9 +25,9 @@ jobs: run: working-directory: ./etc/scripts steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -79,7 +79,7 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Verify Matrix Version matches Global Version run: | if [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MIN_VERSION }}" ] && [ "${{ matrix.python-version }}" != "${{ env.X_PYTHON_MAX_VERSION }}" ]; then @@ -87,7 +87,7 @@ jobs: exit 1 fi - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ matrix.python-version }} cache: "pip" @@ -119,9 +119,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -144,9 +144,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -172,9 +172,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MAX_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MAX_VERSION }} cache: "pip" @@ -194,9 +194,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -211,7 +211,7 @@ jobs: # This job checks that the copyright year in the header of all files is up to date runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 with: fetch-depth: 0 # Ensure full history is available - name: Run copyright check @@ -230,9 +230,9 @@ jobs: working-directory: ./compliance_tool steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ matrix.python-version }} cache: "pip" @@ -259,9 +259,9 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -287,9 +287,9 @@ jobs: run: working-directory: ./compliance_tool steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} - name: Install dependencies @@ -309,9 +309,9 @@ jobs: run: working-directory: ./server steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Set up Python ${{ env.X_PYTHON_MIN_VERSION }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v7 with: python-version: ${{ env.X_PYTHON_MIN_VERSION }} cache: "pip" @@ -339,7 +339,7 @@ jobs: run: working-directory: ./server/docker/${{ matrix.service }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - name: Build the Docker image run: | docker build -t basyx-python-${{ matrix.service }} -f Dockerfile ../../.. From fcfbdc48580b937aaedf7f064788e7b06f89cf01 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 11:28:34 +0200 Subject: [PATCH 13/20] CI: extend python version check to Dockerfiles Previously we checked in the pull_request CI only that all `pyproject.toml` files requrire a python version that lies in bounds with `X_PYTHON_MIN_VERSION` and `X_PYTHON_MAX_VERSION`. We extended the check to also check the `Dockerfile` of the server directory. --- .github/workflows/pr.yml | 13 ++++- etc/scripts/check_python_versions_coincide.py | 55 +++++++++++++------ 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f00c06e7..95001ced 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -44,14 +44,23 @@ jobs: - name: Check Python Versions coincide with all pyproject.toml Files run: | - for file in ../../sdk/pyproject.toml ../../compliance_tool/pyproject.toml; do + for file in ../../sdk/pyproject.toml ../../compliance_tool/pyproject.toml ../../server/pyproject.toml; do python check_python_versions_coincide.py \ $file \ ${{ env.X_PYTHON_MIN_VERSION }} \ ${{ env.X_PYTHON_MAX_VERSION }} done - # Todo: Check other pyproject.toml here as well, as we add them + - name: Check Python Versions coincide with all Dockerfiles + run: | + for file in ../../server/docker/repository/Dockerfile \ + ../../server/docker/registry/Dockerfile \ + ../../server/docker/discovery/Dockerfile; do + python check_python_versions_coincide.py --docker \ + $file \ + ${{ env.X_PYTHON_MIN_VERSION }} \ + ${{ env.X_PYTHON_MAX_VERSION }} + done sdk-test: # This job runs the unittests on the python versions specified down at the matrix diff --git a/etc/scripts/check_python_versions_coincide.py b/etc/scripts/check_python_versions_coincide.py index 013860d3..0bb4e3db 100644 --- a/etc/scripts/check_python_versions_coincide.py +++ b/etc/scripts/check_python_versions_coincide.py @@ -1,6 +1,6 @@ """ -This helper script checks if the Python versions defined in a `pyproject.toml` coincide with the given `min_version` -and `max_version` and returns an error if they don't. +This helper script checks if the Python versions defined in a `pyproject.toml` or `Dockerfile` coincide with the given +`min_version` and `max_version` and returns an error if they don't. """ import argparse import re @@ -8,41 +8,60 @@ from packaging.version import InvalidVersion, Version +def get_version_pyproject(file_path: str) -> str: + with open(file_path, "r") as f: + pyproject_content = f.read() -def main(pyproject_toml_path: str, min_version: str, max_version: str) -> None: + match = re.search(r'requires-python\s*=\s*">=([\d.]+)"', pyproject_content) + if not match: + print(f"Error: `requires-python` field not found or invalid format in `{file_path}`") + sys.exit(1) + + return match.group(1) + +def get_version_dockerfile(file_path: str) -> str: + with open(file_path, "r") as f: + pyproject_content = f.read() + + match = re.search(r'^FROM\s+python:([\d.]+)', pyproject_content) + if not match: + print(f"Error: Definition of base image `FROM python:x.x` not found in `{file_path}`") + sys.exit(1) + + return match.group(1) + +def main(file_path: str, is_dockerfile: bool, min_version: str, max_version: str) -> None: # Load and check `requires-python` version from `pyproject.toml` try: - with open(pyproject_toml_path, "r") as f: - pyproject_content = f.read() - - match = re.search(r'requires-python\s*=\s*">=([\d.]+)"', pyproject_content) - if not match: - print(f"Error: `requires-python` field not found or invalid format in `{pyproject_toml_path}`") - sys.exit(1) + if is_dockerfile: + used_version = get_version_dockerfile(file_path) + else: + used_version = get_version_pyproject(file_path) - pyproject_version = match.group(1) - if Version(pyproject_version) < Version(min_version): - print(f"Error: Python version in `{pyproject_toml_path}` `requires-python` ({pyproject_version}) " + if Version(used_version) < Version(min_version): + print(f"Error: Python version in `{file_path}` ({used_version}) " f"is smaller than `min_version` ({min_version}).") sys.exit(1) except FileNotFoundError: - print(f"Error: File not found: `{pyproject_toml_path}`.") + print(f"Error: File not found: `{file_path}`.") sys.exit(1) - print(f"Success: Version in pyproject.toml `requires-python` (>={pyproject_version}) " + print(f"Success: Version in `{file_path}` ({used_version}) " f"matches expected versions ([{min_version} to {max_version}]).") if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Check Python version support and alignment with pyproject.toml.") - parser.add_argument("pyproject_toml_path", help="Path to the `pyproject.toml` file to check.") + parser = argparse.ArgumentParser(description="Check Python version support and alignment with pyproject.toml or Dockerfile.") + parser.add_argument("file_path", help="Path to the `pyproject.toml` or `Dockerfile` file to check.") + parser.add_argument("--docker", action="store_true", + help="Set, if checking a `Dockerfile`, otherwise `pyproject.toml` is assumed.") parser.add_argument("min_version", help="The minimum Python version.") parser.add_argument("max_version", help="The maximum Python version.") args = parser.parse_args() try: - main(args.pyproject_toml_path, args.min_version, args.max_version) + main(args.file_path, args.docker, args.min_version, args.max_version) except InvalidVersion: print("Error: Invalid version format provided.") sys.exit(1) From 0344def800cf289fae604a2ca3f3aa160b0e6c30 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 11:33:40 +0200 Subject: [PATCH 14/20] test Dockerfile version check --- server/docker/repository/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/docker/repository/Dockerfile b/server/docker/repository/Dockerfile index bc58e3e6..28e830ac 100644 --- a/server/docker/repository/Dockerfile +++ b/server/docker/repository/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-alpine +FROM python:3.9-alpine LABEL org.label-schema.name="Eclipse BaSyx" \ org.label-schema.version="1.0" \ From b64da2e3721064e3e66a3e763002897c49394d74 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 11:36:49 +0200 Subject: [PATCH 15/20] Revert "test Dockerfile version check" This reverts commit 0344def800cf289fae604a2ca3f3aa160b0e6c30. --- server/docker/repository/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/docker/repository/Dockerfile b/server/docker/repository/Dockerfile index 28e830ac..bc58e3e6 100644 --- a/server/docker/repository/Dockerfile +++ b/server/docker/repository/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-alpine +FROM python:3.11-alpine LABEL org.label-schema.name="Eclipse BaSyx" \ org.label-schema.version="1.0" \ From bbd244e90e1949ccabba4e26754c4cc1c9b1740f Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Fri, 24 Jul 2026 11:46:21 +0200 Subject: [PATCH 16/20] CI: Replace Pycodestyle with Ruff Linting Temporarilly, the version is set in the `pyproject.toml` files. --- .github/workflows/pr.yml | 22 +++++++++++----------- compliance_tool/pyproject.toml | 1 + sdk/pyproject.toml | 1 + server/pyproject.toml | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 95001ced..b4643e3f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -122,7 +122,7 @@ jobs: python -m coverage report -m sdk-static-analysis: - # This job runs static code analysis, namely pycodestyle and mypy + # This job runs static code analysis, namely ruff and mypy runs-on: ubuntu-latest defaults: run: @@ -142,12 +142,12 @@ jobs: - name: Check typing with MyPy run: | python -m mypy basyx test - - name: Check code style with PyCodestyle + - name: Check formatting and linting rules with Ruff run: | - python -m pycodestyle --count --max-line-length 120 basyx test + python -m ruff check sdk-readme-codeblocks: - # This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings. + # This job runs the same static code analysis (mypy and ruff) on the codeblocks in our docstrings. runs-on: ubuntu-latest defaults: run: @@ -167,7 +167,7 @@ jobs: - name: Check typing with MyPy run: | python -m mypy <(python -m codeblocks python README.md) - - name: Check code style with PyCodestyle + - name: Check formatting and linting rules with Ruff run: | python -m codeblocks --wrap python README.md | python -m pycodestyle --count --max-line-length 120 - - name: Run readme codeblocks with Python @@ -261,7 +261,7 @@ jobs: python -m coverage report -m compliance-tool-static-analysis: - # This job runs static code analysis, namely pycodestyle and mypy + # This job runs static code analysis, namely ruff and mypy runs-on: ubuntu-latest defaults: @@ -284,9 +284,9 @@ jobs: - name: Check typing with MyPy run: | python -m mypy aas_compliance_tool test - - name: Check code style with PyCodestyle + - name: Check formatting and linting rules with Ruff run: | - python -m pycodestyle --count --max-line-length 120 aas_compliance_tool test + python -m ruff check compliance-tool-package: # This job checks if we can build our compliance_tool package @@ -311,7 +311,7 @@ jobs: server-static-analysis: - # This job runs static code analysis, namely pycodestyle and mypy + # This job runs static code analysis, namely ruff and mypy runs-on: ubuntu-latest defaults: @@ -333,9 +333,9 @@ jobs: - name: Check typing with MyPy run: | python -m mypy app test - - name: Check code style with PyCodestyle + - name: Check formatting and linting rules with Ruff run: | - python -m pycodestyle --count --max-line-length 120 app test + python -m ruff check server-docker: # This job checks if we can build our server package diff --git a/compliance_tool/pyproject.toml b/compliance_tool/pyproject.toml index 64f8adf8..a26b85a5 100644 --- a/compliance_tool/pyproject.toml +++ b/compliance_tool/pyproject.toml @@ -45,6 +45,7 @@ dependencies = [ dev = [ "mypy", "pycodestyle", + "ruff==0.16.0", "codeblocks", "coverage", ] diff --git a/sdk/pyproject.toml b/sdk/pyproject.toml index b2a7a6b7..ba010aa4 100644 --- a/sdk/pyproject.toml +++ b/sdk/pyproject.toml @@ -45,6 +45,7 @@ dependencies = [ dev = [ "mypy==1.15.0", "pycodestyle", + "ruff==0.16.0", "codeblocks", "coverage", "schemathesis~=3.7", diff --git a/server/pyproject.toml b/server/pyproject.toml index 8c40deff..e8799039 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -44,6 +44,7 @@ dependencies = [ dev = [ "mypy", "pycodestyle", + "ruff==0.16.0", "codeblocks", "schemathesis~=3.7", "jsonschema~=4.7", From 7410982ca89a7240b89ef794d77f780a9037b740 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 17:28:58 +0200 Subject: [PATCH 17/20] Introduce composite action for docker building Test a composite action to reduce duplication --- .github/actions/build-server/action.yml | 70 +++++++++++++++++++++++++ .github/workflows/pr.yml | 16 +++--- 2 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 .github/actions/build-server/action.yml diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml new file mode 100644 index 00000000..d8cae15a --- /dev/null +++ b/.github/actions/build-server/action.yml @@ -0,0 +1,70 @@ +name: build-server +description: Sets up the build context and builds a docker image +inputs: + server-profile: + required: true + description: The profile of the server to build (discovery, registry, repository) + load: + required: false + description: Set to "true" to use image in further steps (only works for single architecture builds) + default: "false" + platform: + required: false + description: The target platforms to build the image for + default: "linux/amd64" + publish: + required: false + description: Set to "true" to publish image to Docker Hub (requires login) + default: "false" + +outputs: + image-digest: + description: The image name + digest of the built image + value: ${{ steps.build.outputs.imageid }}@${{ steps.build.outputs.digest }} + +runs: + using: composite + steps: + - name: Checkout Repository + uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Generate Image Title + id: capitalize + shell: bash + run: | + profile="${{ inputs.server-profile }}" + echo "profile-title=${profile^}" >> "$GITHUB_OUTPUT" + + - name: Extract Docker image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: eclipsebasyx/basyx-python-${{ inputs.server-profile }} + # This fetches the latest git tag and adds an additional "latest" to it, so e.g. `2.1.0,latest` + tags: | + type=semver,pattern={{version}} + type=raw,value=latest,enable=${{ inputs.publish == 'true' && true || false }} + type=sha,prefix=pr-,enable=${{ inputs.load == 'true' && true || false }} + labels: | + org.opencontainers.image.title=BaSyx Python ${{ steps.capitalize.outputs.profile-title }} Service + org.opencontainers.image.description=Eclipse BaSyx Python SDK - ${{ steps.capitalize.outputs.profile-title }} HTTP Server + org.opencontainers.image.source=https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server + org.opencontainers.image.licenses=MIT + + - name: Build Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: . + file: ./server/docker/${{ inputs.server-profile }}/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ inputs.platform }} + #push: ${{ inputs.publish == 'true' && true || false }} + load: ${{ inputs.load == 'true' && true || false }} \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b4643e3f..ab42da18 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -344,17 +344,17 @@ jobs: matrix: service: ["repository", "discovery", "registry"] fail-fast: false - defaults: - run: - working-directory: ./server/docker/${{ matrix.service }} steps: - - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - - name: Build the Docker image - run: | - docker build -t basyx-python-${{ matrix.service }} -f Dockerfile ../../.. + - uses: ./.github/actions/build-server + id: build + with: + server-profile: ${{ matrix.service }} + load: true + publish: false + platform: linux/amd64 - name: Run container run: | - docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 basyx-python-${{ matrix.service }} + docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 ${{ steps.build.outputs.image-digest }} - name: Wait for container and server initialization run: | timeout 30s bash -c ' From f41d418e0dad6d3406eb08a25f8074a53424ae20 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 17:32:21 +0200 Subject: [PATCH 18/20] Fix: Checkout before composite action --- .github/actions/build-server/action.yml | 3 --- .github/workflows/pr.yml | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml index d8cae15a..0c687716 100644 --- a/.github/actions/build-server/action.yml +++ b/.github/actions/build-server/action.yml @@ -25,9 +25,6 @@ outputs: runs: using: composite steps: - - name: Checkout Repository - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 - - name: Setup QEMU uses: docker/setup-qemu-action@v4 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ab42da18..0f132185 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -345,6 +345,9 @@ jobs: service: ["repository", "discovery", "registry"] fail-fast: false steps: + - name: Checkout Repository + uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 #v5.1.0 + - uses: ./.github/actions/build-server id: build with: From efbf66fff7cede91fad0119548a9f2e978af3145 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 17:38:54 +0200 Subject: [PATCH 19/20] Fix: image naming in build-server action --- .github/actions/build-server/action.yml | 11 ++++++----- .github/workflows/pr.yml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml index 0c687716..d5ed51ad 100644 --- a/.github/actions/build-server/action.yml +++ b/.github/actions/build-server/action.yml @@ -20,7 +20,7 @@ inputs: outputs: image-digest: description: The image name + digest of the built image - value: ${{ steps.build.outputs.imageid }}@${{ steps.build.outputs.digest }} + value: ${{ steps.naming.outputs.image-name }}@${{ steps.build.outputs.digest }} runs: using: composite @@ -32,25 +32,26 @@ runs: uses: docker/setup-buildx-action@v4 - name: Generate Image Title - id: capitalize + id: naming shell: bash run: | profile="${{ inputs.server-profile }}" echo "profile-title=${profile^}" >> "$GITHUB_OUTPUT" + echo "image-name=eclipsebasyx/basyx-python-${{ inputs.server-profile }}" >> $GITHUB_OUTPUT - name: Extract Docker image metadata id: meta uses: docker/metadata-action@v5 with: - images: eclipsebasyx/basyx-python-${{ inputs.server-profile }} + images: ${{ steps.naming.outputs.image-name }} # This fetches the latest git tag and adds an additional "latest" to it, so e.g. `2.1.0,latest` tags: | type=semver,pattern={{version}} type=raw,value=latest,enable=${{ inputs.publish == 'true' && true || false }} type=sha,prefix=pr-,enable=${{ inputs.load == 'true' && true || false }} labels: | - org.opencontainers.image.title=BaSyx Python ${{ steps.capitalize.outputs.profile-title }} Service - org.opencontainers.image.description=Eclipse BaSyx Python SDK - ${{ steps.capitalize.outputs.profile-title }} HTTP Server + org.opencontainers.image.title=BaSyx Python ${{ steps.naming.outputs.profile-title }} Service + org.opencontainers.image.description=Eclipse BaSyx Python SDK - ${{ steps.naming.outputs.profile-title }} HTTP Server org.opencontainers.image.source=https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server org.opencontainers.image.licenses=MIT diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0f132185..21a10d92 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -357,7 +357,7 @@ jobs: platform: linux/amd64 - name: Run container run: | - docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 ${{ steps.build.outputs.image-digest }} + docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 --pull=never ${{ steps.build.outputs.image-digest }} - name: Wait for container and server initialization run: | timeout 30s bash -c ' From 0f57dc86cb0d6b8d75dbc25ecd69ccdb6012f36c Mon Sep 17 00:00:00 2001 From: hpoeche Date: Fri, 24 Jul 2026 17:52:15 +0200 Subject: [PATCH 20/20] Fix image-ref of build-server action --- .github/actions/build-server/action.yml | 11 ++++++----- .github/workflows/pr.yml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml index d5ed51ad..7b9a77c6 100644 --- a/.github/actions/build-server/action.yml +++ b/.github/actions/build-server/action.yml @@ -18,9 +18,9 @@ inputs: default: "false" outputs: - image-digest: - description: The image name + digest of the built image - value: ${{ steps.naming.outputs.image-name }}@${{ steps.build.outputs.digest }} + image-ref: + description: Reference to the locally-runnable image (valid if load="true") + value: ${{ steps.naming.outputs.image-name }}:${{ steps.naming.outputs.local-tag }} runs: using: composite @@ -38,6 +38,7 @@ runs: profile="${{ inputs.server-profile }}" echo "profile-title=${profile^}" >> "$GITHUB_OUTPUT" echo "image-name=eclipsebasyx/basyx-python-${{ inputs.server-profile }}" >> $GITHUB_OUTPUT + echo "local-tag=ci-${{ github.run_id }}" >> $GITHUB_OUTPUT - name: Extract Docker image metadata id: meta @@ -48,7 +49,7 @@ runs: tags: | type=semver,pattern={{version}} type=raw,value=latest,enable=${{ inputs.publish == 'true' && true || false }} - type=sha,prefix=pr-,enable=${{ inputs.load == 'true' && true || false }} + type=raw,value=${{ steps.naming.outputs.local-tag }},enable=${{ inputs.load == 'true' && true || false }} labels: | org.opencontainers.image.title=BaSyx Python ${{ steps.naming.outputs.profile-title }} Service org.opencontainers.image.description=Eclipse BaSyx Python SDK - ${{ steps.naming.outputs.profile-title }} HTTP Server @@ -64,5 +65,5 @@ runs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: ${{ inputs.platform }} - #push: ${{ inputs.publish == 'true' && true || false }} + push: ${{ inputs.publish == 'true' && true || false }} load: ${{ inputs.load == 'true' && true || false }} \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 21a10d92..9bbdbbd9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -357,7 +357,7 @@ jobs: platform: linux/amd64 - name: Run container run: | - docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 --pull=never ${{ steps.build.outputs.image-digest }} + docker run -d --name basyx-python-${{ matrix.service }} -p 9080:80 --pull=never ${{ steps.build.outputs.image-ref }} - name: Wait for container and server initialization run: | timeout 30s bash -c '