Skip to content

build: prepare v1.0.0 #309

build: prepare v1.0.0

build: prepare v1.0.0 #309

Workflow file for this run

name: Build PR(s) and master branch.
on:
push:
branches:
- master
pull_request:
branches:
- master
types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
build-windows:
name: Build sources on amd64 for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-2022]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Build on ${{ matrix.os }} with MSVC
run: |
.\scripts\win_build.bat
- name: Run unit tests.
run: |
ctest --rerun-failed --output-on-failure -C Debug --test-dir .\tests\
build-msys2:
name: Build sources on MSYS2 for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-2022]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Get dependencies w/ chocolatey
uses: crazy-max/ghaction-chocolatey@dfdcf5bba9c0a16358a21c13a06ec5c89024b3ac # v4
with:
args: install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System'
- uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2
with:
update: true
msystem: UCRT64
path-type: inherit
install: >-
mingw-w64-ucrt-x86_64-gcc
- name: Build on ${{ matrix.os }} with MSYS2
shell: msys2 {0}
run: |
cmake -G "MinGW Makefiles" -DCFL_TESTS=On .
cmake --build .
- name: Run unit tests.
run: |
ctest --rerun-failed --output-on-failure -C Debug --test-dir .\tests\
build-centos:
name: CentOS 7 build to confirm no issues once used downstream
runs-on: ubuntu-latest
container: centos:7
env:
# workaround required for checkout@v3, https://github.com/actions/checkout/issues/1590
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Set up base image dependencies
run: |
sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
yum -y update
yum install -y ca-certificates gcc gcc-c++ git make wget
yum install -y epel-release
shell: bash
- name: Install CMake 3.20.0
run: |
CMAKE_VERSION=3.20.0
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local
ln -sf /usr/local/bin/cmake /usr/bin/cmake
cmake --version
- name: Clone repo without submodules (1.8.3 version of Git)
run: |
git clone https://github.com/fluent/cfl.git
shell: bash
- name: Check out the branch (1.8.3 version of Git)
env:
BRANCH_NAME: ${{ github.head_ref }}
run: |
git checkout "$BRANCH_NAME"
shell: bash
working-directory: cfl
- name: Run compilation
run: |
cmake -DCFL_DEV=on .
make
working-directory: cfl
build-debian:
name: Debian Buster build to confirm no issues once used downstream
runs-on: ubuntu-latest
container: debian:buster
steps:
- name: Set up base image dependencies
run: |
printf '%s\n' \
'deb http://archive.debian.org/debian buster main' \
'deb http://archive.debian.org/debian-security buster/updates main' \
> /etc/apt/sources.list
apt-get -o Acquire::Check-Valid-Until=false update
apt-get install -y build-essential wget make gcc g++
- name: Install CMake 3.20.0
run: |
CMAKE_VERSION=3.20.0
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local
# Ensure the new CMake is found first
export PATH="/usr/local/bin:$PATH"
# Confirm CMake installation
/usr/local/bin/cmake --version
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Run compilation
run: |
/usr/local/bin/cmake -DCFL_DEV=on .
make
build-unix-arm64:
name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler: [ gcc, clang ]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
uses: uraimo/run-on-arch-action@f9b26e3a1a408d5fd530d20c17b9f3f4428ff8d9 # v3.1.0
with:
arch: aarch64
distro: ubuntu_latest
run: |
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
clang \
cmake \
file \
make
export CC=${{ matrix.compiler }}
"$CC" --version
cmake -DCFL_TESTS=On .
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
build-unix-amd64:
name: Build sources on amd64 for ${{ matrix.os }} - ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [ gcc, clang ]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
run: |
echo "CC = $CC, CXX = $CXX"
cmake -DCFL_TESTS=On .
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
env:
CC: ${{ matrix.compiler }}
build-c-dialects:
name: Build sources with GNU ${{ matrix.standard }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
standard: [99, 17]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Configure, build, and test
run: |
cmake -S . -B build \
-DCFL_TESTS=On \
-DCMAKE_C_STANDARD=${{ matrix.standard }} \
-DCMAKE_C_STANDARD_REQUIRED=On \
-DCMAKE_C_EXTENSIONS=On
cmake --build build -j2
ctest --test-dir build --output-on-failure
build-downstream:
name: Build downstream consumer ${{ matrix.consumer }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
consumer: [cmetrics, cprofiles, ctraces, fluent-bit]
steps:
- name: Check out CFL
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: cfl
- name: Check out ${{ matrix.consumer }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: fluent/${{ matrix.consumer }}
path: consumer
submodules: recursive
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y bison flex libssl-dev libyaml-dev
- name: Report bundled CFL version
shell: bash
run: |
version_from()
{
local cmake_file="$1"
local major
local minor
local patch
major=$(sed -n 's/^set(CFL_VERSION_MAJOR *\([0-9][0-9]*\)).*/\1/p' "$cmake_file")
minor=$(sed -n 's/^set(CFL_VERSION_MINOR *\([0-9][0-9]*\)).*/\1/p' "$cmake_file")
patch=$(sed -n 's/^set(CFL_VERSION_PATCH *\([0-9][0-9]*\)).*/\1/p' "$cmake_file")
echo "${major}.${minor}.${patch}"
}
cfl_version=$(version_from cfl/CMakeLists.txt)
bundled_version=$(version_from consumer/lib/cfl/CMakeLists.txt)
echo "CFL under test: ${cfl_version}" >> "$GITHUB_STEP_SUMMARY"
echo "${{ matrix.consumer }} bundled CFL: ${bundled_version}" >> "$GITHUB_STEP_SUMMARY"
if [[ "$cfl_version" != "$bundled_version" ]]; then
echo "::warning::${{ matrix.consumer }} bundles CFL ${bundled_version}; current CFL is ${cfl_version}"
fi
- name: Replace bundled CFL with the version under test
run: |
rm -rf consumer/lib/cfl
mkdir -p consumer/lib/cfl
git -C cfl archive HEAD | tar -x -C consumer/lib/cfl
- name: Configure ${{ matrix.consumer }}
shell: bash
run: |
case "${{ matrix.consumer }}" in
cmetrics)
cmake -S consumer -B build -DCMT_TESTS=On
;;
cprofiles)
cmake -S consumer -B build -DCPROF_TESTS=On
;;
ctraces)
cmake -S consumer -B build -DCTR_TESTS=On
;;
fluent-bit)
cmake -S consumer -B build \
-DFLB_ALL=Off \
-DFLB_EXAMPLES=Off \
-DFLB_SHARED_LIB=Off \
-DFLB_PROCESSOR_CONTENT_MODIFIER=On \
-DFLB_PROCESSOR_METRICS_SELECTOR=On \
-DFLB_PROCESSOR_SQL=On \
-DFLB_PROCESSOR_SAMPLING=On
;;
esac
- name: Build ${{ matrix.consumer }}
run: cmake --build build -j2
- name: Test ${{ matrix.consumer }}
if: matrix.consumer != 'fluent-bit'
run: ctest --test-dir build --output-on-failure
build-installed-consumer:
name: Build an installed CFL consumer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Build and install CFL
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PWD/install"
cmake --build build -j2
cmake --install build
- name: Build and run the external consumer
run: |
cmake -S tests/installed_consumer -B consumer-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$PWD/install"
cmake --build consumer-build -j2
./consumer-build/cfl-installed-consumer
build-analysis-tests:
name: Build with various code analysis tools
strategy:
fail-fast: false
matrix:
preset:
- clang-sanitize-address
- clang-sanitize-memory
- clang-sanitize-undefined
- clang-sanitize-dataflow
- clang-sanitize-safe-stack
- valgrind
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true
- uses: docker://lpenz/ghaction-cmake@sha256:b59f08ebbbae1ed35650f774e3f2fd77e9c56e10cc841349d923ab4b65724aed
with:
pre_command: |
CMAKE_VERSION=3.20.0
curl -fsSLO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local
cmake --version
preset: ${{ matrix.preset }}
cmakeflags: '-DCFL_TESTS=On -DCFL_DEV=on .'
build_command: make all
# this job provides the single required status for PRs to be merged into main.
# instead of updating the protected branch status in github, developers can update the needs section below
# to require additional status checks to protect main.
# the job uses the alls-green action to get around the github issue that treats a "skipped" required status check
# as passed. github will skip a job if an upstream needed job fails, which would defeat the purpose of this required
# status check.
test-required-checks-complete:
# note: this step always has to run in order to check if the dependent jobs passed. by default github skips running a job
# if the needed jobs upstream failed.
if: always()
needs:
- build-windows
- build-msys2
- build-centos
- build-debian
- build-unix-arm64
- build-unix-amd64
- build-c-dialects
- build-downstream
- build-installed-consumer
- build-analysis-tests
name: Required checks complete
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}