Merge pull request #48 from Slime-Dev/ConvertJsonToImage #75
This file contains 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: Testing for multiple platforms | |
on: | |
push: | |
branches-ignore: | |
[ "build" ] | |
pull_request: | |
branches: | |
[ "main" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-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: ubuntu-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: cl | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Restore CPM cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cpm | |
${{ github.workspace }}/.cpm | |
key: ${{ runner.os }}-cpm-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
restore-keys: | | |
${{ runner.os }}-cpm- | |
- name: UBUNTU - Install dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libglfw3-dev xorg-dev libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols | |
- name: UBUNTU - Install Vulkan SDK | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc | |
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list | |
sudo apt update | |
sudo apt install vulkan-sdk | |
- name: WINDOWS - Install Vulkan SDK | |
if: matrix.os == 'windows-latest' | |
run: | | |
$vulkanSDK = "https://sdk.lunarg.com/sdk/download/1.3.283.0/windows/VulkanSDK-1.3.283.0-Installer.exe" | |
Invoke-WebRequest -Uri $vulkanSDK -OutFile VulkanSDK-Installer.exe | |
.\VulkanSDK-Installer.exe --accept-licenses --default-answer --confirm-command install | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
shell: bash | |
run: | | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
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 }}" \ | |
-DCPM_SOURCE_CACHE="${{ github.workspace }}/.cpm" \ | |
-DENABLE_TESTING=ON | |
else | |
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 }} \ | |
-DCPM_SOURCE_CACHE=~/.cpm \ | |
-DENABLE_TESTING=ON | |
fi | |
- name: Build | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure -VV --verbose --output-junit ${{ github.workspace }}/scripts/junitout.xml | |
continue-on-error: true | |
- name: Convert XML to CTRF | |
if: success() | |
shell: bash | |
run: | | |
pip install defusedxml | |
pip install pillow | |
python "${{ github.workspace }}/scripts/OutPutResultsToJsons.py" "${{ github.workspace }}/scripts/junitout.xml" "Real Test" --json_output "${{ github.workspace }}/scripts/finalresult.json" --discord_json_output "${{ github.workspace }}/scripts/discordJson_output.json" --image_out "${{ github.workspace }}/scripts/discrod_image.png" --os "${{ runner.os }}" --compiler "${{ matrix.c_compiler }}" --event "${{ github.event_name }}" --author "${{ github.actor }}" --branch "${{ github.ref_name }}" | |
- name: Post results | |
if: success() | |
run: | | |
npm install [email protected] | |
npx github-actions-ctrf ${{ github.workspace }}/scripts/finalresult.json | |
- name: Post results to Discord | |
if: success() | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
filename: "${{ github.workspace }}/scripts/discrod_image.png" |