Fixed memory leak caused by SSL debug function. (#59) #214
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build Polaris examples and generate releases. | |
name: Polaris Build | |
on: | |
push: | |
# Build on a push to any branch. | |
branches: | |
- '*' | |
# Build on a push of any tag named v* (v1.0, etc.) and generate a release. | |
tags: | |
- 'v*' | |
jobs: | |
# Build the C++ example applications. | |
build_cpp: | |
name: Build C++ Applications | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
arch: [x64] | |
os: [ubuntu-latest] | |
tool: [cmake, bazel] | |
compiler: [g++] | |
include: | |
- arch: armv7hf | |
os: ubuntu-latest | |
tool: bazel | |
compiler: g++ | |
- arch: aarch64 | |
os: ubuntu-latest | |
tool: bazel | |
compiler: g++ | |
# Windows not currently supported by C++ library. | |
#- arch: x64 | |
# os: windows-latest | |
# tool: cmake | |
# compiler: msvc | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v2 | |
# Environment setup. | |
- name: Setup Environment (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo "EXT=.exe" >> $GITHUB_ENV | |
- name: Setup Environment (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo "CXX=/usr/bin/${{ matrix.compiler }}" >> $GITHUB_ENV | |
echo "EXT=" >> $GITHUB_ENV | |
- name: Install msbuild (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: microsoft/[email protected] | |
# CMake build support. | |
- name: Install CMake 3.16.x | |
if: matrix.tool == 'cmake' | |
uses: jwlawson/[email protected] | |
with: | |
cmake-version: '3.16.x' | |
# Note: OpenSSL is installed in the system image and works out of the box. | |
# Boost used to be maintained by Github, but was removed from the images in | |
# March 2021 (https://github.com/actions/virtual-environments/issues/2667). | |
# To get around this, we install it with the apt package for Linux. For | |
# Windows, we would need to download and install the pre-built binaries from | |
# https://sourceforge.net/projects/boost/files/boost-binaries. | |
- name: Install Boost (Linux) | |
if: matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt install -y libboost-all-dev | |
- name: Install GFlags | |
if: matrix.tool == 'cmake' | |
run: | | |
curl -L https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.tar.gz --output gflags.tar.gz | |
tar xvzf gflags.tar.gz | |
cd gflags-2.2.2 | |
cmake -B build -DBUILD_SHARED_LIBS=ON . | |
cd build | |
make -j | |
sudo make install | |
- name: Install GLog | |
if: matrix.tool == 'cmake' | |
run: | | |
curl -L https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.tar.gz --output glog.tar.gz | |
tar xvzf glog.tar.gz | |
cd glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6 | |
cmake -B build -DBUILD_SHARED_LIBS=ON . | |
cd build | |
make -j | |
sudo make install | |
- name: Setup Build (CMake) | |
if: matrix.tool == 'cmake' | |
run: | | |
mkdir cmake_build | |
cd cmake_build | |
cmake -DCMAKE_INSTALL_PREFIX=install .. | |
- name: Build Library And Examples (CMake, Linux) | |
if: matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
run: | | |
cd cmake_build | |
make | |
make install | |
- name: Build Library And Examples (CMake, Windows) | |
if: matrix.tool == 'cmake' && matrix.os == 'windows-latest' | |
run: | | |
cd cmake_build | |
MSBuild.exe p1_polaris_client.sln | |
- name: Build External Project Example (CMake, Linux) | |
if: matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
run: | | |
mkdir examples/external_cmake_project/build | |
cd examples/external_cmake_project/build | |
cmake .. | |
make | |
# Bazel build support. | |
- name: Use Bazel 4.2.2 | |
if: matrix.tool == 'bazel' | |
uses: abhinavsingh/setup-bazel@v3 | |
with: | |
version: 4.2.2 | |
- name: Build Library And Examples (Bazel, Native x64) | |
if: matrix.tool == 'bazel' && matrix.arch == 'x64' | |
run: | | |
bazel build -c opt //:polaris_client | |
bazel build -c opt //examples:* | |
- name: Build Library And Examples (Bazel, Cross-Compile) | |
if: matrix.tool == 'bazel' && matrix.arch != 'x64' | |
run: | | |
bazel build -c opt --config=${{ matrix.arch }} //:polaris_client | |
bazel build -c opt --config=${{ matrix.arch }} //examples:* | |
# Run unit tests. | |
- name: Run Unit Tests | |
if: matrix.arch == 'x64' | |
env: | |
POLARIS_API_KEY: ${{ secrets.POLARIS_API_KEY }} | |
run: | | |
./test/run_unit_tests.sh --tool=${{ matrix.tool }} --unique-id-prefix=${{ matrix.tool }}_cpp | |
- name: Run Unit Tests With Installed Libraries (CMake, Linux) | |
if: matrix.arch == 'x64' && matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
env: | |
POLARIS_API_KEY: ${{ secrets.POLARIS_API_KEY }} | |
run: | | |
mv cmake_build/libpolaris_cpp_client.so cmake_build/libpolaris_cpp_client.so.bak | |
mv cmake_build/c/libpolaris_client.so cmake_build/c/libpolaris_client.so.bak | |
./test/run_unit_tests.sh --tool=${{ matrix.tool }} --unique-id-prefix=${{ matrix.tool }}_cpp --install-prefix=cmake_build/install | |
mv cmake_build/libpolaris_cpp_client.so.bak cmake_build/libpolaris_cpp_client.so | |
mv cmake_build/c/libpolaris_client.so.bak cmake_build/c/libpolaris_client.so | |
# Package artifacts (Bazel only -- no need to do this for multiple build | |
# tools). | |
- name: Create artifact | |
if: matrix.tool == 'bazel' | |
run: | | |
bazel query 'kind("cc_binary", //examples:*)' 2>/dev/null | | |
sed -e 's|//examples:|bazel-bin/examples/|' | | |
xargs tar czf polaris_examples.tar.gz --transform 's|^bazel-bin|polaris|' | |
- name: Upload artifact | |
if: matrix.tool == 'bazel' | |
uses: actions/upload-artifact@v1 | |
with: | |
path: polaris_examples.tar.gz | |
name: polaris_examples.cpp.${{ matrix.arch }} | |
# Build the C example applications. | |
build_c: | |
name: Build C Applications | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
arch: [x64] | |
os: [ubuntu-latest] | |
tool: [make, cmake, bazel] | |
compiler: [g++] | |
#include: | |
# Windows not currently supported by C library. | |
# - arch: x64 | |
# os: windows-latest | |
# tool: cmake | |
# compiler: msvc | |
defaults: | |
run: | |
shell: bash | |
working-directory: c | |
steps: | |
- uses: actions/checkout@v2 | |
# Environment setup. | |
- name: Setup Environment (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo "EXT=.exe" >> $GITHUB_ENV | |
- name: Setup Environment (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo "CXX=/usr/bin/${{ matrix.compiler }}" >> $GITHUB_ENV | |
echo "EXT=" >> $GITHUB_ENV | |
- name: Install msbuild (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: microsoft/[email protected] | |
# GNU Make build support. | |
- name: Build Library And Examples (GNU Make) | |
if: matrix.tool == 'make' | |
run: | | |
make -j | |
# CMake build support. | |
- name: Install CMake 3.18.x | |
if: matrix.tool == 'cmake' | |
uses: jwlawson/[email protected] | |
with: | |
cmake-version: '3.18.x' | |
- name: Setup Build (CMake) | |
if: matrix.tool == 'cmake' | |
run: | | |
mkdir cmake_build | |
cd cmake_build | |
cmake -DCMAKE_INSTALL_PREFIX=install .. | |
- name: Build Library And Examples (CMake, Linux) | |
if: matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
run: | | |
cd cmake_build | |
make -j | |
make install | |
- name: Build Library And Examples (CMake, Windows) | |
if: matrix.tool == 'cmake' && matrix.os == 'windows-latest' | |
run: | | |
cd cmake_build | |
MSBuild.exe p1_polaris_c_client.sln | |
- name: Build External Project Example (CMake, Linux) | |
if: matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
run: | | |
mkdir examples/external_cmake_project/build | |
cd examples/external_cmake_project/build | |
cmake .. | |
make | |
# Bazel build support. | |
- name: Use Bazel 4.2.2 | |
if: matrix.tool == 'bazel' | |
uses: abhinavsingh/setup-bazel@v3 | |
with: | |
version: 4.2.2 | |
- name: Build Library And Examples (Bazel, Native x64) | |
if: matrix.tool == 'bazel' && matrix.arch == 'x64' | |
run: | | |
bazel build -c opt //:polaris_client | |
bazel build -c opt //examples:* | |
- name: Build Library And Examples (Bazel, Cross-Compile) | |
if: matrix.tool == 'bazel' && matrix.arch != 'x64' | |
run: | | |
bazel build -c opt --config=${{ matrix.arch }} //:polaris_client | |
bazel build -c opt --config=${{ matrix.arch }} //examples:* | |
# Run unit tests. | |
- name: Run Unit Tests | |
if: matrix.arch == 'x64' | |
env: | |
POLARIS_API_KEY: ${{ secrets.POLARIS_API_KEY }} | |
run: | | |
./test/run_unit_tests.sh --tool=${{ matrix.tool }} --unique-id-prefix=${{ matrix.tool }}_c_ | |
- name: Run Unit Tests With Installed Libraries (CMake, Linux) | |
if: matrix.arch == 'x64' && matrix.tool == 'cmake' && matrix.os == 'ubuntu-latest' | |
env: | |
POLARIS_API_KEY: ${{ secrets.POLARIS_API_KEY }} | |
run: | | |
mv cmake_build/libpolaris_client.so cmake_build/libpolaris_client.so.bak | |
./test/run_unit_tests.sh --tool=${{ matrix.tool }} --unique-id-prefix=${{ matrix.tool }}_c_ --install-prefix=cmake_build/install | |
mv cmake_build/libpolaris_client.so.bak cmake_build/libpolaris_client.so | |
# Package artifacts (Bazel only -- no need to do this for multiple build | |
# tools). | |
- name: Create artifact | |
if: matrix.tool == 'bazel' | |
run: | | |
bazel query 'kind("cc_binary", //examples:*)' 2>/dev/null | | |
sed -e 's|//examples:|bazel-bin/examples/|' | | |
xargs tar czf polaris_examples.tar.gz --transform 's|^bazel-bin|polaris/c|' | |
- name: Upload artifact | |
if: matrix.tool == 'bazel' | |
uses: actions/upload-artifact@v1 | |
with: | |
path: c/polaris_examples.tar.gz | |
name: polaris_examples.c.${{ matrix.arch }} | |
# Create a release only on a tag (not on a branch push). | |
release: | |
name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build_cpp, build_c] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
upload: | |
name: Upload Release Assets | |
needs: [release] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
lang: [cpp, c] | |
arch: [x64, armv7hf, aarch64] | |
exclude: | |
- {lang: c, arch: armv7hf} | |
- {lang: c, arch: aarch64} | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: polaris_examples.${{ matrix.lang }}.${{ matrix.arch }} | |
- name: Set asset filename | |
id: release_info | |
env: | |
TAG_REF_NAME: ${{ github.ref }} | |
run: | | |
# polaris_examples-v1.0.0.cpp.aarch64.tar.gz | |
echo ::set-output name=file_name::polaris_examples-${TAG_REF_NAME##*/v}.${{ matrix.lang }}.${{ matrix.arch }}.tar.gz | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: polaris_examples.${{ matrix.lang }}.${{ matrix.arch }}/polaris_examples.tar.gz | |
asset_name: ${{ steps.release_info.outputs.file_name }} | |
asset_content_type: application/tar+gzip |