Skip to content

Commit

Permalink
Merge pull request #74 from ns1labs/release
Browse files Browse the repository at this point in the history
Release 3.2.0
  • Loading branch information
weyrick authored Apr 16, 2021
2 parents 5707c68 + 7cfeee0 commit f220568
Show file tree
Hide file tree
Showing 152 changed files with 15,535 additions and 1,959 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ cmake-build*
integration_tests/external*
Dockerfile
.dockerignore
.gitignore
.git
appimage/Dockerfile.part
appimage/export.sh
appimage/Makefile
223 changes: 223 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
name: Build

on:
workflow_dispatch:
pull_request:
branches:
- develop
- release
push:
branches:
- develop
- release

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# 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
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}

steps:
- 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: Conan profile and settings
run: |
conan profile new --detect default
conan config set general.revisions_enabled=1
- name: Conan profile (linux-workaround)
if: matrix.os == 'ubuntu-latest'
run:
conan profile update settings.compiler.libcxx=libstdc++11 default

- name: Conan install (osx-workaround)
if: matrix.os == 'macos-latest'
working-directory: ${{github.workspace}}/build
run: |
conan remote add ns1labs-conan https://ns1labs.jfrog.io/artifactory/api/conan/ns1labs-conan
conan install --build=missing ..
- name: linux package install
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends golang ca-certificates jq
- 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: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE -- -j 2

- 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

package:
needs: build
runs-on: ubuntu-latest
# if this is a push into one of our main branches (rather than just a pull request), we will also package
if: github.event_name != 'pull_request'

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: Conan profile and settings
run: |
conan profile new --detect default
conan config set general.revisions_enabled=1
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Configure CMake to generate VERSION
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Debug branch name
run: echo ${{ env.BRANCH_NAME }}

- name: Get VERSION
run: |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}

- name: Generate ref tag (master)
if: ${{ env.BRANCH_NAME == 'master' }}
run: |
echo "REF_TAG=latest" >> $GITHUB_ENV
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "DRAFT=true" >> $GITHUB_ENV
- name: Generate ref tag (develop)
if: ${{ env.BRANCH_NAME == 'develop' }}
run: |
echo "REF_TAG=latest-develop" >> $GITHUB_ENV
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "DRAFT=false" >> $GITHUB_ENV
- name: Generate ref tag (release candidate)
if: ${{ env.BRANCH_NAME == 'release' }}
run: |
echo "REF_TAG=latest-rc" >> $GITHUB_ENV
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "DRAFT=false" >> $GITHUB_ENV
- name: Debug ref tag
run: echo ${{ env.REF_TAG }}

- name: Manage Github ref tags
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
# note deleteRef can't start with refs/, but create createRef does.
script: |
try {
await github.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ env.REF_TAG }}",
})
} catch (e) {
console.log("The tag doesn't exist yet: " + e)
}
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.REF_TAG }}",
sha: context.sha
})
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build + push VERSION - pktvisor
env:
IMAGE_NAME: ns1labs/pktvisor
run: |
docker build . --file docker/Dockerfile --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
docker push ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Tag + push docker image with ref tag (cached build) - pktvisor
env:
IMAGE_NAME: ns1labs/pktvisor
run: |
docker build . --file docker/Dockerfile --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
docker push ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
- name: Build + push VERSION - pktvisor-prom-write
env:
IMAGE_NAME: ns1labs/pktvisor-prom-write
working-directory: ${{github.workspace}}/centralized_collection/prometheus/docker-grafana-agent
run: |
docker build . --file Dockerfile --build-arg PKTVISOR_TAG=${{ env.REF_TAG }} --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
docker push ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Tag + push docker image with ref tag (cached build) - pktvisor-prom-write
env:
IMAGE_NAME: ns1labs/pktvisor-prom-write
working-directory: ${{github.workspace}}/centralized_collection/prometheus/docker-grafana-agent
run: |
docker build . --file Dockerfile --build-arg PKTVISOR_TAG=${{ env.REF_TAG }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
docker push ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
- name: Generate AppImage
env:
IMAGE_NAME: ns1labs/pktvisor
working-directory: ${{github.workspace}}/appimage
run: |
DEV_IMAGE="${{ env.IMAGE_NAME }}:${{ env.VERSION }}" DEV_MODE=t make pktvisor-x86_64.AppImage
mv pktvisor-x86_64.AppImage pktvisor-x86_64-${{ env.VERSION }}.AppImage
- name: Upload AppImage artifact
uses: actions/upload-artifact@v2
with:
name: pktvisor-x86_64-${{ env.VERSION }}.AppImage
path: ${{github.workspace}}/appimage/pktvisor-x86_64-${{ env.VERSION }}.AppImage

112 changes: 0 additions & 112 deletions .github/workflows/cmake.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ cmake-build-*/
docs/html-documentation-generated*
integration_tests/external
golang/pkg/client/version.go
docs/internals/html
appimage/*.AppImage
1 change: 1 addition & 0 deletions 3rd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ message(STATUS "3rd party libraries")
add_subdirectory(datasketches)
add_subdirectory(rng)
add_subdirectory(timer)
add_subdirectory(libmaxminddb)
Loading

0 comments on commit f220568

Please sign in to comment.