From 48190e2a98752541ca904fc2a1830eb8cc122c9c Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 10:46:39 +0200 Subject: [PATCH 1/7] 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 | 350 --------------------------------------- .github/workflows/pr.yml | 349 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 349 insertions(+), 350 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 a5e2c254..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,350 +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 - - 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 - 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 - - 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 - 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 af9d33097bde6f0b3b0b5664912104e1608d97b5 Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 11:01:35 +0200 Subject: [PATCH 2/7] 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 5ad65199f949da8d80463c899216299ee934cf40 Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 11:14:57 +0200 Subject: [PATCH 3/7] 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 e0e39046a8a2fefc8ec8379768768c08aa866aca Mon Sep 17 00:00:00 2001 From: hpoeche Date: Thu, 16 Jul 2026 11:22:40 +0200 Subject: [PATCH 4/7] 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 bbdfc5524879773be77d74b0ca831778dd205da8 Mon Sep 17 00:00:00 2001 From: hpoeche Date: Thu, 16 Jul 2026 11:25:57 +0200 Subject: [PATCH 5/7] 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 35ee553024cf45eef33c3c6bc3aa50340b70c8fd Mon Sep 17 00:00:00 2001 From: hpoeche Date: Thu, 16 Jul 2026 11:34:16 +0200 Subject: [PATCH 6/7] 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 d343d9c59cb9d5058a55a704852c4a5f99fdd0b2 Mon Sep 17 00:00:00 2001 From: Paul Gerber Date: Thu, 16 Jul 2026 11:59:19 +0200 Subject: [PATCH 7/7] 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