build.yaml 2: electric boogaloo
This commit is contained in:
@@ -1,38 +1,83 @@
|
|||||||
name: Build Project
|
name: Build Project
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
# We explicitly use a container that has build tools, or we install them.
|
fail-fast: false
|
||||||
# If your Gitea runner uses a minimal image, we make sure to update and install gcc/make.
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
```
|
||||||
# 1. Check out the repository code
|
runs-on: ${{ matrix.os }}
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# 2. Install compiler, X11, and Raylib dependencies
|
steps:
|
||||||
- name: Install Dependencies
|
- name: Checkout code
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
# 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
|
|
||||||
|
|
||||||
# 3. Compile the project using your Makefile
|
# Linux dependencies
|
||||||
- name: Compile with Makefile
|
- name: Install Dependencies (Linux)
|
||||||
run: make
|
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
|
$SUDO apt-get update
|
||||||
- name: Upload Build Artifact
|
$SUDO apt-get install -y \
|
||||||
uses: actions/upload-artifact@v4
|
build-essential \
|
||||||
with:
|
gcc \
|
||||||
name: wrldbox-binary
|
g++ \
|
||||||
path: wrldbox
|
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
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user