From 9ccc6f89171d6792f9605b77b4efd27bc28f472a Mon Sep 17 00:00:00 2001 From: Pat Date: Wed, 1 Dec 2021 16:35:08 +0000 Subject: [PATCH] workflows: Add PR check for CentOS 7 compilation (#4381) * workflows provide in-repo centos 7 compile checks for PR Signed-off-by: Patrick Stephens --- .github/workflows/README.workflows.md | 3 ++- .github/workflows/pr-compile-check.yaml | 30 +++++++++++++++++++++++++ dockerfiles/Dockerfile.centos7 | 24 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-compile-check.yaml create mode 100644 dockerfiles/Dockerfile.centos7 diff --git a/.github/workflows/README.workflows.md b/.github/workflows/README.workflows.md index dfdb3505264..695f4615fd6 100644 --- a/.github/workflows/README.workflows.md +++ b/.github/workflows/README.workflows.md @@ -6,6 +6,7 @@ | [build-release](./build-release.yaml) | Builds the distro packages and docker images from a tagged release| on new release/tag| | [publish-release](./publish-release.yaml) | Publishes the docker images/manifest on hub.docker.io/fluent/ and the distro packages | on new release/tag on build-release completes| | [pr-closed-docker](./pr-closed-docker.yaml) | Removes docker images for PR on hub.docker.io/fluentbitdev/| on pr closed| +| [pr-compile-check](./pr-compile-check.yaml) | Runs some compilation sanity checks on a PR | | [pr-stale](./pr-stale.yaml) | Closes stale PR(s) with no activity in 30 days | scheduled daily 01:30 AM UTC| | [integration-build-master](./integration-build-master.yaml) | Builds a docker image to be used in integration testing (master branch) | on new commit/push on master| | [integration-build-pr](./integration-build-pr.yaml) | Builds a docker image to be used in integration testing (pr branch) | on new commit/push on PR(s) | @@ -15,7 +16,7 @@ ### Available labels -| Label name | Description | +| Label name | Description | | :----------|-------------| | docs-required| default tag used to request documentation, has to be removed before merge | | ok-to-test | run all integration tests | diff --git a/.github/workflows/pr-compile-check.yaml b/.github/workflows/pr-compile-check.yaml new file mode 100644 index 00000000000..00360368699 --- /dev/null +++ b/.github/workflows/pr-compile-check.yaml @@ -0,0 +1,30 @@ +name: 'Pull requests compile checks' +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + workflow_dispatch: + +jobs: + # Sanity check for compilation using older compiler on CentOS 7 + pr-compile-centos-7: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout Fluent Bit code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Attempt to build current source for CentOS 7 + uses: docker/build-push-action@v2 + with: + context: . + file: ./dockerfiles/Dockerfile.centos7 + # No need to use after this so discard completely + push: false + load: false diff --git a/dockerfiles/Dockerfile.centos7 b/dockerfiles/Dockerfile.centos7 new file mode 100644 index 00000000000..412d89f7b51 --- /dev/null +++ b/dockerfiles/Dockerfile.centos7 @@ -0,0 +1,24 @@ +# This container image is primarily used to test compilation works for CentOS 7, it is +# not intended for production usage. +# Based on https://github.com/fluent/fluent-bit-packaging/tree/master/distros/centos/7 +FROM centos:7 + +RUN yum -y update && \ + yum install -y rpm-build curl ca-certificates gcc gcc-c++ cmake make bash \ + wget unzip systemd-devel wget flex bison \ + cyrus-sasl-lib cyrus-sasl-devel openssl openss-libs openssl-devel \ + postgresql-libs postgresql-devel postgresql-server postgresql && \ + wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \ + rpm -ivh epel-release-latest-7.noarch.rpm && \ + yum install -y cmake3 + +COPY . /src/ +WORKDIR /src/build + +RUN cmake3 -DCMAKE_INSTALL_PREFIX=/opt/td-agent-bit/ -DCMAKE_INSTALL_SYSCONFDIR=/etc/ \ + -DFLB_RELEASE=On -DFLB_TRACE=On -DFLB_TD=On \ + -DFLB_SQLDB=On -DFLB_HTTP_SERVER=On \ + -DFLB_OUT_KAFKA=On \ + -DFLB_OUT_PGSQL=On ../ + +RUN make -j $(getconf _NPROCESSORS_ONLN)