diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 7bfe0dc..5cf574c 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,38 +1,83 @@ name: Build Project on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] +push: +branches: [ "main" ] +pull_request: +branches: [ "main" ] jobs: - build: - runs-on: ubuntu-latest - # We explicitly use a container that has build tools, or we install them. - # If your Gitea runner uses a minimal image, we make sure to update and install gcc/make. +build: +strategy: +fail-fast: false +matrix: +os: [ubuntu-latest, windows-latest] - steps: - # 1. Check out the repository code - - name: Checkout code - uses: actions/checkout@v4 +``` +runs-on: ${{ matrix.os }} - # 2. Install compiler, X11, and Raylib dependencies - - name: Install Dependencies - run: | - # Gitea runners sometimes run as root inside the container, so 'sudo' might not be needed or installed. - # This check safely uses sudo only if it is available. - if command -v sudo >/dev/null 2>&1; then SUDO="sudo"; else SUDO=""; fi - $SUDO apt-get update - $SUDO apt-get install -y build-essential gcc make libraylib-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev +steps: + - name: Checkout code + uses: actions/checkout@v4 - # 3. Compile the project using your Makefile - - name: Compile with Makefile - run: make + # Linux dependencies + - name: Install Dependencies (Linux) + if: runner.os == 'Linux' + run: | + if command -v sudo >/dev/null 2>&1; then SUDO="sudo"; else SUDO=""; fi - # 4. Upload the compiled binary as a build artifact in Gitea - - name: Upload Build Artifact - uses: actions/upload-artifact@v4 - with: - name: wrldbox-binary - path: wrldbox \ No newline at end of file + $SUDO apt-get update + $SUDO apt-get install -y \ + build-essential \ + gcc \ + g++ \ + make \ + raylib-dev \ + libx11-dev \ + libxrandr-dev \ + libxinerama-dev \ + libxcursor-dev \ + libxi-dev \ + libgl1-mesa-dev + + # Windows dependencies + - name: Install MSYS2 and Raylib + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-gcc + mingw-w64-x86_64-make + mingw-w64-x86_64-raylib + + # Build on Linux + - name: Build (Linux) + if: runner.os == 'Linux' + run: make + + # Build on Windows + - name: Build (Windows) + if: runner.os == 'Windows' + shell: msys2 {0} + run: make + + # Upload Linux artifact + - name: Upload Linux Artifact + if: runner.os == 'Linux' + uses: actions/upload-artifact@v4 + with: + name: wrldbox-linux + path: wrldbox + + # Upload Windows artifact + - name: Upload Windows Artifact + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: wrldbox-windows + path: | + wrldbox.exe + *.exe +```