Skip to content

test

test #1318

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
env:
CUR_REGISTRY: ${{ vars.CUR_REGISTRY }} # "registry.cennso.com"
REGISTRY: ${{ vars.REGISTRY }} # "quay.io"
IMAGE_NAME: ${{ vars.IMAGE_NAME }} # travelping/upg-vpp
# Make 'git am' work
GIT_AUTHOR_NAME: Dummy
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Dummy
GIT_COMMITTER_EMAIL: [email protected]
UPG_BUILDENV: docker
# FIXME: UDP tests are unstable, likely due to a shortcoming in
# Linux namespace handling code
E2E_SKIP: ".*IPv6 session measurement.*counts UDP traffic.*"
# Uncomment to disable pushing the upg-vpp images.
# Build images will still be pushed in case if a new one needs to be built.
# This may be helpful during workflow debugging
# NO_PUSH: y
# Uncomment/change the following to run only a subset of tests.
# But don't forget to comment it back for a finished PR!
# E2E_FOCUS: "TDF.*IPv4.*no proxy.*counts plain HTTP traffic"
E2E_PARALLEL_NODES: "10"
jobs:
build:
runs-on:
- ubuntu-22.04
strategy:
matrix:
build_type: [debug, release]
env:
# avoid conflicts between parallel jobs
K8S_ID_SUFFIX: ${{ matrix.build_type }}
steps:
# https://github.com/actions/runner/issues/434#issuecomment-992865457
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Login to quay.io
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USER_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout
uses: actions/checkout@v2
with:
# for git describe
fetch-depth: 0
- name: Build UPG image
run: |
make ci-build BUILD_TYPE="${{ matrix.build_type }}"
mv /tmp/_out _out
- name: Upload debs
uses: actions/upload-artifact@v2
with:
name: debs-${{ matrix.build_type }}
path: _out/*.deb
# image.txt used by the release workflow
- name: Upload image.txt
uses: actions/upload-artifact@v2
with:
name: image-${{ matrix.build_type }}
path: image-${{ matrix.build_type }}.txt
- name: Upload image.txt for the dev image
uses: actions/upload-artifact@v2
with:
name: image-dev-${{ matrix.build_type }}
path: image-dev-${{ matrix.build_type }}.txt
checkstyle:
runs-on:
- ubuntu-22.04
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v2
- name: Check the code style
uses: jidicula/[email protected]
with:
clang-format-version: '11'
integration:
# runs-on:
# - self-hosted
# - hugepages
runs-on:
- ubuntu-22.04
strategy:
fail-fast: false
matrix:
build_type: [debug, release]
env:
BUILD_TYPE: ${{ matrix.build_type }}
needs: build
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v2
with:
# for git describe
fetch-depth: 0
- name: Get dev image info
uses: actions/download-artifact@v2
with:
name: image-dev-${{ matrix.build_type }}
- name: Run tests
run: |
dev_image=$(cat image-dev-${BUILD_TYPE}.txt)
make retest DEV_IMAGE="${dev_image}"
e2e:
# runs-on:
# - self-hosted
# - hugepages
runs-on:
- ubuntu-22.04
strategy:
fail-fast: false
matrix:
build_type: [debug, release]
env:
BUILD_TYPE: ${{ matrix.build_type }}
needs: build
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v2
with:
# for git describe
fetch-depth: 0
- name: Get dev image info
uses: actions/download-artifact@v2
with:
name: image-dev-${{ matrix.build_type }}
- name: Run tests
run: |
dev_image=$(cat image-dev-${BUILD_TYPE}.txt)
mkdir junit-output
if ! make retest-e2e \
DEV_IMAGE="${dev_image}" \
E2E_RETEST=y \
E2E_PARALLEL=y \
E2E_PARALLEL_NODES="${E2E_PARALLEL_NODES}" \
E2E_QUICK=y \
E2E_ARTIFACTS_DIR="/src/artifacts" \
E2E_JUNIT_DIR="/src/artifacts/junit-output" \
E2E_FOCUS="${E2E_FOCUS}" \
E2E_SKIP="${E2E_SKIP}" \
E2E_NO_GDB=1 \
GRAB_ARTIFACTS=1; then
docker run -v "${PWD}:/src" alpine /bin/sh -c "chown -v -R $(id -u).$(id -g) /src/artifacts"
exit 1
fi
- name: Upload artifacts for failed tests
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-artifacts-${{ matrix.kind }}-${{ matrix.build_type }}
path: artifacts/
# dummy job for release.yaml to wait on
conclude:
runs-on:
- ubuntu-latest
needs:
- checkstyle
- integration
- e2e
steps:
- name: Dummy step
run: echo ok
# based on ergw GH Action config
slack:
needs:
- conclude
runs-on:
- ubuntu-22.04
if: always()
steps:
- name: Set status
run: |
if [[ ${{ needs.conclude.result }} =~ ^(success|failure)$ ]]; then
echo '::set-output name=STATUS::${{ needs.conclude.result }}'
else
echo '::set-output name=STATUS::cancelled'
fi
id: set-status
- name: Slack notification
uses: 8398a7/action-slack@v3
with:
author_name: "GitHub Actions"
username: ${{ github.event.repository.name }}
icon_emoji: ':octocat:'
fields: repo, message, ref, commit, author, action, eventName, workflow, job, took
status: ${{ steps.set-status.outputs.STATUS }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}