Skip to content

Merge pull request #70 from owent/dev #405

Merge pull request #70 from owent/dev

Merge pull request #70 from owent/dev #405

Workflow file for this run

name: "main"
on: # @see https://help.github.com/en/articles/events-that-trigger-workflows#webhook-events
push:
branches: # Array of patterns that match refs/heads
- main
pull_request:
branches: [main]
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: CI Job
shell: bash
run: |
bash ci/do_ci.sh format ;
unix_build: # job id, can be any string
name: Unix Build
# This job runs on Linux
strategy:
matrix:
include:
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
ci_mode: mbedtls
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
ci_mode: libressl
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
ci_mode: boringssl
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
ci_mode: openssl-1.1.1
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
ci_mode: no-rtti
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
ci_mode: no-exceptions
- os: ubuntu-latest
triplet: x64-linux
cc: gcc-latest
- os: ubuntu-20.04
triplet: x64-linux
cc: gcc-4.8
- os: ubuntu-latest
triplet: x64-linux
cc: clang-latest
- os: macos-latest
triplet: x64-osx
cc: clang-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate cache key
shell: bash
run: git submodule > '.github/.cache-key'
- name: Cache packages
uses: actions/cache@v3
with:
path: |
/usr/local/share/vcpkg/installed
third_party/install
key: ${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.ci_mode }}-${{ hashFiles('.github/.cache-key') }}
- name: Build & Test
shell: bash
env:
USE_CC: ${{ matrix.cc }}
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
CI_MODE: ${{ matrix.ci_mode }}
run: |
# The OpenSSL config package in apple ci job is break
if [ -e /opt/homebrew/lib/cmake/OpenSSL ]; then
rm -rf /opt/homebrew/lib/cmake/OpenSSL || true
fi
if [[ "xgcc-4.8" == "x$USE_CC" ]]; then
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main'
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial universe'
sudo apt-get update ;
sudo apt-get install --no-install-recommends --no-install-suggests -y g++-4.8 ;
bash ci/do_ci.sh gcc.legacy.test ;
elif [[ "x$CI_MODE" == "xno-rtti" ]]; then
bash ci/do_ci.sh gcc.no-rtti.test ;
elif [[ "x$CI_MODE" == "xno-exceptions" ]]; then
bash ci/do_ci.sh gcc.no-exceptions.test ;
elif [[ "x$CI_MODE" == "xmbedtls" ]]; then
bash ci/do_ci.sh ssl.mbedtls ;
elif [[ "x$CI_MODE" == "xlibressl" ]]; then
bash ci/do_ci.sh ssl.libressl ;
elif [[ "x$CI_MODE" == "xboringssl" ]]; then
bash ci/do_ci.sh ssl.boringssl ;
elif [[ "x$CI_MODE" == "xopenssl-1.1.1" ]]; then
bash ci/do_ci.sh ssl.openssl-1.1.1 ;
else
bash ci/do_ci.sh ssl.openssl ;
fi
vs2019_2022_build: # job id, can be any string
name: Visual Studio 2019/2022 Build
strategy:
matrix:
include:
- os: windows-latest
generator: "Visual Studio 17 2022"
build_shared_libs: "ON"
platform: x64
- os: windows-latest
generator: "Visual Studio 17 2022"
build_shared_libs: "ON"
platform: x64
ci_mode: no-rtti
- os: windows-latest
generator: "Visual Studio 17 2022"
build_shared_libs: "ON"
platform: x64
ci_mode: no-exceptions
- os: windows-latest
generator: "Visual Studio 17 2022"
build_shared_libs: "OFF"
platform: x64
- os: windows-2019
generator: "Visual Studio 16 2019"
build_shared_libs: "ON"
platform: x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate cache key
shell: bash
run: git submodule > '.github/.cache-key'
- name: Cache packages
uses: actions/cache@v3
with:
path: |
third_party/install
key: ${{ runner.os }}-${{ matrix.ci_mode }}-shared-${{ matrix.build_shared_libs }}-${ hashFiles('.github/.cache-key') }
- name: Build & Test
shell: pwsh
env:
CMAKE_GENERATOR: ${{ matrix.generator }}
CMAKE_PLATFORM: ${{ matrix.platform }}
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }}
CONFIGURATION: RelWithDebInfo
CI_MODE: ${{ matrix.ci_mode }}
run: |
if ($ENV:CI_MODE -eq "no-rtti") {
pwsh ci/do_ci.ps1 msvc.no-rtti.test ;
} elseif($ENV:CI_MODE -eq "no-exceptions") {
pwsh ci/do_ci.ps1 msvc.no-exceptions.test ;
} else {
pwsh ci/do_ci.ps1 "msvc.2019+.test" ;
}
coverage: # job id, can be any string
name: Coverage
# This job runs on Linux
strategy:
matrix:
include:
- os: ubuntu-latest
triplet: x64-linux
cc: gcc
gcov_flags: "--coverage -fprofile-arcs -ftest-coverage"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate cache key
shell: bash
run: git submodule > '.github/.cache-key'
- name: Cache packages
uses: actions/cache@v3
with:
path: |
/usr/local/share/vcpkg/installed
third_party/install
key: ${{ runner.os }}-coverage-${ hashFiles('.github/.cache-key') }) }}
- name: Generate coverage
shell: bash
env:
USE_CC: ${{ matrix.cc }}
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
USE_SSL: ${{ matrix.ssl }}
GCOV_FLAGS: "${{ matrix.gcov_flags }}"
run: |
SETUP_INSTALL_LCOV=0
which lcov || SETUP_INSTALL_LCOV=1
set -e
if [[ $SETUP_INSTALL_LCOV -ne 0 ]]; then
sudo apt update -y
sudo apt install --no-install-recommends --no-install-suggests -y lcov
fi
bash ci/do_ci.sh coverage ;
- name: Uploaded code coverage
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}} # not required for public repos
fail_ci_if_error: true
file: ${{ github.workspace }}/build_jobs_coverage/coverage.info
codeql:
name: CodeQL
# This job runs on Linux
strategy:
fail-fast: false
matrix:
include:
- cc: gcc
triplet: x64-linux
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate cache key
shell: bash
run: git submodule > '.github/.cache-key'
- name: Cache packages
uses: actions/cache@v3
with:
path: |
third_party/install
key: ${{ runner.os }}-codeql-${ hashFiles('.github/.cache-key') }) }}
- name: Build
shell: bash
env:
USE_CC: ${{ matrix.cc }}
USE_SSL: ${{ matrix.ssl }}
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
run: |
bash ci/do_ci.sh codeql.configure
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
- name: Build
shell: bash
env:
USE_CC: ${{ matrix.cc }}
USE_SSL: ${{ matrix.ssl }}
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
run: |
bash ci/do_ci.sh codeql.build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"