From fabc08e498d9d1f3682d4e63eb9beb86e05e952a Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Sun, 20 Apr 2025 15:59:06 -0700 Subject: [PATCH] Add a basic test to the CI --- .gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8e5bd7..d25cd77 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - build + - test - release @@ -36,6 +37,38 @@ build:iperf3: +.test: + stage: test + tags: [docker] + image: + name: alpine:3 + entrypoint: [''] + services: + - name: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-${BUILD_TARGET} + alias: iperf-container + before_script: + - apk add --no-cache iperf iperf3 + +test:iperf2: + extends: .test + needs: ['build:iperf2'] + variables: + BUILD_TARGET: iperf2 + script: + - iperf -c iperf-container -p 5001 -b 10M -i 1 + # iperf always has a truthy exit code, so we have to grep for output instead + - iperf -c iperf-container -p 5001 -b 10M | grep ' Mbits/sec' + +test:iperf3: + extends: .test + needs: ['build:iperf3'] + variables: + BUILD_TARGET: iperf3 + script: + - iperf3 -c iperf-container -p 5201 --connect-timeout 10000 -b 10M + + + .release: stage: release tags: [docker] @@ -49,14 +82,14 @@ build:iperf3: release:iperf2: extends: .release - needs: ['build:iperf2'] + needs: ['test:iperf2'] script: - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2.2 - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf2 2 release:iperf3: extends: .release - needs: ['build:iperf3'] + needs: ['test:iperf3'] script: - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3.17 - crane tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}-iperf3 3 -- GitLab