diff --git a/.github/actions/setup-podman/action.yml b/.github/actions/setup-podman/action.yml index 954140f..2814e2b 100644 --- a/.github/actions/setup-podman/action.yml +++ b/.github/actions/setup-podman/action.yml @@ -101,6 +101,14 @@ runs: systemctl --user enable --now podman.socket echo "DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock" >> $GITHUB_ENV + - name: Expose Podman socket as /var/run/docker.sock + shell: bash + run: | + # GitHub Actions container-based actions mount /var/run/docker.sock + # hardcoded. Symlink it to the Podman socket so those actions work. + sudo ln -sf "$XDG_RUNTIME_DIR/podman/podman.sock" /var/run/docker.sock + sudo chmod 666 "$XDG_RUNTIME_DIR/podman/podman.sock" + - name: Verify Podman and podman-compose shell: bash run: | diff --git a/.github/workflows/_robot-tests.yml b/.github/workflows/_robot-tests.yml new file mode 100644 index 0000000..384315e --- /dev/null +++ b/.github/workflows/_robot-tests.yml @@ -0,0 +1,48 @@ +name: Robot Tests + +on: + workflow_call: + inputs: + release_version: + required: true + type: string + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + robot-tests: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Set up Podman + uses: ./.github/actions/setup-podman + + - name: Login to ghcr.io + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | \ + podman login ghcr.io \ + -u "${{ github.actor }}" \ + --password-stdin + + - name: Run Robot Framework tests + run: ./test/robot/run.sh + + - name: Robot Reporter + if: always() + uses: joonvena/robotframework-reporter-action@v2.5 + with: + gh_access_token: ${{ secrets.GITHUB_TOKEN }} + report_path: test/robot/results + + - name: Upload Robot results + if: always() + uses: actions/upload-artifact@v7 + with: + name: robot-results + path: test/robot/results + if-no-files-found: warn + retention-days: 7 diff --git a/.github/workflows/_tooling.yml b/.github/workflows/_tooling.yml index 26d1db4..f8a7629 100644 --- a/.github/workflows/_tooling.yml +++ b/.github/workflows/_tooling.yml @@ -45,13 +45,20 @@ jobs: command: just build release-version: ${{ inputs.release_version }} - - name: Publish test results - uses: dorny/test-reporter@v3 + - name: Publish Unit Test Results + uses: mikepenz/action-junit-report@v6 if: always() with: - name: Pytest Results - path: packtly-builder/tooling/python-test-results.xml - reporter: python-xunit + comment: true + detailed_summary: true + group_suite: true + include_passed: true + include_time_in_summary: true + job_summary: true + report_paths: packtly-builder/tooling/python-test-results.xml + simplified_summary: false + skip_success_summary: false + updateComment: true - name: Coverage summary uses: orgoro/coverage@ca0c362dc1a4f100447309405e6dfea47e251495 diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 969ac8d..8211b86 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -63,3 +63,13 @@ jobs: permissions: packages: write + robot-tests: + needs: + - runtime-manifest + uses: ./.github/workflows/_robot-tests.yml + with: + release_version: ${{ needs.version.outputs.release_version }} + secrets: inherit + permissions: + checks: write + pull-requests: write diff --git a/.gitignore b/.gitignore index bbbe7f2..c1ddb98 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,11 @@ cover/ python-test-results.xml test-output.xml *.log + +# Robot Framework artifacts +output.xml +report.html +log.html +xunit.xml +debugfile.txt +test/robot/results/ diff --git a/test/robot/keywords/git.robot b/test/robot/keywords/git.robot new file mode 100644 index 0000000..3340f17 --- /dev/null +++ b/test/robot/keywords/git.robot @@ -0,0 +1,18 @@ +*** Settings *** +Library Process + +*** Keywords *** +Checkout Repository + [Arguments] ${url} ${path} ${branch}=main + + ${result}= Run Process + ... git + ... clone + ... --depth + ... 1 + ... --branch + ... ${branch} + ... ${url} + ... ${path} + + Should Be Equal As Integers ${result.rc} 0 ${result.stderr} diff --git a/test/robot/requirements.txt b/test/robot/requirements.txt new file mode 100644 index 0000000..357978a --- /dev/null +++ b/test/robot/requirements.txt @@ -0,0 +1,4 @@ +robotframework +robotframework-requests +robotframework-jsonlibrary +robotframework-pythonlibcore diff --git a/test/robot/run.sh b/test/robot/run.sh new file mode 100755 index 0000000..bd305c9 --- /dev/null +++ b/test/robot/run.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Install robotframework if not already installed +if ! pipx list --short | grep -q '^robotframework '; then + pipx install \ + --pip-args="-r ${ROOT}/requirements.txt" \ + robotframework +fi + +# Tests ausführen +robot \ + --outputdir "${ROOT}/results" \ + "${ROOT}/suites" + diff --git a/test/robot/suites/hello_world.robot b/test/robot/suites/hello_world.robot new file mode 100644 index 0000000..6cbba8d --- /dev/null +++ b/test/robot/suites/hello_world.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Hello World – Robot Framework Einstiegsbeispiel +... Zeigt grundlegende Keywords, Variablen und Log-Ausgaben. + +*** Variables *** +${GREETING} Hello, Robot World! +${NAME} Packtly Builder + +*** Test Cases *** + +Hello World Ausgabe + [Documentation] Gibt eine einfache Begrüßung aus. + Log ${GREETING} + Log To Console ${GREETING} + +Variablen verwenden + [Documentation] Demonstriert die Nutzung von Robot-Variablen. + ${message}= Set Variable Hello from ${NAME}! + Should Be Equal ${message} Hello from ${NAME}! + Log ${message} + +Einfache Assertion + [Documentation] Prüft arithmetische Gleichheit via BuiltIn. + ${result}= Evaluate 2 + 2 + Should Be Equal As Integers ${result} 4 + +Schleifen Demo + [Documentation] Iteriert über eine Liste und loggt jeden Eintrag. + @{items}= Create List alpha beta gamma + FOR ${item} IN @{items} + Log Item: ${item} + END + +*** Keywords *** + +Benutze Gruss + [Arguments] ${name} + [Documentation] Gibt einen personalisierten Gruß zurück. + RETURN Hello, ${name}! diff --git a/test/robot/suites/test_build_systemd.robot b/test/robot/suites/test_build_systemd.robot new file mode 100644 index 0000000..692478c --- /dev/null +++ b/test/robot/suites/test_build_systemd.robot @@ -0,0 +1,14 @@ +*** Settings *** +Library OperatingSystem +Resource ../keywords/git.robot + +Suite Teardown Remove Directory ${SYSTEMD_PATH} recursive=True + +*** Variables *** +${SYSTEMD_URL} https://salsa.debian.org/systemd-team/systemd.git +${SYSTEMD_PATH} ${TEMPDIR}/systemd +${SYSTEMD_BRANCH} debian/master + +*** Test Cases *** +Test + Checkout Repository ${SYSTEMD_URL} ${SYSTEMD_PATH} ${SYSTEMD_BRANCH}