From f9b3c21ffd6f32bc85401239c7d24376ea27902f Mon Sep 17 00:00:00 2001 From: dcvz Date: Fri, 24 May 2024 22:46:35 +0200 Subject: [PATCH] Add workflow --- .github/workflows/validate.yml | 103 +++++++++++++++++++++++++++++++++ 1 file changed, 103 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..a928b9a --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,103 @@ +name: validate +on: + push: + pull_request: + types: [opened, synchronize] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + build-unix: + runs-on: ubuntu-22.04 + strategy: + matrix: + type: [ Debug, Release ] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + submodules: recursive + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-z64re-ccache-${{ matrix.type }} + - 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 lld llvm clang-15 + + # 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 CMake + if: runner.os != 'Windows' + run: | + # enable ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + + # Build N64Recomp & RSPRecomp + cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build + - name: Build ultramodern + run: | + # enable ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + + cmake --build cmake-build --config ${{ matrix.type }} --target ultramodern -j $(nproc) + - name: Build librecomp + run: | + # enable ccache + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + + cmake --build cmake-build --config ${{ matrix.type }} --target librecomp -j $(nproc) + build-windows: + runs-on: windows-latest + strategy: + matrix: + type: [ Debug, Release ] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + submodules: recursive + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-z64re-ccache-${{ matrix.type }} + - name: Install Windows Dependencies + run: | + choco install ninja + Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue + - name: Configure Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + - name: Build N64Recomp & RSPRecomp + 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_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build -DCMAKE_CXX_FLAGS="-Xclang -fcxx-exceptions" + - name: Build ultramodern + run: | + # enable ccache + set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH" + + cmake --build cmake-build --config ${{ matrix.type }} --target ultramodern -j 8 + - name: Build librecomp + run: | + # enable ccache + set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH" + + cmake --build cmake-build --config ${{ matrix.type }} --target librecomp -j 8