fixed all: beautifier for scenes and systems #9
This file contains hidden or 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: Compilation | |
| on: | |
| push: | |
| branches: ["dev", "devops"] | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: ["main", "dev"] | |
| jobs: | |
| build_rtype: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| build_type: [Release] | |
| c_compiler: [gcc, clang, cl] | |
| include: | |
| - os: windows-latest | |
| c_compiler: cl | |
| cpp_compiler: cl | |
| - os: ubuntu-latest | |
| c_compiler: gcc | |
| cpp_compiler: g++ | |
| - os: macos-latest | |
| c_compiler: clang | |
| cpp_compiler: clang++ | |
| exclude: | |
| - os: windows-latest | |
| c_compiler: gcc | |
| - os: windows-latest | |
| c_compiler: clang | |
| - os: ubuntu-latest | |
| c_compiler: clang | |
| - os: ubuntu-latest | |
| c_compiler: cl | |
| - os: macos-latest | |
| c_compiler: gcc | |
| - os: macos-latest | |
| c_compiler: cl | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install cmake & clang & build essential on Ubuntu | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt update && sudo apt install -y cmake clang build-essential | |
| - name: Install ubuntu packages necessary for glfw3 | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt install libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config -y | |
| - name: Set reusable strings | |
| id: strings | |
| shell: bash | |
| run: | | |
| echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
| - name: Cache build directory | |
| id: cache-build | |
| uses: actions/cache@v4 | |
| with: | |
| path: build | |
| key: ${{ runner.os }}-build-${{ hashFiles('CMakeLists.txt', 'overlay-ports/gengine/portfile.cmake') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build- | |
| - name: Configure CMake | |
| if: steps.cache-build.outputs.cache-hit != 'true' | |
| run: > | |
| cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
| -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -S ${{ github.workspace }} | |
| # Since metadata is not cached, we need to reconfigure cmake but without triggering a vcpkg pull | |
| - name: Configure CMake CACHED | |
| if: steps.cache-build.outputs.cache-hit == 'true' | |
| run: > | |
| cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
| -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -DVCPKG_SHOULD_NOT_UPDATE=TRUE | |
| -S ${{ github.workspace }} | |
| - name: Build | |
| run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 8 | |
| - name: Test | |
| working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
| run: ctest --build-config ${{ matrix.build_type }} | |
| - name: Build with CPack | |
| if: (github.ref == 'refs/heads/devops') || startsWith(github.ref, 'refs/tags/') | |
| run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package | |
| - name: Upload CPack artifacts | |
| if: (github.ref == 'refs/heads/devops') || startsWith(github.ref, 'refs/tags/') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.os }}-artifacts | |
| path: | | |
| ${{ steps.strings.outputs.build-output-dir }}/*.tar.gz | |
| ${{ steps.strings.outputs.build-output-dir }}/*.exe | |
| ${{ steps.strings.outputs.build-output-dir }}/*.dmg | |
| # the cache is mainly for cmake, and the timestamps don't match anyway. maybe next time we'll use another cache handler | |
| - name: Clean the cmake build directory Windows | |
| if: matrix.os == 'windows-latest' && steps.cache-build.outputs.cache-hit != 'true' | |
| run: | | |
| cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target clean | |
| Get-ChildItem -Path build/vcpkg/* -Exclude 'downloads', 'installed', 'scripts', 'triplets' | Remove-Item -Recurse -Force | |
| Remove-Item -Recurse -Force build/*.exe | |
| Remove-Item -Recurse -Force build/_CPack_Packages | |
| Remove-Item -Recurse -Force build/Release/*.dll | |
| - name: Clean the cmake build directory UNIX like | |
| if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' && steps.cache-build.outputs.cache-hit != 'true' | |
| run: | | |
| cmake --build ${{ steps.strings.outputs.build-output-dir }} --target clean | |
| find build/.vcpkg -mindepth 1 -maxdepth 1 ! -name 'downloads' ! -name 'installed' ! -name 'scripts' ! -name 'triplets' -exec rm -rf {} + | |
| rm -rf build/*.tar.gz build/*.dmg build/_CPack_Packages | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for build artifacts | |
| run: | | |
| artifacts=$(find ${{ github.workspace }} -type f -name "*.so" -o -name "*.o" -o -name "*.d" -o -name "*.a") | |
| if [ -n "$artifacts" ]; then | |
| echo "Found unwanted artifacts:" | |
| echo "$artifacts" | |
| exit 1 | |
| else | |
| echo "No unwanted artifacts found." | |
| fi | |
| beautify: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: fedora:40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install clang-format | |
| run: sudo dnf install clang-tools-extra -y | |
| - name: Check clang-format compliance | |
| run: | | |
| clang-format --version | |
| files=$(find . -name "*.hpp" -o -name "*.cpp" -o -name "*.inl") | |
| clang-format -Werror -dry-run $files | |
| publish: | |
| if: (github.ref == 'refs/heads/devops') || startsWith(github.ref, 'refs/tags/') | |
| needs: [build_rtype, beautify] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create artifacts directory | |
| run: mkdir -p artifacts | |
| - name: Download all release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| merge-multiple: true | |
| - name: Upload binaries to release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: artifacts/* | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| file_glob: true |