diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 0000000..7b1ba25 --- /dev/null +++ b/.github/actionlint-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "actionlint", + "pattern": [ + { + "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + "code": 5 + } + ] + } + ] + } \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c747256..8e47a42 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -31,14 +31,12 @@ jobs: steps: - name: Set up base image dependencies 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 -y update + yum install -y ca-certificates cmake gcc gcc-c++ make wget + 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 + shell: bash - uses: actions/checkout@v3 @@ -47,6 +45,24 @@ jobs: cmake3 -DCFL_DEV=on . make + 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: | + apt-get update + apt-get install -y build-essential cmake make + shell: bash + + - uses: actions/checkout@v3 + + - name: Run compilation + run: | + cmake -DCFL_DEV=on . + make + build-unix-arm64: name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }} runs-on: ${{ matrix.os }} @@ -75,6 +91,7 @@ jobs: CTEST_OUTPUT_ON_FAILURE=1 make test env: CC: ${{ matrix.compiler }} + build-unix-amd64: name: Build sources on amd64 for ${{ matrix.os }} - ${{ matrix.compiler }} runs-on: ${{ matrix.os }} @@ -93,3 +110,30 @@ jobs: CTEST_OUTPUT_ON_FAILURE=1 make test env: CC: ${{ matrix.compiler }} + + 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@v3 + with: + submodules: true + + - uses: docker://lpenz/ghaction-cmake:0.19 + with: + preset: ${{ matrix.preset }} + # dependencies_debian: '' + cmakeflags: '-DCFL_TESTS=On -DCFL_DEV=on .' + build_command: make all diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..7e3dc05 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,30 @@ +name: Lint PRs +on: + pull_request: + workflow_dispatch: + +jobs: + shellcheck: + runs-on: ubuntu-latest + name: Shellcheck + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + - uses: ludeeus/action-shellcheck@master + with: + ignore_paths: lib + + actionlint: + runs-on: ubuntu-latest + name: Actionlint + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + - run: | + echo "::add-matcher::.github/actionlint-matcher.json" + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + ./actionlint -color -shellcheck= + shell: bash + diff --git a/.github/workflows/packages.yaml b/.github/workflows/packages.yaml index a7bacf0..91c14db 100644 --- a/.github/workflows/packages.yaml +++ b/.github/workflows/packages.yaml @@ -85,9 +85,11 @@ jobs: - name: Unstable release on push to master to make it easier to download uses: pyTooling/Actions/releaser@r0 + continue-on-error: true with: token: ${{ secrets.GITHUB_TOKEN }} tag: 'unstable' + rm: true files: | artifacts/**/* diff --git a/CMakeLists.txt b/CMakeLists.txt index ed28f42..b1f89fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.12) project(cfl C) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -123,6 +123,16 @@ if(NOT TARGET xxhash) add_subdirectory(lib/xxhash/cmake_unofficial EXCLUDE_FROM_ALL) endif() +# Installation Directories +# ======================== +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(CFL_INSTALL_BINDIR "bin") + set(CFL_INSTALL_LIBDIR "lib") +else() + set(CFL_INSTALL_BINDIR ${CMAKE_INSTALL_FULL_BINDIR}) + set(CFL_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}") +endif() + # CFL sources add_subdirectory(src)