Skip to content

Update build.yml

Update build.yml #36

Workflow file for this run

name: Build and Release
on:
push:
branches:
- actions
jobs:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y cmake libsfml-dev libudev-dev libopenal-dev libvorbis-dev libflac-dev libxrandr-dev libxcursor-dev
- name: Configure and build
run: |
mkdir build && cd build
cmake ..
cmake --build .
- name: Upload executable
uses: actions/upload-artifact@v2
with:
name: ubuntu-executable
path: build/src/8ChocChip
build-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install build dependencies
run: |
sudo apt update
sudo apt install build-essential cmake pkg-config libssl-dev zlib1g-dev libx11-dev libxft-dev mingw-w64-x86-64-gcc mingw-w64-x86-64-g++
- name: Download SFML (Optional)
run: |
# Download pre-built Windows SFML if needed (replace URL with desired version)
wget https://www.sfml-dev.org/files/SFML-2.6.1-windows-vc15-64-bit.zip
unzip sfml.zip
- name: Configure CMake (cross-compile)
run: |
mkdir build
cd build
cmake .. -G "MinGW Makefile" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake -DCMAKE_BUILD_TYPE=Release
- name: Generate toolchain file (optional)
run: |
# Create a toolchain.cmake file if not downloaded with SFML
echo "SET(CMAKE_SYSTEM_NAME Windows)" >> toolchain.cmake
echo "SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)" >> toolchain.cmake
echo "SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)" >> toolchain.cmake
# Add other compiler/linker settings as needed
- name: Build
run: |
make
- name: Upload artifact (optional)
uses: actions/upload-artifact@v2
with:
name: 8ChocCHip.exe
path: build/8ChocCHip.exe
# build-macos:
# runs-on: macos-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install dependencies
# run: brew update && brew install cmake sfml
# - name: Configure and build
# run: |
# mkdir build && cd build
# cmake ..
# cmake --build .
# - name: Upload executable
# uses: actions/upload-artifact@v2
# with:
# name: macos-executable
# path: build/src/8ChocChip