diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ff3d1ae --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +build +lib/cfl/build-review diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 39ef7c9..eb31f56 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest] + os: [windows-latest, windows-2022] permissions: contents: read steps: @@ -22,7 +22,12 @@ jobs: with: submodules: true - - name: Build on ${{ matrix.os }} + - name: Set up with Developer Command Prompt for Microsoft Visual C++ + uses: ilammy/msvc-dev-cmd@v1 + with: + toolset: 14.29 # For using VS2019 C++ + + - name: Build on ${{ matrix.os }} with vs-2019 run: | .\scripts\win_build.bat @@ -33,61 +38,41 @@ jobs: 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 + permissions: + contents: read 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 - yum install -y libcurl-devel - - 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/ctraces.git - shell: bash + - name: Check out the repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + submodules: recursive - - name: Check out the branch (1.8.3 version of Git) - env: - BRANCH_NAME: ${{ github.head_ref }} - run: | - git checkout "$BRANCH_NAME" - git submodule update --init --recursive - shell: bash - working-directory: ctraces + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 - - name: Run compilation - run: | - cmake -DCTR_TESTS=on -DCTR_DEV=on . - make - working-directory: ctraces + - name: Build sources on CentOS 7 + uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 + with: + context: . + file: ./dockerfiles/Dockerfile.centos7 + push: false + load: false + provenance: false build-debian: - name: Debian Bullseye build to confirm no issues once used downstream + name: Debian Bookworm build to confirm no issues once used downstream runs-on: ubuntu-latest - container: debian:bullseye + container: debian:bookworm steps: - name: Set up base image dependencies run: | apt-get update apt-get install -y build-essential wget make gcc g++ git libcurl4-openssl-dev + - name: Check out the repository + uses: actions/checkout@v7 + with: + submodules: recursive + - name: Install CMake 3.20.0 run: | CMAKE_VERSION=3.20.0 @@ -102,24 +87,12 @@ jobs: # Confirm CMake installation /usr/local/bin/cmake --version - - name: Clone repository and submodules - run: | - git clone --recursive https://github.com/fluent/ctraces.git - shell: bash - - - name: Initialize submodules - run: | - git submodule update --init --recursive - shell: bash - working-directory: ctraces - - name: Run compilation run: | - cmake -DCTR_TESTS=On -DCTR_DEV=On . - make all - CTEST_OUTPUT_ON_FAILURE=1 make test + cmake -S . -B build -DCTR_TESTS=On -DCTR_DEV=On + cmake --build build -j "$(getconf _NPROCESSORS_ONLN)" + ctest --test-dir build --output-on-failure shell: bash - working-directory: ctraces build-unix-arm64: name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }} @@ -228,7 +201,7 @@ jobs: - name: Configure and Build run: | - /usr/local/bin/cmake -DCTR_TESTS=On -DCTR_DEV=On -DCMT_DEV=on . + /usr/local/bin/cmake -DCTR_TESTS=On -DCTR_DEV=On . make all # this job provides the single required status for PRs to be merged into main. diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b7aceb2..f4c64ed 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -5,16 +5,20 @@ on: jobs: - shellcheck-pr: + shellcheck: runs-on: ubuntu-latest - name: PR - Shellcheck + name: Shellcheck + permissions: + contents: read steps: - uses: actions/checkout@v7 - uses: ludeeus/action-shellcheck@master - actionlint-pr: + actionlint: runs-on: ubuntu-latest - name: PR - Actionlint + name: Actionlint + permissions: + contents: read steps: - uses: actions/checkout@v7 - run: | @@ -22,11 +26,3 @@ jobs: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) ./actionlint -color -shellcheck= shell: bash - - docslint-pr: - runs-on: ubuntu-latest - name: PR - Markdownlint - steps: - - uses: actions/checkout@v7 - - name: Run markdownlint - uses: actionshub/markdownlint@v3.1.4 diff --git a/.github/workflows/packages.yaml b/.github/workflows/packages.yaml index 6017d58..fbfc458 100644 --- a/.github/workflows/packages.yaml +++ b/.github/workflows/packages.yaml @@ -14,13 +14,13 @@ jobs: runs-on: ubuntu-latest name: build arm64 packages strategy: - fail-fast: false + fail-fast: true matrix: format: [ rpm, deb ] steps: - uses: actions/checkout@v7 with: - submodules: true + submodules: true - uses: uraimo/run-on-arch-action@v3.1.0 name: Build the ${{matrix.format}} packages @@ -48,14 +48,14 @@ jobs: build-distro-packages-amd64: name: build amd64 packages strategy: - fail-fast: false + fail-fast: true matrix: format: [ rpm, deb ] runs-on: [ ubuntu-latest ] steps: - uses: actions/checkout@v7 with: - submodules: true + submodules: true - name: Build the ${{matrix.format}} packages run: | diff --git a/dockerfiles/Dockerfile.centos7 b/dockerfiles/Dockerfile.centos7 new file mode 100644 index 0000000..90dc331 --- /dev/null +++ b/dockerfiles/Dockerfile.centos7 @@ -0,0 +1,23 @@ +# This image is used only to verify that ctraces builds on CentOS 7. +FROM centos:7 + +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++ make wget libcurl-devel && \ + yum clean all + +ARG CMAKE_VERSION="3.20.0" + +RUN wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh" \ + -O /tmp/cmake-installer.sh && \ + chmod +x /tmp/cmake-installer.sh && \ + /tmp/cmake-installer.sh --skip-license --prefix=/usr/local && \ + rm -f /tmp/cmake-installer.sh + +COPY . /src/ +WORKDIR /src/build + +RUN cmake -DCTR_TESTS=On -DCTR_DEV=On .. && \ + cmake --build . -j "$(getconf _NPROCESSORS_ONLN)" && \ + ctest --output-on-failure