Skip to content

Commit ed6942e

Browse files
authored
Add gh action to publish nptest package on tag push (#2)
1 parent 0297476 commit ed6942e

File tree

3 files changed

+55
-7
lines changed

3 files changed

+55
-7
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Push Docker Image for network/benchmarks/netperf/nptest
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
jobs:
9+
build-and-push:
10+
permissions:
11+
packages: write # Write permission is required to publish Docker images to GitHub Container Registry
12+
contents: read
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Build and push Docker image
34+
run: |
35+
cd network/benchmarks/netperf
36+
make push
37+
env:
38+
DOCKERREPO: ghcr.io/${{ github.repository_owner }}/nptest
39+
IMAGE_TAG: ${{ github.ref_name }}

network/benchmarks/netperf/Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
all: docker push launch runtests
1616

1717
DOCKERREPO := $(or $(DOCKERREPO), girishkalele/netperf-latest)
18+
IMAGE_TAG := $(or $(IMAGE_TAG), latest)
1819

19-
docker: launch
20+
docker: test
2021
mkdir -p Dockerbuild && \
2122
cp -rf nptest/* Dockerbuild/ && \
22-
docker build -t $(DOCKERREPO) Dockerbuild/
23+
docker build -t $(DOCKERREPO):$(IMAGE_TAG) Dockerbuild/
2324

2425
push: docker
25-
gcloud docker push $(DOCKERREPO)
26+
docker push $(DOCKERREPO):$(IMAGE_TAG)
2627

2728
clean:
2829
@rm -f Dockerbuild/*
@@ -33,6 +34,10 @@ clean:
3334
launch: launch.go
3435
go build -o launch launch.go
3536

37+
test:
38+
go test ./...
39+
cd nptest && go test ./...
40+
3641
# 'runtests' is the test runner target
3742
runtests: launch
3843
@echo Launching network performance tests
@@ -42,7 +47,5 @@ runtests: launch
4247
@echo Results file netperf-latest.csv and SVG/PNG graphs generated successfully
4348

4449
localtest: docker
45-
docker push $(DOCKERREPO)
46-
go run launch.go -image=$(DOCKERREPO) -json -kubeConfig ./kubeConfig
47-
48-
50+
docker push $(DOCKERREPO):$(IMAGE_TAG)
51+
go run launch.go -image=$(DOCKERREPO):$(IMAGE_TAG) -json -kubeConfig ./kubeConfig

network/benchmarks/netperf/nptest/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ RUN cd iperf-3.1 && ./configure --prefix=/usr/local --bindir /usr/local/bin && m
5252
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
5353
RUN cd netperf-2.7.0 && ./configure --prefix=/usr/local --bindir /usr/local/bin && make CFLAGS=-fcommon && make install
5454

55+
# Validate the installation of qperf, iperf3 and netperf
56+
RUN usr/local/bin/qperf --help
57+
RUN usr/local/bin/iperf3 -v
58+
RUN usr/local/bin/netperf -V
59+
RUN usr/local/bin/netserver -V
60+
5561
COPY --from=builder /workspace/nptests /usr/bin/
5662

5763
ENTRYPOINT ["nptests"]

0 commit comments

Comments
 (0)