From f1b63e92255564a1414ca0130bbd4bca1b9947a9 Mon Sep 17 00:00:00 2001 From: dcvz Date: Thu, 16 May 2024 14:54:47 +0200 Subject: [PATCH] Add Linux CI workflow --- .github/workflows/validate.yml | 95 ++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..3965727 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,95 @@ +name: validate +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + type: [ Debug, Release ] + os: [ ubuntu-latest ] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + - uses: actions/checkout@v4 + with: + repository: 'dcvz/zre' + token: ${{ secrets.PAT }} + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-rt64-ccache + - name: Install Windows Dependencies + if: runner.os == 'Windows' + run: | + choco install ninja + Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue + - name: Install Linux Dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y ninja-build libsdl2-dev libgtk-3-dev + + # Install SDL2 + echo ::group::install SDL2 + + # Enable ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + + wget https://www.libsdl.org/release/SDL2-2.26.1.tar.gz + tar -xzf SDL2-2.26.1.tar.gz + cd SDL2-2.26.1 + ./configure + make -j 10 + sudo make install + sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ + echo ::endgroup:: + - name: Configure Developer Command Prompt + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + - name: Prepare Build + if: runner.os != 'Windows' + run: |- + cd zre + ./process.sh + - name: Build N64Recomp & RSPRecomp + if: runner.os != 'Windows' + run: | + git clone https://github.com/Mr-Wiseguy/N64Recomp.git + cd N64Recomp + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build + cmake --build cmake-build --config Debug --target N64Recomp -j 8 + cmake --build cmake-build --config Debug --target RSPRecomp -j 8 + cp cmake-build/N64Recomp . + cp cmake-build/RSPRecomp . + - name: Run N64Recomp & RSPRecomp + if: runner.os != 'Windows' + run: | + ./N64Recomp us.rev1.toml + ./RSPRecomp aspMain.us.rev1.toml + ./RSPRecomp njpgdspMain.us.rev1.toml + - name: Build ZeldaRecomp (Unix) + if: runner.os != 'Windows' + run: |- + # enable ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build + cmake --build cmake-build --config Debug --target rt64 -j 8 + - name: Build ZeldaRecomp (Windows) + if: runner.os == 'Windows' + run: |- + # enable ccache + set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH" + + cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build + cmake --build cmake-build --config Debug --target rt64 -j 8