Skip to content

Use log channel to divide traffic for various plugin logging #407

Use log channel to divide traffic for various plugin logging

Use log channel to divide traffic for various plugin logging #407

Workflow file for this run

# Build, Test, and Draft Releae for static and dynamic versions of the
# MTConnect Agent on Windows, Mac OS, and Linux.
#
# The Windows x86 and x86_64 builds create ZIP packages and attach them to
# a draft release when the commit is tagged.
#
# Secret required for Release:
# RELEASE_GITHUB_TOKEN - Release token created by admin in Settings / Developer Settings / Personal access tokens /
# Find-grained tokens
# The token must be renewed every 90 days.
name: Build MTConnect C++ Agent
on:
# Enable automated build once verified
pull_request:
paths-ignore: ["**/*.md", "LICENSE.txt", ".gitignore"]
branches: [ "main", "main-dev" ]
push:
paths-ignore: ["**/*.md", "LICENSE.txt", ".gitignore"]
branches: [ "main", "main-dev" ]
tags:
- "v*.*.*"
# Allow manually run workflows
workflow_dispatch:
jobs:
build_windows:
runs-on: windows-2019
name: "Windows 2019 Arch: ${{ matrix.arch }}, Shared: ${{ matrix.shared }}"
strategy:
matrix:
arch: ["x86", "amd64"]
shared: ["True", "False"]
include:
- arch: "x86"
profile: "vs32"
- arch: "amd64"
profile: "vs64"
- shared: "True"
profile: "vs64shared"
exclude:
- arch: "x86"
shared: "True"
steps:
- name: Setup conan and zip directories
run: |
ruby -e @"
base = ENV['GITHUB_WORKSPACE'].gsub('\\', '/').
gsub(/\/[a-zA-Z]+$/, '')
puts %{ZIP_DIR=#{base}}
puts %{CONAN_HOME=#{base}/conan2}
"@ >> $env:GITHUB_ENV
echo "CTEST_OUTPUT_ON_FAILURE=TRUE" >> $env:GITHUB_ENV
- name: Print Directories
run: |
echo $CONAN_HOME
echo $ZIP_DIR
echo $CTEST_OUTPUT_ON_FAILURE
- name: Checkout Agent
uses: actions/checkout@v3
- name: Cache conan packages
id: cache
uses: actions/cache@v3
with:
path: ${{ env.CONAN_HOME }}
key: ${{ runner.os }}-build-${{ matrix.profile }}-${{ hashFiles('**/conanfile.py') }}
- name: Install Conan
uses: turtlebrowser/[email protected]
- name: Initialize VS Dev Env
uses: seanmiddleditch/gha-setup-vsdevenv@master
with:
arch: ${{ matrix.arch }}
host_arch: ${{ matrix.arch }}
- name: Setup Conan
if: steps.cache.outputs.cache-hit != 'true'
run: |
conan profile detect -f
- name: Cleanup Prior Build
if: steps.cache.outputs.cache-hit == 'true'
continue-on-error: true
run: |
conan remove mtconnect_agent -c
- name: Build and Test C++ Agent
run: |
set CTEST_OUTPUT_ON_FAILURE=TRUE
conan create . --build=missing -pr conan/profiles/${{ matrix.profile }} -o "&:with_docs=False" -o "&:cpack=True" -o "&:cpack_destination=${{ env.ZIP_DIR }}" -o "&:shared=${{ matrix.shared }}"
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.shared == 'False' }}
with:
name: Version ${{ github.ref_name }}
draft: true
files: |
${{ env.ZIP_DIR }}/agent*.zip
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
build_linux:
runs-on: ubuntu-latest
name: "Ubuntu Latest, Shared: ${{ matrix.shared }}"
strategy:
matrix:
shared: ["True", "False"]
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt install -y build-essential cmake gcc-11 g++-11 python3 autoconf automake
- name: Checkout Agent
uses: actions/checkout@v3
- name: Cache conan packages
id: cache
uses: actions/cache@v3
with:
path: ~/.conan2
key: ${{ runner.os }}-build-${{ matrix.shared }}-${{ hashFiles('**/conanfile.py') }}
- name: Install Conan
uses: turtlebrowser/[email protected]
- name: Setup Conan
if: steps.cache.outputs.cache-hit != 'true'
run: |
conan profile detect -f
- name: Cleanup Prior Build
if: steps.cache.outputs.cache-hit == 'true'
continue-on-error: true
run: |
conan remove mtconnect_agent -c
- name: Build and Test C++ Agent
shell: bash
run: |
export CTEST_OUTPUT_ON_FAILURE=TRUE
conan create . --build=missing -pr conan/profiles/gcc -o '&:shared=${{ matrix.shared }}' -o '&:with_docs=False' -o '&:cpack=True' -o '&:cpack_name=dist' -o '&:cpack_destination=${{ github.workspace }}'
- name: Cleanse package version
run: |
if [[ $PACKAGE_VERSION == v*.*.*.* ]]; then
echo "PACKAGE_VERSION=${PACKAGE_VERSION:1}" >> $GITHUB_ENV
elif [[ $PACKAGE_VERSION == [0-9].*.*.* ]]; then
echo "PACKAGE_VERSION=${PACKAGE_VERSION:0}" >> $GITHUB_ENV
else
echo "PACKAGE_VERSION=0.0.0.0" >> $GITHUB_ENV
fi
- name: Prepare Debian Package
shell: bash
working-directory: ${{ github.workspace }}
run: |
mkdir -p pkgroot/home/edge/
ls -lah pkgroot
tar -xzf dist.tar.gz -C pkgroot/
mv pkgroot/dist pkgroot/usr
- name: Create Debian Package
id: create_debian_package
uses: jiro4989/build-deb-action@v3
with:
package: mtconnect-agent
package_root: ${{ github.workspace}}/pkgroot
version: ${{ env.PACKAGE_VERSION }}
arch: amd64
desc: "MTConnect Agent for Ununtu"
maintainer: Datanomix <[email protected]>
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.shared == 'False' }}
with:
name: Version ${{ github.ref_name }}
draft: true
files: |
${{ github.workspace }}/${{ steps.create_debian_package.outputs.file_name }}
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
build_macos:
runs-on: macos-latest
name: "MacOS Latest, Shared: ${{ matrix.shared }}"
strategy:
matrix:
shared: ["True", "False"]
steps:
- name: Checkout Agent
uses: actions/checkout@v3
- name: Cache conan packages
id: cache
uses: actions/cache@v3
with:
path: ~/.conan2
key: ${{ runner.os }}-build-${{ matrix.shared }}-${{ hashFiles('**/conanfile.py') }}
- name: Install Conan
run: |
brew install conan
- name: Setup Conan
if: steps.cache.outputs.cache-hit != 'true'
run: |
conan profile detect -f
- name: Cleanup Prior Build
if: steps.cache.outputs.cache-hit == 'true'
continue-on-error: true
run: |
conan remove mtconnect_agent -c
- name: Build and Test C++ Agent
shell: bash
run: |
export CTEST_OUTPUT_ON_FAILURE=TRUE
conan create . --build=missing -pr conan/profiles/macos -o '&:shared=${{ matrix.shared }}' -o '&:with_docs=False'