Skip to content

yonch is running GitHub Actions #383

yonch is running GitHub Actions

yonch is running GitHub Actions #383

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
name: build-and-test
run-name: ${{ github.actor }} is running GitHub Actions
on:
push:
branches:
- main
pull_request:
paths:
env:
BENV_IMAGE: quay.io/splunko11ytest/network-explorer-debug/build-env
concurrency:
group: build-and-test-${{ github.event.pull_request_number || github.ref }}
cancel-in-progress: true
jobs:
clang-format-check:
runs-on: ubuntu-20.04
name: clang-format-check
steps:
- name: Print github workspace
run: |
echo "github.workspace = ${{ github.workspace }}"
echo "pr.ref = ${{github.event.pull_request.head.ref}}"
echo "github.ref = ${{ github.ref }}"
echo "$GITHUB_CONTEXT"
- name: Check out the codebase
uses: actions/checkout@v3
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Runs format checker
run: |
sudo apt update
sudo apt install -y clang-format-11
cd ${{ github.workspace }}
./.github/workflows/scripts/check-clang-format.sh
outputs:
date: ${{ steps.date.outputs.date }}
build-reducer:
name: build-reducer
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: build-reducer
env:
PASS: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "github.workspace = ${{ github.workspace }}"
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
$BENV_IMAGE \
./build.sh reducer
build-kernel-collector:
name: build-kernel-collector
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: build-kernel-collector
env:
PASS: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "github.workspace = ${{ github.workspace }}"
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
$BENV_IMAGE \
./build.sh kernel-collector
build-k8s-relay:
name: build-k8s-relay
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: build k8s-relay
run: |
echo "github.workspace = ${{ github.workspace }}"
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
$BENV_IMAGE \
./build.sh k8s-relay
build-cloud-collector:
name: build-cloud-collector
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: build cloud-collector
run: |
echo "github.workspace = ${{ github.workspace }}"
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
$BENV_IMAGE \
./build.sh cloud-collector
build-k8s-watcher:
name: build-k8s-watcher
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: build k8s-watcher
run: |
echo "github.workspace = ${{ github.workspace }}"
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
$BENV_IMAGE \
./build.sh k8s-watcher
build-run-unit-tests:
name: build-run-unit-tests
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: run unit tests
run: |
echo "github.workspace = ${{ github.workspace }}"
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
--env ARGS="--output-on-failure --repeat until-pass:3" \
--env SPDLOG_LEVEL="trace" \
$BENV_IMAGE \
./build.sh unit_tests test
build-run-unit-tests-with-asan-and-debug-flags:
name: build-run-unit-tests-with-asan-and-debug-flags
runs-on: ubuntu-20.04
needs: [clang-format-check]
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: build unit tests with asan and debug flags on then run all tests
run: |
docker pull $BENV_IMAGE
git submodule update --init --recursive
docker run -t \
--rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$(git rev-parse --show-toplevel),destination=/root/src,readonly" \
--env EBPF_NET_SRC_ROOT=/root/src \
--env ARGS="--output-on-failure --repeat until-pass:3" \
--env SPDLOG_LEVEL="trace" \
$BENV_IMAGE \
./build.sh --debug --asan unit_tests test
run-kernel-header-tests:
name: run-kernel-header-tests
needs: [clang-format-check]
runs-on: macos-12
env:
EBPF_NET_SRC_ROOT: ${{ github.workspace }}
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
kernel:
- 'channel/**'
- 'cmake/**'
- 'collector/kernel/**'
- 'common/**'
- 'config/**'
- 'ext/**'
- 'geoip/**'
- 'jitbuf/**'
- 'otlp/**'
- 'platform/**'
- 'render/**'
- 'renderc/**'
- 'scheduling/**'
- 'test/kernel/**'
- 'util/**'
github:
- '.github/**'
- name: Run kernel header tests on multiple linux distributions
id: run-kernel-header-tests
if: steps.changes.outputs.kernel == 'true' || steps.changes.outputs.github == 'true'
run: |
sudo spctl --add /usr/local/bin/brew
# These following 4 lines are added to overcome brew link failures seen while executing brew update.
rm /usr/local/bin/2to3*
rm /usr/local/bin/idle*
rm /usr/local/bin/pydoc*
rm /usr/local/bin/python3*
brew update
brew install podman
sudo spctl --add /usr/local/bin/podman
podman machine init --rootful --cpus 3 --disk-size 14 --memory 12384
podman machine start
podman pull $BENV_IMAGE
podman machine ssh 'cat > /etc/containers/registries.conf.d/localhost.conf' <<EOF
[[registry]]
location = "localhost:5000"
insecure = true
EOF
podman machine ssh systemctl restart podman
podman container run -dt -p 5000:5000 --name registry docker.io/library/registry:2
podman info
git submodule update --init --recursive
podman run -t --rm \
--mount type=bind,source=$PWD,destination=/root/src,readonly \
--mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \
--env EBPF_NET_SRC_ROOT=/root/src \
--name benv \
--privileged \
$BENV_IMAGE \
./build.sh -j 3 reducer-docker-registry kernel-collector-docker-registry
vagrant plugin install vagrant-sshfs
vagrant plugin install vagrant-scp
./test/kernel/run-tests.sh --kernel-header-test
run-kernel-collector-tests:
name: run-kernel-collector-tests
needs: [clang-format-check]
runs-on: macos-12
env:
EBPF_NET_SRC_ROOT: ${{ github.workspace }}
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
kernel:
- 'channel/**'
- 'cmake/**'
- 'collector/kernel/**'
- 'common/**'
- 'config/**'
- 'ext/**'
- 'geoip/**'
- 'jitbuf/**'
- 'otlp/**'
- 'platform/**'
- 'render/**'
- 'renderc/**'
- 'scheduling/**'
- 'test/kernel/**'
- 'util/**'
github:
- '.github/**'
- name: Run kernel_collector_test on multiple linux distributions
id: run-kernel-collector-test
if: steps.changes.outputs.kernel == 'true' || steps.changes.outputs.github == 'true'
run: |
sudo spctl --add /usr/local/bin/brew
# These following 4 lines are added to overcome brew link failures seen while executing brew update.
rm /usr/local/bin/2to3*
rm /usr/local/bin/idle*
rm /usr/local/bin/pydoc*
rm /usr/local/bin/python3*
brew update
brew install podman
sudo spctl --add /usr/local/bin/podman
podman machine init --rootful --cpus 3 --disk-size 14 --memory 12348
podman machine start
podman pull $BENV_IMAGE
podman machine ssh 'cat > /etc/containers/registries.conf.d/localhost.conf' <<EOF
[[registry]]
location = "localhost:5000"
insecure = true
EOF
podman machine ssh systemctl restart podman
podman container run -dt -p 5000:5000 --name registry docker.io/library/registry:2
podman info
git submodule update --init --recursive
podman run -t --rm \
--mount type=bind,source=$PWD,destination=/root/src,readonly \
--mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \
--env EBPF_NET_SRC_ROOT=/root/src \
--name benv \
--privileged \
$BENV_IMAGE \
./build.sh -j 3 kernel-collector-test-docker-registry
vagrant plugin install vagrant-sshfs
vagrant plugin install vagrant-scp
./test/kernel/run-tests.sh --kernel-collector-test