From 7ab9f6891568a6f5f4f26cf39d6e68eef8d6bdb6 Mon Sep 17 00:00:00 2001 From: Chris Love Date: Sun, 4 Feb 2024 14:40:28 -0800 Subject: [PATCH] Local CI updates and initial github actions support --- .github/workflows/ci.yml | 96 +++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 74 ---------------- .travis.yml | 119 -------------------------- README.md | 5 +- 4 files changed, 97 insertions(+), 197 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8bc8fa5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,96 @@ +name: ci + +on: [push, pull_request] + +jobs: + build_linux: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + strategy: + matrix: + config: + - { compiler: gcc, version: 5, build_type: Release, cppstd: 11 } + - { compiler: gcc, version: 6, build_type: Release, cppstd: 11 } + - { compiler: gcc, version: 7, build_type: Release, cppstd: 11 } + - { compiler: gcc, version: 8, build_type: Release, cppstd: 11 } + - { compiler: gcc, version: 9, build_type: Release, cppstd: 11 } + - { compiler: gcc, version: 10, build_type: Release, cppstd: 11 } + - { compiler: gcc, version: 11, build_type: Debug, cppstd: 11 } + - { compiler: gcc, version: 12, build_type: Release, cppstd: 11 } + + container: + image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }} + name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }})" + steps: + - uses: actions/checkout@v3 + - name: Setup + run: | + apt-get update && apt-get install -y curl git + CMAKE_VERSION="3.24.2" + curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh + chmod +x install-cmake.sh + ./install-cmake.sh --prefix=/usr/local --skip-license + curl -sSL https://github.com/msgpack/msgpack-c/releases/download/cpp-3.1.1/msgpack-3.1.1.tar.gz -o /tmp/msgpack-c.tar.gz + tar zxf /tmp/msgpack-c.tar.gz + pushd msgpack-3.1.1 && mkdir build && cd build && cmake .. && sudo make install && popd + - name: Setup Compiler + if: matrix.config.compiler == 'clang' + run: | + if [[ "${{ matrix.config.version }}" -ge 4 ]]; then + scripts/ci_setup_clang.sh "${{ matrix.config.version }}" + echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV + fi + echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV + echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV + - name: Build + run: | + mkdir -p build && cd build + cmake .. \ + -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ + -DCMAKE_CXX_STANDARD=${{ matrix.config.cppstd }} \ + -DBUILD_EXAMPLES=${{ matrix.config.examples || 'ON' }} \ + -DBUILD_TESTS=ON + make -j2 + ctest -j2 --output-on-failure + + build_osx: + runs-on: macOS-latest + name: "OS X Clang (C++14, Release)" + steps: + - uses: actions/checkout@v3 + - name: Build + run: | + mkdir -p build && cd build + cmake .. \ + -DCMAKE_PREFIX_PATH=/usr/local/lib/cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_STANDARD=14 \ + -DFMT_SUPPORT=ON \ + -DBUILD_EXAMPLES=ON \ + -DBUILD_TESTS=ON + make -j2 + ctest -j2 --output-on-failure + + build_windows: + runs-on: windows-latest + name: "Windows VS2022 (C++14, Release)" + steps: + - uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1 + - name: Print env + run: | + echo github.event.action: ${{ github.event.action }} + echo github.event_name: ${{ github.event_name }} + - name: Install dependencies on windows + run: | + choco install ninja cmake + ninja --version + cmake --version + - name: Build + run: | + mkdir build + cd build + cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -DFMT_SUPPORT=OFF -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON + ninja diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 94e6d62..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,74 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '31 6 * * 0' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - #- name: Autobuild - # uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - - run: | - wget https://github.com/msgpack/msgpack-c/releases/download/cpp-3.1.1/msgpack-3.1.1.tar.gz -O /tmp/msgpack-c.tar.gz - tar zxf /tmp/msgpack-c.tar.gz - pushd msgpack-3.1.1 && mkdir build && cd build && cmake .. && sudo make install && popd - cmake -DCMAKE_BUILD_TYPE=Release -DSERF_CPP_BUILD_TESTS=OFF -DSERF_CPP_BUILD_EXAMPLE=OFF - make all - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d33924c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,119 +0,0 @@ -# Build matrix / environment variable are explained on: -# http://about.travis-ci.org/docs/user/build-configuration/ -# This file can be validated on: -# http://lint.travis-ci.org/ -# travis-ci.org specification for serf-cpp -# -language: cpp -compiler: - - gcc - # - clang -os: - - linux - -sudo: required -dist: xenial - -matrix: - fast_finish: true - include: - - - os: linux - compiler: gcc - env: - - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9' ] - - - os: linux - compiler: gcc - env: - - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-5' ] - - - os: linux - compiler: gcc - env: - - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6' ] - - - os: linux - compiler: gcc - env: - - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7' ] - - - os: linux - compiler: gcc - env: - - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-8' ] - - - os: linux - compiler: gcc - env: - - MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9' ] - - -before_install: - - eval "${MATRIX_EVAL}" - - # Install boost - - sudo apt-get install -y libboost-all-dev - - # Install lcov - - wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz - - tar xf lcov_1.11.orig.tar.gz - - sudo make -C lcov-1.11/ install - # install lcov to coveralls conversion + upload tool - - gem install coveralls-lcov - - # Install google test - - wget https://github.com/google/googletest/archive/release-1.8.1.tar.gz -O /tmp/gtest.tar.gz - - tar zxf /tmp/gtest.tar.gz - - pushd googletest-* && mkdir build && cd build && cmake .. && sudo make install && popd - - # Install msgpack-c - - wget https://github.com/msgpack/msgpack-c/releases/download/cpp-3.1.1/msgpack-3.1.1.tar.gz -O /tmp/msgpack-c.tar.gz - - tar zxf /tmp/msgpack-c.tar.gz - - pushd msgpack-3.1.1 && mkdir build && cd build && cmake .. && sudo make install && popd - - # Install gcovr - - pip install --user gcovr - -script: - - mkdir build - - cd build - - cmake -D SERF_CPP_BUILD_COVERAGE=TRUE .. && make - - ./tests/SerfCppTests - -after_success: - - lcov --directory . --capture --output-file coverage.info # capture coverage info - - lcov --remove coverage.info 'tests/*' '/usr/*' --output-file coverage.info # filter out system and test code - - lcov --list coverage.info # debug before upload - - coveralls-lcov --repo-token ${COVERALLS_TOKEN} coverage.info # uploads to coveral - - - - - - - diff --git a/README.md b/README.md index c3c2336..271525e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ -[![Build Status](https://travis-ci.com/CJLove/serf-cpp.svg?branch=master)](https://travis-ci.com/CJLove/serf-cpp) -[![Coverage Status](https://coveralls.io/repos/github/CJLove/serf-cpp/badge.svg?branch=master)](https://coveralls.io/github/CJLove/serf-cpp?branch=master) -![CodeQL](https://github.com/CJLove/serf-cpp/workflows/CodeQL/badge.svg) - +[![ci](https://github.com/CJLove/serf-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/CJLove/serf-cpp/actions/workflows/ci.yml) # serf-cpp C++ implementation of serf client (http://www.serfdom.io)