Skip to content

Commit

Permalink
Add gh action to publish nptest package on tag push (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwikranjan authored Oct 2, 2024
1 parent 0297476 commit ed6942e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker-publish-nptest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Push Docker Image for network/benchmarks/netperf/nptest

on:
push:
tags:
- '**'

jobs:
build-and-push:
permissions:
packages: write # Write permission is required to publish Docker images to GitHub Container Registry
contents: read

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
run: |
cd network/benchmarks/netperf
make push
env:
DOCKERREPO: ghcr.io/${{ github.repository_owner }}/nptest
IMAGE_TAG: ${{ github.ref_name }}
17 changes: 10 additions & 7 deletions network/benchmarks/netperf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
all: docker push launch runtests

DOCKERREPO := $(or $(DOCKERREPO), girishkalele/netperf-latest)
IMAGE_TAG := $(or $(IMAGE_TAG), latest)

docker: launch
docker: test
mkdir -p Dockerbuild && \
cp -rf nptest/* Dockerbuild/ && \
docker build -t $(DOCKERREPO) Dockerbuild/
docker build -t $(DOCKERREPO):$(IMAGE_TAG) Dockerbuild/

push: docker
gcloud docker push $(DOCKERREPO)
docker push $(DOCKERREPO):$(IMAGE_TAG)

clean:
@rm -f Dockerbuild/*
Expand All @@ -33,6 +34,10 @@ clean:
launch: launch.go
go build -o launch launch.go

test:
go test ./...
cd nptest && go test ./...

# 'runtests' is the test runner target
runtests: launch
@echo Launching network performance tests
Expand All @@ -42,7 +47,5 @@ runtests: launch
@echo Results file netperf-latest.csv and SVG/PNG graphs generated successfully

localtest: docker
docker push $(DOCKERREPO)
go run launch.go -image=$(DOCKERREPO) -json -kubeConfig ./kubeConfig


docker push $(DOCKERREPO):$(IMAGE_TAG)
go run launch.go -image=$(DOCKERREPO):$(IMAGE_TAG) -json -kubeConfig ./kubeConfig
6 changes: 6 additions & 0 deletions network/benchmarks/netperf/nptest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ RUN cd iperf-3.1 && ./configure --prefix=/usr/local --bindir /usr/local/bin && m
RUN curl -LO https://github.com/HewlettPackard/netperf/archive/netperf-2.7.0.tar.gz && tar -xzf netperf-2.7.0.tar.gz && mv netperf-netperf-2.7.0/ netperf-2.7.0
RUN cd netperf-2.7.0 && ./configure --prefix=/usr/local --bindir /usr/local/bin && make CFLAGS=-fcommon && make install

# Validate the installation of qperf, iperf3 and netperf
RUN usr/local/bin/qperf --help
RUN usr/local/bin/iperf3 -v
RUN usr/local/bin/netperf -V
RUN usr/local/bin/netserver -V

COPY --from=builder /workspace/nptests /usr/bin/

ENTRYPOINT ["nptests"]

0 comments on commit ed6942e

Please sign in to comment.