From 4d13d05c9c92c41791a7a10fa6714143ab762c34 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 10:47:01 -0300 Subject: [PATCH 01/18] Update build-release.yml --- .github/workflows/build-release.yml | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 74cce3459..4751f4f37 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -332,6 +332,56 @@ jobs: path: | .github/hosted-runner/amd64/terraform.tfstate retention-days: 1 + + build-windows: + runs-on: windows-2019 + outputs: + version_number: ${{ env.VERSION }} + steps: + - uses: actions/checkout@v2 + + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}\build + + - name: Get Conan + uses: turtlebrowser/get-conan@v1.0 + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}\build + run: PKG_CONFIG_PATH=${{github.workspace}}\local\lib\pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Get VERSION + shell: pwsh + id: build + run: | + $text = Get-Content ${{github.workspace}}\build\VERSION -Raw + echo "VERSION=$text" >> $env:GITHUB_ENV + + - name: Build + working-directory: ${{github.workspace}}\build + shell: pwsh + run: cmake --build . --config $BUILD_TYPE -- -m + + - name: Debug artifacts + shell: pwsh + run: | + Get-ChildItem -Force ${{github.workspace}}\build + + - name: compacting x64 windows binary + run: | + $compress = @{ + Path = "${{github.workspace}}\build\pktvisor-cli.exe", "${{github.workspace}}\build\pktvisor-reader.exe", "${{github.workspace}}\build\pktvisord.exe" + CompressionLevel = "Fastest" + DestinationPath = "${{github.workspace}}\build\pktvisor-win64.zip" + } + Compress-Archive @compress + + - name: Upload arm64 binary to latest release + shell: bash + run: | + chmod a+x ./docker/upload-gh-asset.sh + ./docker/upload-gh-asset.sh github_api_token=${{ secrets.BOT_TOKEN }} owner=ns1labs repo=pktvisor tag=LATEST filename=./pktvisor-win64.zip package-arm64: needs: [ spinup-arm64-runner ] From 9a41f32650fad71fbf6460cf9eaad2ff295145a0 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:04:48 -0300 Subject: [PATCH 02/18] test --- .github/workflows/build-develop.yml | 39 ++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 6f6700e05..f6dc20316 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -179,18 +179,39 @@ jobs: # # Execute tests defined by the CMake configuration. # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail # run: ctest -C $BUILD_TYPE - - - name: Login to ns1labs conan + + - name: Debug artifacts shell: pwsh run: | - $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" - conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }} - - - name: Cache conan packages - shell: pwsh + Get-ChildItem -Force ${{github.workspace}}\build + + - name: compacting x64 windows binary + run: | + $compress = @{ + Path = "${{github.workspace}}\build\pktvisor-cli.exe", "${{github.workspace}}\build\pktvisor-reader.exe", "${{github.workspace}}\build\pktvisord.exe" + CompressionLevel = "Fastest" + DestinationPath = "${{github.workspace}}\build\pktvisor-win64.zip" + } + Compress-Archive @compress + + - name: Upload arm64 binary to latest release + shell: bash run: | - $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" - conan upload "*" --all -r ns1labs -c + ls -lha + ls -lha ${{github.workspace}}\build\ + ls -lha ${{github.workspace}}\build\bin\ + +# - name: Login to ns1labs conan +# shell: pwsh +# run: | +# $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" +# conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }} + +# - name: Cache conan packages +# shell: pwsh +# run: | +# $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" +# conan upload "*" --all -r ns1labs -c package-amd64: needs: [ unit-tests-linux ] From c6051596357ada3f4eb3b5f44e7fab868d23b25f Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:15:48 -0300 Subject: [PATCH 03/18] test --- .github/workflows/build-develop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index f6dc20316..c00c19f86 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -183,12 +183,12 @@ jobs: - name: Debug artifacts shell: pwsh run: | - Get-ChildItem -Force ${{github.workspace}}\build + Get-ChildItem -Force ${{github.workspace}}\build\bin - name: compacting x64 windows binary run: | $compress = @{ - Path = "${{github.workspace}}\build\pktvisor-cli.exe", "${{github.workspace}}\build\pktvisor-reader.exe", "${{github.workspace}}\build\pktvisord.exe" + Path = "${{github.workspace}}\build\bin\pktvisor-cli.exe", "${{github.workspace}}\build\bin\pktvisor-reader.exe", "${{github.workspace}}\build\bin\pktvisord.exe" CompressionLevel = "Fastest" DestinationPath = "${{github.workspace}}\build\pktvisor-win64.zip" } From 714bbd78d837cac8b6d5eb347cc59f92d420882c Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:48:52 -0300 Subject: [PATCH 04/18] add parameter goos --- .github/actions/build-go/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-go/action.yml b/.github/actions/build-go/action.yml index 8501d8e5c..d952eee56 100644 --- a/.github/actions/build-go/action.yml +++ b/.github/actions/build-go/action.yml @@ -12,8 +12,13 @@ inputs: description: "Dockerfile used to build the image" required: true default: "./Dockerfile" + + goos: + description: "OS for cross-build" + required: false + default: "linux" runs: using: 'docker' image: 'Dockerfile' - \ No newline at end of file + From b36ad640d131f26318aec899f14a2f862369f6ae Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:51:20 -0300 Subject: [PATCH 05/18] add GOOS --- .github/actions/build-go/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-go/entrypoint.sh b/.github/actions/build-go/entrypoint.sh index bd4054b2c..f40cc59d1 100644 --- a/.github/actions/build-go/entrypoint.sh +++ b/.github/actions/build-go/entrypoint.sh @@ -6,7 +6,7 @@ function build() { # Copying this from previous build (cpp) cp -rf ./version.go /src/pkg/client/version.go cd /src - go build -o pktvisor-cli cmd/pktvisor-cli/main.go + GOOS=$INPUT_GOOS go build -o pktvisor-cli cmd/pktvisor-cli/main.go } function copy() { @@ -15,4 +15,4 @@ function copy() { } build -copy \ No newline at end of file +copy From cd7af22c97e51025813161448e51473e07c786fd Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:52:53 -0300 Subject: [PATCH 06/18] test --- .github/workflows/build-develop.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index c00c19f86..bb606bde5 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -180,6 +180,13 @@ jobs: # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail # run: ctest -C $BUILD_TYPE + - name: Build pktvisor-cli + uses: ./.github/actions/build-go + with: + context: "." + goos: windows + file: "./Dockerfile" + - name: Debug artifacts shell: pwsh run: | From 1378ec838205d7a2246b17d2e98ab370d624b439 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Fri, 6 Jan 2023 17:31:13 -0300 Subject: [PATCH 07/18] test --- .github/workflows/build-develop.yml | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index bb606bde5..2ce0e8f24 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -180,33 +180,33 @@ jobs: # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail # run: ctest -C $BUILD_TYPE - - name: Build pktvisor-cli - uses: ./.github/actions/build-go - with: - context: "." - goos: windows - file: "./Dockerfile" - - - name: Debug artifacts - shell: pwsh - run: | - Get-ChildItem -Force ${{github.workspace}}\build\bin +# - name: Build pktvisor-cli +# uses: ./.github/actions/build-go +# with: +# context: "." +# goos: windows +# file: "./Dockerfile" - - name: compacting x64 windows binary - run: | - $compress = @{ - Path = "${{github.workspace}}\build\bin\pktvisor-cli.exe", "${{github.workspace}}\build\bin\pktvisor-reader.exe", "${{github.workspace}}\build\bin\pktvisord.exe" - CompressionLevel = "Fastest" - DestinationPath = "${{github.workspace}}\build\pktvisor-win64.zip" - } - Compress-Archive @compress - +# - name: Debug artifacts +# shell: pwsh +# run: | +# Get-ChildItem -Force ${{github.workspace}}\build\bin + - name: Upload arm64 binary to latest release shell: bash run: | - ls -lha + ls -lha ${{github.workspace}} ls -lha ${{github.workspace}}\build\ ls -lha ${{github.workspace}}\build\bin\ + + - name: Persist to workspace + uses: actions/upload-artifact@v2 + with: + name: windows-build + path: | + ${{github.workspace}}\build\bin\pktvisor-reader.exe + ${{github.workspace}}\build\bin\pktvisord.exe + retention-days: 1 # - name: Login to ns1labs conan # shell: pwsh From 7f073b8a2f2c914f7864de429e46fe5b06828dab Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 11:44:26 -0300 Subject: [PATCH 08/18] add test --- .github/workflows/build-develop.yml | 39 +++++++++++++---------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 2ce0e8f24..f835a83d6 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -187,18 +187,13 @@ jobs: # goos: windows # file: "./Dockerfile" -# - name: Debug artifacts -# shell: pwsh -# run: | -# Get-ChildItem -Force ${{github.workspace}}\build\bin - - - name: Upload arm64 binary to latest release - shell: bash + - name: Debug artifacts + shell: pwsh run: | - ls -lha ${{github.workspace}} - ls -lha ${{github.workspace}}\build\ - ls -lha ${{github.workspace}}\build\bin\ - + Get-ChildItem -Force ${{github.workspace}} + Get-ChildItem -Force ${{github.workspace}}\build + Get-ChildItem -Force ${{github.workspace}}\build\bin + - name: Persist to workspace uses: actions/upload-artifact@v2 with: @@ -208,17 +203,17 @@ jobs: ${{github.workspace}}\build\bin\pktvisord.exe retention-days: 1 -# - name: Login to ns1labs conan -# shell: pwsh -# run: | -# $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" -# conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }} - -# - name: Cache conan packages -# shell: pwsh -# run: | -# $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" -# conan upload "*" --all -r ns1labs -c + - name: Login to ns1labs conan + shell: pwsh + run: | + $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" + conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }} + + - name: Cache conan packages + shell: pwsh + run: | + $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" + conan upload "*" --all -r ns1labs -c package-amd64: needs: [ unit-tests-linux ] From cc0e1ed632f1cac1c644bf059659ddf1ed80730f Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:21:11 -0300 Subject: [PATCH 09/18] test cli windows --- .github/workflows/build-develop.yml | 30 ++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index f835a83d6..5db893889 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -127,7 +127,7 @@ jobs: - name: Cache conan packages run: CONAN_USER_HOME=${{github.workspace}}/build/conan_home conan upload "*" --all -r ns1labs -c - build-windows: + build-win64: # The CMake configure and build commands are platform agnostic and should work equally # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. @@ -179,14 +179,7 @@ jobs: # # Execute tests defined by the CMake configuration. # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail # run: ctest -C $BUILD_TYPE - -# - name: Build pktvisor-cli -# uses: ./.github/actions/build-go -# with: -# context: "." -# goos: windows -# file: "./Dockerfile" - + - name: Debug artifacts shell: pwsh run: | @@ -201,6 +194,7 @@ jobs: path: | ${{github.workspace}}\build\bin\pktvisor-reader.exe ${{github.workspace}}\build\bin\pktvisord.exe + ${{github.workspace}}\golang\pkg\client\version.go retention-days: 1 - name: Login to ns1labs conan @@ -214,6 +208,24 @@ jobs: run: | $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" conan upload "*" --all -r ns1labs -c + + build-cli-win64: + needs: [ build-win64 ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Attach to workspace + uses: actions/download-artifact@v2 + with: + name: windows-build + + - name: Build pktvisor-cli + uses: ./.github/actions/build-go + with: + context: "." + goos: windows + file: "./Dockerfile" package-amd64: needs: [ unit-tests-linux ] From ff5d6c75f4d0c7605f6e390e38ee0a66bf789c54 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:43:46 -0300 Subject: [PATCH 10/18] test --- .github/workflows/build-develop.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 5db893889..4637d5c95 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -215,10 +215,20 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Debug artifacts + shell: bash + run: | + ls -lha + - name: Attach to workspace uses: actions/download-artifact@v2 with: - name: windows-build + name: windows-build + + - name: Debug artifacts + shell: bash + run: | + ls -lha - name: Build pktvisor-cli uses: ./.github/actions/build-go From 78c455b87420678c628926f9ca3adf93d55b3c70 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 13:16:01 -0300 Subject: [PATCH 11/18] test --- .github/workflows/build-develop.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 4637d5c95..0c0aad3c8 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -212,14 +212,7 @@ jobs: build-cli-win64: needs: [ build-win64 ] runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Debug artifacts - shell: bash - run: | - ls -lha - + steps: - name: Attach to workspace uses: actions/download-artifact@v2 with: @@ -229,6 +222,24 @@ jobs: shell: bash run: | ls -lha + + - name: Debug artifacts + shell: bash + run: | + cp -rpf ./build/bin/pktvisor-reader.exe . + cp -rpf ./build/bin/pktvisord.exe . + cp -rpf ./golang/pkg/client/version.go . + rm -rf ./build + rm -rf ./golang + + - uses: actions/checkout@v2 + + - name: Debug artifacts + shell: bash + run: | + ls -lha + mv src pktvisor-src + ls -lha - name: Build pktvisor-cli uses: ./.github/actions/build-go From aaf1c0fbfd034f5d8a8d118d2c5df1e88bf8a8d2 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:17:26 -0300 Subject: [PATCH 12/18] test --- .github/workflows/build-develop.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 0c0aad3c8..de667f5bd 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -231,8 +231,9 @@ jobs: cp -rpf ./golang/pkg/client/version.go . rm -rf ./build rm -rf ./golang - - - uses: actions/checkout@v2 + + - name: Checkout code + uses: actions/checkout@v2 - name: Debug artifacts shell: bash From 7640db7977981be304c3d8fdafa62f24ee13f4ed Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:47:50 -0300 Subject: [PATCH 13/18] test --- .github/workflows/build-develop.yml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index de667f5bd..4d97891ff 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -213,8 +213,11 @@ jobs: needs: [ build-win64 ] runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Attach to workspace - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: windows-build @@ -223,18 +226,6 @@ jobs: run: | ls -lha - - name: Debug artifacts - shell: bash - run: | - cp -rpf ./build/bin/pktvisor-reader.exe . - cp -rpf ./build/bin/pktvisord.exe . - cp -rpf ./golang/pkg/client/version.go . - rm -rf ./build - rm -rf ./golang - - - name: Checkout code - uses: actions/checkout@v2 - - name: Debug artifacts shell: bash run: | From 161b095226422cb0ebb9adeed21da721839cd532 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 15:54:10 -0300 Subject: [PATCH 14/18] test --- .github/workflows/build-develop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 4d97891ff..41f059a62 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -231,6 +231,7 @@ jobs: run: | ls -lha mv src pktvisor-src + cp -rpf golang/pkg/client/version.go . ls -lha - name: Build pktvisor-cli From f87bccc054f9addf9f51960ff1307b96147151b8 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:41:57 -0300 Subject: [PATCH 15/18] test --- .github/workflows/build-develop.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 41f059a62..cebb5d87d 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -239,7 +239,12 @@ jobs: with: context: "." goos: windows - file: "./Dockerfile" + file: "./Dockerfile" + + - name: Debug artifacts + shell: bash + run: | + ls -lha package-amd64: needs: [ unit-tests-linux ] From 298b85d496bbe8cd107e24ec118133cf85bc8924 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Tue, 10 Jan 2023 10:37:40 -0300 Subject: [PATCH 16/18] test --- .github/workflows/build-develop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index cebb5d87d..40cf1bf71 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -245,6 +245,7 @@ jobs: shell: bash run: | ls -lha + mv pktvisor-cli pktvisor-cli.exe package-amd64: needs: [ unit-tests-linux ] From 5cf71976cef786c981c2d3253b68967112d77801 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Tue, 10 Jan 2023 10:43:47 -0300 Subject: [PATCH 17/18] add win build to release generated --- .github/workflows/build-release.yml | 105 ++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 4751f4f37..8e9c8ff8e 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -333,7 +333,12 @@ jobs: .github/hosted-runner/amd64/terraform.tfstate retention-days: 1 - build-windows: + build-win64: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: windows-2019 outputs: version_number: ${{ env.VERSION }} @@ -341,14 +346,23 @@ jobs: - uses: actions/checkout@v2 - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory ${{github.workspace}}\build - name: Get Conan + # You may pin to the exact commit or the version. + # uses: turtlebrowser/get-conan@4dc7e6dd45c8b1e02e909979d7cfc5ebba6ddbe2 uses: turtlebrowser/get-conan@v1.0 - name: Configure CMake + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system shell: bash working-directory: ${{github.workspace}}\build + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 run: PKG_CONFIG_PATH=${{github.workspace}}\local\lib\pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE - name: Get VERSION @@ -360,24 +374,89 @@ jobs: - name: Build working-directory: ${{github.workspace}}\build - shell: pwsh + shell: bash + # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE -- -m - + + # TODO: Fix unit tests for windows platform + #- name: Test + # working-directory: ${{github.workspace}}/build + # shell: bash + # # Execute tests defined by the CMake configuration. + # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + # run: ctest -C $BUILD_TYPE + - name: Debug artifacts shell: pwsh run: | + Get-ChildItem -Force ${{github.workspace}} Get-ChildItem -Force ${{github.workspace}}\build - - - name: compacting x64 windows binary - run: | - $compress = @{ - Path = "${{github.workspace}}\build\pktvisor-cli.exe", "${{github.workspace}}\build\pktvisor-reader.exe", "${{github.workspace}}\build\pktvisord.exe" - CompressionLevel = "Fastest" - DestinationPath = "${{github.workspace}}\build\pktvisor-win64.zip" - } - Compress-Archive @compress + Get-ChildItem -Force ${{github.workspace}}\build\bin + + - name: Persist to workspace + uses: actions/upload-artifact@v2 + with: + name: windows-build + path: | + ${{github.workspace}}\build\bin\pktvisor-reader.exe + ${{github.workspace}}\build\bin\pktvisord.exe + ${{github.workspace}}\golang\pkg\client\version.go + retention-days: 1 + + - name: Login to ns1labs conan + shell: pwsh + run: | + $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" + conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }} + + - name: Cache conan packages + shell: pwsh + run: | + $env:CONAN_USER_HOME = "${{github.workspace}}\build\conan_home" + conan upload "*" --all -r ns1labs -c - - name: Upload arm64 binary to latest release + build-cli-win64: + needs: [ build-win64 ] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Attach to workspace + uses: actions/download-artifact@v3 + with: + name: windows-build + + - name: Debug artifacts + shell: bash + run: | + ls -lha + + - name: Debug artifacts + shell: bash + run: | + mv src pktvisor-src + cp -rpf golang/pkg/client/version.go . + + - name: Build pktvisor-cli + uses: ./.github/actions/build-go + with: + context: "." + goos: windows + file: "./Dockerfile" + + - name: Debug artifacts + shell: bash + run: | + mv ./pktvisor-cli pktvisor-cli.exe + mv ./build/bin/pktvisord.exe ./pktvisord.exe + mv ./build/bin/pktvisor-reader.exe ./pktvisor-reader.exe + + - name: compacting windows binary + run: | + zip pktvisor-win64.zip pktvisor-cli.exe pktvisor-reader.exe pktvisord.exe + + - name: Upload win64 binary to latest release shell: bash run: | chmod a+x ./docker/upload-gh-asset.sh From 4043a111e2d1280f784c51967606c40d58f1ebd0 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Tue, 10 Jan 2023 14:50:49 -0300 Subject: [PATCH 18/18] last test --- .github/workflows/build-develop.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 40cf1bf71..a6485ac31 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -244,8 +244,15 @@ jobs: - name: Debug artifacts shell: bash run: | + mv ./pktvisor-cli pktvisor-cli.exe + mv ./build/bin/pktvisord.exe ./pktvisord.exe + mv ./build/bin/pktvisor-reader.exe ./pktvisor-reader.exe + ls -lha + + - name: compacting windows binary + run: | + zip pktvisor-win64.zip pktvisor-cli.exe pktvisor-reader.exe pktvisord.exe ls -lha - mv pktvisor-cli pktvisor-cli.exe package-amd64: needs: [ unit-tests-linux ]