From ab902b081223d3e44e1e9582f3bb1b19474b11b2 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Tue, 19 Dec 2023 23:02:36 +0200 Subject: [PATCH] carve out smoke tests --- .github/workflows/cicd.yml | 63 ++---------------------- .github/workflows/smoke-tests.yml | 80 +++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/smoke-tests.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 9ad27fd9d..27e507cce 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -117,70 +117,13 @@ jobs: retention-days: 7 smoke-tests: - runs-on: ubuntu-22.04 - timeout-minutes: 10 - strategy: - matrix: - runtime: - - "docker" - - "podman" + uses: ./.github/workflows/smoke-tests.yml + with: + py_ver: ${{ needs.file-changes.outputs.py_ver }} needs: - unit-test - staticcheck - build-containerlab - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/download-artifact@v4 - with: - name: containerlab - - name: Move containerlab to usr/bin - run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab - - name: Setup Podman - if: matrix.runtime == 'podman' - run: | - sudo apt purge -y podman - sudo mkdir -p /etc/apt/keyrings - curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" \ - | gpg --dearmor \ - | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null - echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\ - https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \ - | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null - sudo apt-get update -qq - sudo apt-get -qq -y install podman - sudo systemctl start podman - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - cache: pip - cache-dependency-path: "tests/requirements.txt" - - name: Install robotframework - run: | - pip install -r tests/requirements.txt - - name: Run smoke tests - run: | - bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/01-smoke - # upload test reports as a zip file - - name: Upload test report - uses: actions/upload-artifact@v4 - if: always() - with: - name: 01-smoke-log - path: ./tests/out/*.html - - # upload coverage report from unit tests, as they are then - # merged with e2e tests coverage - - name: Upload coverage - uses: actions/upload-artifact@v4 - if: always() - with: - name: coverage-smoke-tests-${{ matrix.runtime }} - path: /tmp/clab-tests/coverage/* - retention-days: 7 ext-container-tests: runs-on: ubuntu-22.04 diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml new file mode 100644 index 000000000..94cd1d81a --- /dev/null +++ b/.github/workflows/smoke-tests.yml @@ -0,0 +1,80 @@ +name: smoke-tests + +"on": + workflow_call: + inputs: + py_ver: + required: true + type: string + +jobs: + smoke-tests: + runs-on: ubuntu-22.04 + timeout-minutes: 5 + strategy: + matrix: + runtime: + - "docker" + - "podman" + # allow podman job to fail, since it started to fail on github actions + continue-on-error: ${{ matrix.runtime == 'podman' }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/download-artifact@v4 + with: + name: containerlab + + - name: Move containerlab to usr/bin + run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab + + - name: Setup Podman + if: matrix.runtime == 'podman' + run: | + sudo apt purge -y podman + sudo mkdir -p /etc/apt/keyrings + curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" \ + | gpg --dearmor \ + | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\ + https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \ + | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null + sudo apt-get update -qq + sudo apt-get -qq -y install podman + sudo systemctl start podman + + - uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.py_ver }} + cache: pip + cache-dependency-path: "tests/requirements.txt" + + - name: Install robotframework + run: | + pip install -r tests/requirements.txt + + - name: Run smoke tests + run: | + bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/01-smoke + + # upload test reports as a zip file + - name: Upload test report + uses: actions/upload-artifact@v4 + if: always() + with: + name: 01-smoke-log-${{ matrix.runtime }} + path: ./tests/out/*.html + + # upload coverage report from unit tests, as they are then + # merged with e2e tests coverage + - name: Upload coverage + uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage-smoke-tests-${{ matrix.runtime }} + path: /tmp/clab-tests/coverage/* + retention-days: 7