Major Refactor of Fodder.cpp #23
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: linux-build | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: >- | |
| sudo apt-get update --allow-releaseinfo-change && | |
| sudo apt-get install -y | |
| cmake ninja-build build-essential git pkg-config | |
| libasound2-dev libpulse-dev libudev-dev libx11-dev libxext-dev | |
| libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxtst-dev | |
| libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev | |
| libegl1-mesa-dev libgl1-mesa-dev | |
| libflac-dev libogg-dev libvorbis-dev libmpg123-dev libopusfile-dev | |
| libxmp-dev | |
| libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev | |
| - name: Build SDL3 | |
| run: | | |
| mkdir -p /tmp/sdl3 | |
| cd /tmp/sdl3 | |
| git clone --depth 1 --branch release-3.4.0 https://github.com/libsdl-org/SDL.git | |
| cmake -S SDL -B SDL/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local | |
| cmake --build SDL/build | |
| sudo cmake --install SDL/build | |
| - name: Build SDL3_mixer | |
| run: | | |
| mkdir -p /tmp/sdl3 | |
| cd /tmp/sdl3 | |
| git clone --depth 1 https://github.com/libsdl-org/SDL_mixer.git | |
| cmake -S SDL_mixer -B SDL_mixer/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DSDLMIXER_VENDORED=OFF -DSDLMIXER_MOD_XMP=ON -DSDLMIXER_MOD_XMP_LITE=OFF -DSDLMIXER_MOD_XMP_SHARED=OFF | |
| cmake --build SDL_mixer/build | |
| sudo cmake --install SDL_mixer/build | |
| - name: Configure | |
| run: cmake -S . -B build -G Ninja | |
| - name: Build | |
| run: cmake --build build | |
| - name: Package | |
| run: python -m zipfile -c OpenFodder-linux-latest.zip build/openfodder README.md COPYING openfodder.ini.example | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| id: upload_artifact | |
| with: | |
| name: OpenFodder-linux-latest | |
| path: OpenFodder-linux-latest.zip | |
| - name: Discord notification | |
| if: always() && env.DISCORD_WEBHOOK_URL != '' | |
| shell: pwsh | |
| env: | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| run: | | |
| $status = if ("${{ job.status }}" -eq "success") { "Success" } else { "Failure" } | |
| $color = if ("${{ job.status }}" -eq "success") { 3066993 } else { 15158332 } | |
| $title = "OpenFodder Ubuntu build $status" | |
| $runUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| $artifactUrl = "${{ steps.upload_artifact.outputs.artifact-url }}" | |
| if (-not $artifactUrl) { $artifactUrl = "N/A" } | |
| $commitMessage = "${{ github.event.head_commit.message }}" | |
| if (-not $commitMessage) { $commitMessage = "${{ github.event.pull_request.title }}" } | |
| if (-not $commitMessage) { $commitMessage = "N/A" } | |
| $payload = @{ | |
| username = "GitHub Actions" | |
| embeds = @( | |
| @{ | |
| title = $title | |
| url = $runUrl | |
| color = $color | |
| fields = @( | |
| @{ name = "Commit"; value = "${{ github.sha }}"; inline = $true } | |
| @{ name = "Branch"; value = "${{ github.ref_name }}"; inline = $true } | |
| @{ name = "Commit Message"; value = $commitMessage; inline = $false } | |
| @{ name = "Download"; value = $artifactUrl; inline = $false } | |
| ) | |
| } | |
| ) | |
| } | ConvertTo-Json -Depth 5 | |
| Invoke-RestMethod -Method Post -Uri $env:DISCORD_WEBHOOK_URL -ContentType "application/json" -Body $payload |