Update cmake toolset, optimize lifetime of TLS variable. #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- v2 | |
pull_request: | |
branches: [v2] | |
jobs: | |
format: | |
name: Format | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: CI Job | |
shell: bash | |
run: | | |
bash ci/do_ci.sh format ; | |
document: # job id, can be any string | |
name: Document | |
# This job runs on Linux | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build & Test | |
shell: bash | |
run: | | |
sudo apt-get update ; | |
sudo apt-get install --no-install-recommends --no-install-suggests -y doxygen graphviz ; | |
bash ci/do_ci.sh document ; | |
- name: Deploy | |
if: ${{ github.event_name == 'push' }} | |
env: | |
COMMIT_REF: ${{ github.ref }} | |
DOCUMENT_DEPLOY_KEY: ${{ secrets.DOCUMENT_DEPLOY_KEY }} | |
shell: bash | |
run: | | |
cd docs/output ; | |
git config --global init.defaultBranch main ; | |
git init ; | |
git add . ; | |
mkdir -p $HOME/.ssh ; | |
chmod 700 $HOME/.ssh ; | |
echo "$DOCUMENT_DEPLOY_KEY" > $HOME/.ssh/deploy.key ; | |
chmod 600 $HOME/.ssh/deploy.key ; | |
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=$HOME/.ssh/deploy.key" ; | |
git -c user.name='owent' -c user.email='[email protected]' commit -m "Delpoy document for $COMMIT_REF"; | |
git push -f -q [email protected]:owent/libcopp-doc.git HEAD:main ; | |
unix_build: # job id, can be any string | |
name: Unix Build | |
# This job runs on Linux | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc | |
build_shared_libs: "ON" | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc | |
build_shared_libs: "OFF" | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc-latest | |
mode: memcheck | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc-latest | |
no_exception: 1 | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc-latest | |
no_rtti: 1 | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc-latest | |
thread_unsafe: 1 | |
- os: ubuntu-20.04 | |
triplet: x64-linux | |
cc: gcc-4.8 | |
- os: ubuntu-22.04 | |
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@v2 | |
- name: Build & Test | |
shell: bash | |
env: | |
USE_CC: ${{ matrix.cc }} | |
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }} | |
NO_EXCEPTION: ${{ matrix.no_exception }} | |
NO_RTTI: ${{ matrix.no_rtti }} | |
THREAD_UNSAFE: ${{ matrix.thread_unsafe }} | |
CI_MODE: ${{ matrix.mode }} | |
run: | | |
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 | |
if [[ "x$CI_MODE" == "x" ]]; then | |
CI_MODE=gcc.legacy.test | |
fi | |
elif [[ "x$USE_CC" =~ xclang.* ]]; then | |
if [[ "x$CI_MODE" == "x" ]]; then | |
CI_MODE=clang.test | |
fi | |
else | |
if [[ "x$CI_MODE" == "x" ]]; then | |
CI_MODE=gcc.test | |
fi | |
fi | |
bash ci/do_ci.sh $CI_MODE | |
vs2019_2022_build: # job id, can be any string | |
name: Visual Studio 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: "OFF" | |
platform: x64 | |
- os: windows-2019 | |
generator: "Visual Studio 16 2019" | |
build_shared_libs: "OFF" | |
platform: x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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.mode }} | |
run: | | |
if(!(Test-Path ENV:CI_MODE)) { | |
$ENV:CI_MODE="msvc.2019+.test" | |
} | |
pwsh -File ci/do_ci.ps1 "$ENV:CI_MODE" | |
mingw_build: # job id, can be any string | |
name: MinGW Build | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
build_shared_libs: "ON" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build & Test | |
shell: bash | |
env: | |
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }} | |
run: | | |
C:/msys64/msys2_shell.cmd -mingw64 -defterm -no-start -here -lc "ci/do_ci.sh msys2.mingw.test" | |
- name: Cache packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
C:/msys64/var/cache/pacman/pkg | |
C:/msys64/var/lib/pacman | |
key: ${{ runner.os }}-${ hashFiles('.github/workflows/main.yml') } }} | |
coverage: # job id, can be any string | |
name: Coverage | |
# This job runs on Linux | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
triplet: x64-linux | |
cc: gcc | |
gcov_flags: "--coverage -fprofile-arcs -ftest-coverage" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Generate coverage | |
shell: bash | |
env: | |
USE_CC: ${{ matrix.cc }} | |
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@v2 | |
- 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" |