Skip to content

Commit

Permalink
Build CI with gcc and clang
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteHamster committed Dec 3, 2024
1 parent ff788df commit a763036
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 26 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build

on:
push:
pull_request:

jobs:
build:
strategy:
matrix:
compiler:
- { name: gcc, version: 11}
- { name: gcc, version: 12}
- { name: gcc, version: 13}
- { name: gcc, version: 14}
- { name: clang, version: 16}
- { name: clang, version: 17}
- { name: clang, version: 18}
name: Build (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: |
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends ca-certificates cmake git
- name: Install GCC
if: ${{ matrix.compiler.name == 'gcc' }}
run: |
sudo apt-get install --assume-yes --no-install-recommends gcc-${{ matrix.compiler.version }} g++-${{ matrix.compiler.version }}
echo "CC=/usr/bin/gcc-${{ matrix.compiler.version }}" >> $GITHUB_ENV
echo "CXX=/usr/bin/g++-${{ matrix.compiler.version }}" >> $GITHUB_ENV
- name: Install Clang
if: ${{ matrix.compiler.name == 'clang' }}
run: |
sudo apt-get install --assume-yes --no-install-recommends clang-${{ matrix.compiler.version }}
echo "CC=/usr/bin/clang-${{ matrix.compiler.version }}" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++-${{ matrix.compiler.version }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
cmake -B ./build
cmake --build ./build --parallel
31 changes: 5 additions & 26 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,19 @@ jobs:
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

# Compile
- name: Checkout submodules
run: git submodule update --init --recursive

- name: Creating build directory
run: cmake -E make_directory ./build

- name: Run CMake
working-directory: ./build
run: cmake .. -DCMAKE_BUILD_TYPE=Release

- name: Compilation
working-directory: ./build
run: cmake --build . --config Release
languages: 'cpp'

# Perform Analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
category: "/language:cpp"

0 comments on commit a763036

Please sign in to comment.