psOff_public/.github/workflows/build.yml
2024-04-14 18:28:41 +03:00

119 lines
3.1 KiB
YAML

name: build
on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- '.github/workflows/build.yml'
- '**/CMakeLists.txt'
- 'CMakeLists.txt'
- '**.cmake'
- '**.cpp'
- '**.cxx'
- '**.cc'
- '**.c'
- '**.hpp'
- '**.hh'
- '**.h'
push:
paths:
- '.github/workflows/build.yml'
- '**/CMakeLists.txt'
- 'CMakeLists.txt'
- '**.cmake'
- '**.cpp'
- '**.cxx'
- '**.cc'
- '**.c'
- '**.hpp'
- '**.hh'
- '**.h'
jobs:
formatting-check:
permissions:
contents: write
name: Formatting check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test formatting
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: ./
extensions: h,hpp,cpp,c,cc
clangFormatVersion: 17
inplace: true
- name: Generate patch file
run: |
git diff > formatting.patch
find *.patch -type f -size 0 -delete
- name: Upload patch
uses: actions/upload-artifact@v4
with:
name: code-format
path: formatting.patch
- name: Error if fixed
run: |
rm formatting.patch
if ! git diff --quiet --exit-code; then
echo "# Looks like you messed something up!" >> $GITHUB_STEP_SUMMARY
echo "1. Download the \`code-format\` artifact above" >> $GITHUB_STEP_SUMMARY
echo "2. Unpack the patch file" >> $GITHUB_STEP_SUMMARY
echo "3. Use \`git apply formatting.patch\` command to apply it to your repo" >> $GITHUB_STEP_SUMMARY
exit 1
fi
build:
needs: formatting-check
name: Emulator
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64
- name: Prepare Vulkan SDK
uses: humbletim/install-vulkan-sdk@c2aa128094d42ba02959a660f03e0a4e012192f9
with:
version: 1.3.275.0
cache: true
- name: Configure
run: |
echo "::add-matcher::tools/matchers/cmake.json"
cmake.exe -S. -B_build/_Release -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=_build/_Install -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DTEST_BENCH=ON
- name: Build
run: |
echo "::add-matcher::tools/matchers/cmake.json"
echo "::add-matcher::tools/matchers/compilers.json"
cmake --build _build/_Release -j4
- name: Install
run: |
echo "::add-matcher::tools/matchers/cmake.json"
cmake.exe --install _build/_Release
- name: Run some tests
shell: bash
run: echo "`node testRunner`" >> $GITHUB_STEP_SUMMARY
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: psOff-libs
path: _build/_Install/*