From f97c031885b0befa30c67f640f454619c2d18e0d Mon Sep 17 00:00:00 2001 From: Frosty2500 <125310380+Frosty2500@users.noreply.github.com> Date: Sun, 1 Dec 2024 11:24:44 +0100 Subject: [PATCH] workflows: Add server ci, upgrade to @v4 (#336) This expands the CI workflow to also test the server. For now, it only tests if the server can be build and run without error. This also upgrades the `actions/checkout@v2` to the newer `actions/checkout@v4`. --- .github/workflows/ci.yml | 48 +++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ccd9944..5ecdceb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,9 +32,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Collect schema files from aas-specs @@ -64,9 +64,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies @@ -87,9 +87,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies @@ -113,9 +113,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install Python dependencies @@ -134,9 +134,9 @@ jobs: run: working-directory: ./sdk steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ env.X_PYTHON_VERSION }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ env.X_PYTHON_VERSION }} - name: Install dependencies @@ -146,3 +146,31 @@ jobs: - name: Create source and wheel dist run: | python -m build + + server-package: + # This job checks if we can build our server package + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./server + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: | + docker build -t basyx-python-server . + - 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