Skip to content

Commit 17898dd

Browse files
authored
[PKT-86] optimizing and removing useless files (#660)
[PKT-86] optimizing and removing useless files (#660)
1 parent 32b15f2 commit 17898dd

File tree

5 files changed

+39
-66
lines changed

5 files changed

+39
-66
lines changed

.github/actions/build-go/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ inputs:
1717
description: "OS for cross-build"
1818
required: false
1919
default: "linux"
20+
21+
goarch:
22+
description: "ARCH for cross-build"
23+
required: false
24+
default: "amd64"
2025

2126
runs:
2227
using: 'docker'

.github/actions/build-go/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function build() {
66
# Copying this from previous build (cpp)
77
cp -rf ./version.go /src/pkg/client/version.go
88
cd /src
9-
GOOS=$INPUT_GOOS go build -o pktvisor-cli cmd/pktvisor-cli/main.go
9+
GOOS=$INPUT_GOOS GOARCH=$INPUT_GOARCH go build -o pktvisor-cli cmd/pktvisor-cli/main.go
1010
}
1111

1212
function copy() {

.github/workflows/build_cross.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
branches:
1212
- develop
1313

14-
1514
jobs:
1615
pkvisor:
1716
name: pktvisor
@@ -173,33 +172,44 @@ jobs:
173172
- os: macos
174173
arch: armv7lh
175174
steps:
176-
- name: Setup Go
177-
uses: actions/setup-go@v2
178-
with:
179-
go-version: 1.17
180175
- name: Checkout sources
181176
uses: actions/checkout@v3
182-
with:
183-
path: src
184177

185-
- name: Configure
178+
- name: Configure CMake to generate VERSION
179+
shell: bash
180+
run: VERSION_ONLY=1 cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release
181+
182+
- name: Rename folder and copy version
183+
shell: bash
186184
run: |
187-
VERSION_ONLY=1 cmake src
188-
189-
- name: Build
190-
run: |
191-
if [ "${{matrix.os}}" = macos ]; then
192-
export GOOS=darwin
193-
fi
185+
mv src pktvisor-src
186+
cp -rpf golang/pkg/client/version.go .
187+
188+
- name: Build pktvisor-cli macos
189+
if: ${{matrix.os}} == macos
190+
uses: ./.github/actions/build-go
191+
with:
192+
context: "."
193+
file: "./Dockerfile"
194+
goos: "darwin"
194195

195-
if [ "${{matrix.arch}}" = armv7lh ]; then
196-
export GOARCH=arm
197-
elif [ "${{matrix.arch}}" = aarch64 ]; then
198-
export GOARCH=arm64
199-
fi
200-
201-
cd src/golang
202-
go build -o ${{github.workspace}}/pktvisor-cli ./cmd/pktvisor-cli
196+
- name: Build pktvisor-cli linux armv7lh
197+
if: ${{matrix.arch}} == armv7lh
198+
uses: ./.github/actions/build-go
199+
with:
200+
context: "."
201+
file: "./Dockerfile"
202+
goos: "linux"
203+
goarch: "arm"
204+
205+
- name: Build pktvisor-cli linux aarch64
206+
if: ${{matrix.arch}} == aarch64
207+
uses: ./.github/actions/build-go
208+
with:
209+
context: "."
210+
file: "./Dockerfile"
211+
goos: "linux"
212+
goarch: "arm64"
203213

204214
- name: Upload pktvisor-cli
205215
uses: actions/upload-artifact@v2

docker/Dockerfile.pktvisor-cli

Lines changed: 0 additions & 32 deletions
This file was deleted.

docker/entry-cli.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)