Skip to content

Run build

Run build #971

Workflow file for this run

name: Run build
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
schedule:
- cron: "0 7 * * 1,3,5"
env:
VBUILD_UNIT_TESTS: true
CONAN_VER: 1.57.0
BUILD_WRAPPER_OUT_DIR_SONAR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
jobs:
run-build-ubuntu:
runs-on: ubuntu-20.04
timeout-minutes: 75
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: Install code coverage tools
run: |
sudo apt-get -y install lcov=1.14-2 html2text=1.3.2a-25 gcovr
- name: Install Conan
run: pip3 install conan==${{ env.CONAN_VER }} --force
- uses: yokawasa/action-setup-kube-tools@v0.9.2
with:
setup-tools: |
kubectl
helm
tilt
# This should be in sync with the minikube-deployed kube version below
kubectl: "1.24.1"
helm: "3.9.1"
tilt: "0.30.4"
- run: |
kubectl version --client
kustomize version
tilt version
- name: start minikube
id: minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: 1.26.0
# This should be in sync with the setup-tools version above
kubernetes-version: 1.24.1
- name: Run tilt & C++ build and run sanity test
env:
# This test script is passed to the tilt file
TEST_SCRIPT: ../../../build-and-run-sanity-test.sh
VBUILD_CODE_COVERAGE: true
run: |-
kubectl version
pwd
cd .github/workflows/roundtrip
pwd
tilt ci
- name: Collect coverage into one XML report using GCOVR
run: |
cd src
gcovr > coverageGcovr.txt
gcovr --sonarqube > coverageGcovrSonar.xml
- name: Upload coverage report from GCOVR
uses: actions/upload-artifact@v3
with:
name: gcovr-coverage-reports
path: |
src/coverageGcovr.txt
src/coverageGcovrSonar.xml
- name: Install sonar-scanner and build-wrapper
if: github.event.pull_request.head.repo.full_name == github.repository
uses: sonarsource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
cd ${{ github.workspace }}
# to be in folder containing conanfile
cd src
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR_SONAR }} ./build-all.sh
cp -r build_wrapper_output_directory /home/runner/work/client-cpp/client-cpp
- name: Run sonar-scanner
if: github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR_SONAR }}"
- name: Get Version
run: |
VER=$(cat VERSION)
echo "V_VERSION=$VER" >> $GITHUB_ENV
- name: Get Timestamp
run : |
TSTAMP=$(date +'%Y%m%d%H%M%S')
echo "V_TIMESTAMP=$TSTAMP" >> $GITHUB_ENV
- name: Save artifacts
uses: actions/upload-artifact@v3
if: (github.event_name != 'pull_request') && (github.event_name != 'schedule')
with:
name: opentdf-client-cpp-lin-${{ env.V_VERSION }}-${{ env.V_TIMESTAMP }}
path: |
dist/*
- name: Save code coverage data
uses: actions/upload-artifact@v3
with:
name: code-coverage
path: |
code-coverage.tar.gz
- run: echo "🍏 This job's status is ${{ job.status }}."
run-build-windows:
runs-on: windows-2019
needs: run-build-ubuntu
env:
VBUILDRELEASE: Release
VBUILDDEBUG: Debug
VBUILDMODE: Release
steps:
- run: echo "🎉 The job was automatically triggered by a %github.event_name% event."
- run: echo "🐧 This job is now running on a %runner.os% server hosted by GitHub!"
- run: echo "🔎 The name of your branch is %github.ref% and your repository is %github.repository%."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The %github.repository% repository has been cloned to the runner."
- name: Install Conan
run: pip3 install conan==${{ env.CONAN_VER }} --force
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Run build
run: |
cd ${{ github.workspace }}
cd src
.\build-all.bat
cd build
msbuild RUN_TESTS.vcxproj /p:Configuration=Release
# The windows-specific GITHUB_ENV set is not documented, and it's different than unix flavors. Must use '$env:GITHUB_ENV'
# Ref: https://stackoverflow.com/questions/61858388/how-do-i-set-an-enviroment-variable-in-github-action-on-a-windows-server
- name: Get Version
run: |
chcp 65001 #set code page to utf-8
$V_VER = Get-Content .\VERSION
echo "V_VERSION=$V_VER" >> $env:GITHUB_ENV
- name: Get Timestamp
run : |
$V_TSTAMP = Get-Date((Get-Date).toUniversalTime()) -Format "yyyyMMddHHmmss"
echo "V_TIMESTAMP=$V_TSTAMP" >> $env:GITHUB_ENV
- name: Save artifacts
uses: actions/upload-artifact@v3
if: (github.event_name != 'pull_request') && (github.event_name != 'schedule')
with:
name: opentdf-client-cpp-win-${{ env.V_VERSION }}-${{ env.V_TIMESTAMP }}
path: |
dist/*
- run: echo "🍏 This job's status is %job.status%."
run-build-mac:
runs-on: macos-11
needs: run-build-ubuntu
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Conan
run: pip3 install conan==${{ env.CONAN_VER }} --force
- name: Run build
run: |
cd ${{ github.workspace }}
cd src
./build-all.sh
- name: Get Version
run: |
VER=$(cat VERSION)
echo "V_VERSION=$VER" >> $GITHUB_ENV
- name: Get Timestamp
run : |
TSTAMP=$(date +'%Y%m%d%H%M%S')
echo "V_TIMESTAMP=$TSTAMP" >> $GITHUB_ENV
- name: Save artifacts
uses: actions/upload-artifact@v3
if: (github.event_name != 'pull_request') && (github.event_name != 'schedule')
with:
name: opentdf-client-cpp-mac-${{ env.V_VERSION }}-${{ env.V_TIMESTAMP }}
path: |
dist/*
- run: echo "🍏 This job's status is ${{ job.status }}."
ci:
needs:
- run-build-mac
- run-build-ubuntu
- run-build-windows
if: always()
runs-on: ubuntu-latest
steps:
- run: exit 1
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}