Ubuntu CMake Make Clang Build #76
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: Ubuntu CMake Make Clang Build | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| schedule: | |
| # Run the build every day at 4:00 AM UTC | |
| - cron: '0 4 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest # Use a free Ubuntu runner | |
| steps: | |
| - uses: actions/checkout@v4 # Step 1: Checkout your repository code | |
| - name: Install required Ubuntu packages | |
| run: | | |
| sudo add-apt-repository universe | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake-gui gettext libboost-all-dev libjpeg-dev libbz2-dev qtbase5-dev qtmultimedia5-dev libogre-1.12-dev extra-cmake-modules libkf5kio-dev doxygen | |
| - name: Use the installed package (example) | |
| run: | | |
| echo "gettext version is:" | |
| gettext --version | |
| - name: Configure CMake | |
| run: cmake -B ${{github.workspace}}/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DBLP=ON -DMPQ=ON -DMDLX=ON -DMAP=ON -DJASS=ON -DAPP=ON -DEDITOR=ON -DUSE_KIOSLAVE=ON -DUSE_QBLP=ON -DUSE_OGREBLP=ON -DGAME=ON -DUSE_MIME=ON -DDOC=ON | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| - name: Build with CMake | |
| id: build_step | |
| run: cmake --build ${{github.workspace}}/build --config Debug | |
| - name: Run CTest | |
| working-directory: ${{github.workspace}}/build | |
| run: ctest --verbose --output-on-failure | |
| - name: Run CTest and generate JUnit XML | |
| id: ctest_run | |
| run: ctest --output-on-failure --output-junit TestResults.xml | |
| continue-on-error: true # Ermöglicht das Fortfahren des Workflows bei Testfehlern | |
| - name: Publish Test Report (als Job Summary) | |
| uses: test-summary/action@v2 | |
| with: | |
| paths: "TestResults.xml" | |
| if: always() # Stellt sicher, dass der Bericht auch bei Fehlern veröffentlicht wird | |
| - name: Convert JUnit XML to HTML and upload artifact | |
| uses: pl-strflt/junit-xml-to-html@v1 | |
| with: | |
| mode: 'no-frames' | |
| input: 'TestResults.xml' | |
| output: 'TestReport.html' | |
| if: always() | |
| - name: Upload HTML Report as Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: HTML-Test-Report | |
| path: TestReport.html | |
| if: always() # Läuft immer, um den Bericht bereitzustellen, auch wenn Tests fehlschlagen | |
| - name: Run CPack to generate installer | |
| id: pack_step | |
| if: ${{ steps.build_step.outcome == 'success' }} | |
| # Run the "package" target via cmake --build | |
| run: cmake --build ${{github.workspace}}/build --target ${{github.workspace}}/package --config Debug | |
| - name: Upload installer artifact | |
| if: ${{ steps.pack_step.outcome == 'success' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wc3lib | |
| # CPack generates files in the build directory with extensions like .deb or .tar.gz | |
| path: ${{github.workspace}}/build/*.deb | |
| # If you prefer tarballs, use path: build/*.tar.gz |