Skip to content

[pre-commit.ci] pre-commit autoupdate #83

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #83

Workflow file for this run

# Taken and modified from here:
# https://github.com/lukka/CppBuildTasks-Validation/blob/master/.github/workflows/hosted-pure-workflow.yml
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
check-for-changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
build-files-changed: ${{steps.build-files.outputs.any_modified}}
steps:
- name: Checkout entire repository
if: github.event_name == 'push'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout repository
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
- name: Check for changes of build related files
id: build-files
uses: tj-actions/changed-files@v41
with:
files_ignore: |
.clang-format
.cmake-format.py
.editorconfig
.gitattributes
.gitignore
.gitmodules
.pre-commit-config.yaml
naming-conventions.md
README.md
run-clang-format.bat
run-cmake-format.bat
run-cmake-lint.bat
VSWorkspaceSettings.json
**.natvis
- name: Build related files that changed
run: |
for file in ${{steps.build-files.outputs.all_changed_and_modified_files}}; do
echo "$file"
done
skip-build-and-tests:
needs: check-for-changes
if: needs.check-for-changes.outputs.build-files-changed != 'true'
name: ${{matrix.name}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu - GCC
- name: Ubuntu - Clang
- name: Windows - MSVC
- name: Windows - Clang
steps:
- name: Skip build and tests
run: ""
build-and-test:
needs: check-for-changes
if: needs.check-for-changes.outputs.build-files-changed == 'true'
name: ${{matrix.name}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu - GCC
os: ubuntu-latest
preset: linux-gcc-x64
- name: Ubuntu - Clang
os: ubuntu-latest
preset: linux-clang-x64
- name: Windows - MSVC
os: windows-latest
preset: windows-msvc-x64
- name: Windows - Clang
os: windows-latest
preset: windows-clang-x64
env:
CMAKE_BUILD_DIR: ${{github.workspace}}/build
VCPKG_ROOT: ${{github.workspace}}/vcpkg
VCPKG_BINARY_SOURCES: clear;files,${{github.workspace}}/.vcpkg-archives,readwrite
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Restore vcpkg and its artifacts
uses: actions/cache@v2
env:
vcpkg-cache-base: vcpkg-${{secrets.VCPKG_CACHE_ID}}-${{hashFiles('.git/modules/vcpkg/HEAD')}}-${{matrix.preset}}
with:
path: |
${{github.workspace}}/.vcpkg-archives
${{env.VCPKG_ROOT}}/downloads
key: ${{env.vcpkg-cache-base}}-${{hashFiles('vcpkg.json')}}
restore-keys: |
${{env.vcpkg-cache-base}}-
- name: (Linux) Install required tools for glfw
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev
- name: (Windows) Ensure the Developer Command Prompt is setup correctly
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install dependencies and generate project files
run: cmake --preset=${{matrix.preset}} -B "${{env.CMAKE_BUILD_DIR}}" -DDANG_WERROR:BOOL=ON
- name: Build all
run: cmake --build "${{env.CMAKE_BUILD_DIR}}"
- name: Build dmath
run: cmake --build "${{env.CMAKE_BUILD_DIR}}" --target dmath
- name: Run tests
run: |
cd "${{env.CMAKE_BUILD_DIR}}"
ctest --parallel 2 --label-exclude "^opengl$"