Skip to content

Commit

Permalink
🔀 Fix and add new Github Workflows
Browse files Browse the repository at this point in the history
All of the various Github Workflows were previously broken due to
Github's deprecation/removal of the `set-env` syntax (for security
reasons). This promptly broke effectively all existing CI scripts,
leaving this repository without any integrations.

This not only fixes those existing ones, it also adds new integrations
for more static code analysis, and also new workflows for coverage
detection.
  • Loading branch information
bitwizeshift committed Jan 31, 2021
2 parents 1b71ac9 + c8691eb commit 4f33a7f
Show file tree
Hide file tree
Showing 14 changed files with 758 additions and 451 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Code Scanning"

on:
push:
branches: [master]
paths:
- 'include/**.hpp'
- 'test/**.cpp'
- '**.cmake'
- 'conanfile.py'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- '.github/workflows/analysis.yml'
pull_request:
branches: [master]
paths:
- 'include/**.hpp'
- 'test/**.cpp'
- '**.cmake'
- 'conanfile.py'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- '.github/workflows/analysis.yml'

jobs:
analysis:
name: CodeQL Analysis
runs-on: ubuntu-20.04

env:
build-directory: build

strategy:
matrix:
language: ['cpp']

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Prepare Environment
run: |
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
- name: Initialize CodeQL
uses: github/codeql-action/init@v1

- name: Configure
working-directory: ${{env.build-directory}}
run: cmake .. -DCMAKE_BUILD_TYPE=Debug -DBACKPORT_COMPILE_UNIT_TESTS=On

- name: Build
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
136 changes: 136 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: macOS

on:
push:
paths:
- 'include/**.hpp'
- 'test/**.cpp'
- '**.cmake'
- 'conanfile.py'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- '.github/workflows/build-macos.yml'
pull_request:
paths:
- 'include/**.hpp'
- 'test/**.cpp'
- '**.cmake'
- 'conanfile.py'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- '.github/workflows/build-macos.yml'

jobs:
test:
name: macOS Xcode ${{matrix.compiler.version}}
runs-on: macos-latest

env:
build-directory: build

strategy:
fail-fast: false
matrix:
compiler:
# Xcode Versions
- { name: "xcode", version: "10.3" }
- { name: "xcode", version: "11.2" }
- { name: "xcode", version: "11.3" }
- { name: "xcode", version: "12.3" }

steps:
- name: Clone
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Prepare Environment
run: |
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{ matrix.compiler.version }}.app
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
# Debug Configuration

- name: Configure (Debug)
working-directory: ${{env.build-directory}}
env:
CC: clang
CXX: clang++
run: cmake .. -DCMAKE_BUILD_TYPE=Debug -DBACKPORT_COMPILE_UNIT_TESTS=On

- name: Build (Debug)
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test (Debug)
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure

# Release Configuration

- name: Configure (Release)
working-directory: ${{env.build-directory}}
run: cmake .. -DCMAKE_BUILD_TYPE=Release

- name: Build (Release)
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test (Release)
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure

sanitize:
name: macOS Xcode ${{matrix.compiler.version}} '${{matrix.sanitizer}}' sanitizer
runs-on: macos-latest
needs: test

env:
build-directory: build

strategy:
matrix:
sanitizer: [address, undefined]

steps:
- name: Clone
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Prepare Environment
run: |
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
- name: Configure
working-directory: ${{env.build-directory}}
env:
CC: clang
CXX: clang++
run: |
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DBACKPORT_COMPILE_UNIT_TESTS=On \
-DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}}"
- name: Build
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test (Sanitize)
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure
192 changes: 192 additions & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: Ubuntu

on:
push:
paths:
- 'include/**.hpp'
- 'test/**.cpp'
- '**.cmake'
- 'conanfile.py'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- '.github/workflows/build-ubuntu.yml'
pull_request:
paths:
- 'include/**.hpp'
- 'test/**.cpp'
- '**.cmake'
- 'conanfile.py'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- '.github/workflows/build-ubuntu.yml'

jobs:
test:
name: Ubuntu ${{matrix.compiler.cc}} (${{matrix.arch}})
runs-on: ubuntu-20.04

env:
build-directory: build

strategy:
fail-fast: false
matrix:
compiler:
# GCC Versions
- { cc: gcc-5, cxx: g++-5 }
- { cc: gcc-6, cxx: g++-6 }
- { cc: gcc-7, cxx: g++-7 }
- { cc: gcc-8, cxx: g++-8 }
- { cc: gcc-9, cxx: g++-9 }
- { cc: gcc-10, cxx: g++-10 }

# Clang Versions
- { cc: clang-3.5, cxx: clang++-3.5 }
- { cc: clang-3.6, cxx: clang++-3.6 }
- { cc: clang-3.7, cxx: clang++-3.7 }
- { cc: clang-3.8, cxx: clang++-3.8 }
- { cc: clang-3.9, cxx: clang++-3.9 }
- { cc: clang-4.0, cxx: clang++-4.0 }
- { cc: clang-5.0, cxx: clang++-5.0 }
- { cc: clang-6.0, cxx: clang++-6.0 }
- { cc: clang-7, cxx: clang++-7 }
- { cc: clang-8, cxx: clang++-8 }
- { cc: clang-9, cxx: clang++-9 }
- { cc: clang-10, cxx: clang++-10 }
arch: [x86, x86_64]

# clang 3.5 through 3.8 fail to compiler for 32-bit
# Disable these builds for time being
exclude:
- arch: x86
compiler: { cc: clang-3.5, cxx: clang++-3.5 }
- arch: x86
compiler: { cc: clang-3.6, cxx: clang++-3.6 }
- arch: x86
compiler: { cc: clang-3.7, cxx: clang++-3.7 }
- arch: x86
compiler: { cc: clang-3.8, cxx: clang++-3.8 }

steps:
- name: Clone
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Prepare Environment
run: |
if [[ "${{matrix.arch}}" == "x86" ]]; then
sudo dpkg --add-architecture i386
fi
sudo apt-get update
# Older versions of clang and gcc are not available on Ubuntu 20.04; so
# we need to add the repos manually first.
sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe"
sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main universe"
sudo apt-get update
if [[ "${{matrix.compiler.cc}}" =~ "gcc" ]]; then
sudo apt-get install -y ${{matrix.compiler.cxx}} ${{matrix.compiler.cxx}}-multilib
else
sudo apt-get install -y ${{matrix.compiler.cc}} g++-multilib
# g++5 needed for clang 32-bit builds
if [[ "${{matrix.arch}}" == "x86" ]]; then
sudo apt-get install -y g++-5
fi
fi
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
- name: Prepare Architecture
run: |
if [[ "${{matrix.arch}}" = "x86" ]]; then
echo "CXXFLAGS=${CXXFLAGS} -m32" >> ${GITHUB_ENV}
fi
# Debug Configuration

- name: Configure (Debug)
working-directory: ${{env.build-directory}}
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: cmake .. -DCMAKE_BUILD_TYPE=Debug -DBACKPORT_COMPILE_UNIT_TESTS=On

- name: Build
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure

# Release Configuration

- name: Configure (Release)
working-directory: ${{env.build-directory}}
run: cmake .. -DCMAKE_BUILD_TYPE=Release

- name: Build (Release)
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test (Release)
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure

sanitize:
name: Ubuntu ${{matrix.compiler.cc}} '${{matrix.sanitizer}}' sanitizer
runs-on: ubuntu-20.04
needs: test

env:
build-directory: build

strategy:
matrix:
compiler:
- { cc: gcc, cxx: g++ }
- { cc: clang, cxx: clang++ }
sanitizer: [address, undefined]

steps:
- name: Clone
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Prepare Environment
run: |
python -m pip install --upgrade pip
pip install conan
cmake -E make_directory ${{env.build-directory}}
cmake -E chdir ${{env.build-directory}} conan install ..
- name: Configure
working-directory: ${{env.build-directory}}
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DBACKPORT_COMPILE_UNIT_TESTS=On \
-DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}}"
- name: Build
working-directory: ${{env.build-directory}}
run: cmake --build .

- name: Test (Sanitize)
working-directory: ${{env.build-directory}}
run: ctest --output-on-failure
Loading

0 comments on commit 4f33a7f

Please sign in to comment.