Skip to content

ok mac and windows #103

ok mac and windows

ok mac and windows #103

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- "**"
pull_request:
branches: [ "main" ]
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- id: win-msvc
name: Windows MSVC
os: windows-latest
cmake-platform-args: -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -G "Visual Studio 17 2022"
- id: win-llvm
name: Windows LLVM
os: windows-latest
cmake-platform-args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja
- id: mac
name: MacOS
os: macos-latest
cmake-platform-args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja
- id: linux
name: Linux
os: ubuntu-latest
cmake-platform-args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja
name: Build ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- name: Install Latest LLVM on Windows
if: matrix.config.id == 'win-llvm'
run: |
Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.7/LLVM-20.1.7-win64.exe" -OutFile llvm.exe
7z x llvm.exe -o"C:\Program Files\Latest LLVM"
echo "C:\Program Files\Latest LLVM\bin" >> $env:GITHUB_PATH
- name: Install Linux dependencies
if: matrix.config.id == 'linux'
run: sudo apt-get install -y libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev
- name: Configure CMake
run: cmake -B ${{ github.workspace }}/build ${{ matrix.config.cmake-platform-args }} -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
cmake --build ${{ github.workspace }}/build --config Release
- name: Upload
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.config.id }}
path: ${{ github.workspace }}/bin/*
build-relwithdebinfo:
strategy:
fail-fast: false
matrix:
config:
- id: win-msvc
name: Windows MSVC
os: windows-latest
cmake-platform-args: -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -G "Visual Studio 17 2022"
- id: win-llvm
name: Windows LLVM
os: windows-latest
cmake-platform-args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja
- id: mac
name: MacOS
os: macos-latest
cmake-platform-args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja
- id: linux
name: Linux
os: ubuntu-latest
cmake-platform-args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja
name: Build ${{ matrix.config.name }} RelWithDebInfo
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- name: Install Latest LLVM on Windows
if: matrix.config.name == 'Windows LLVM'
run: |
Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.7/LLVM-20.1.7-win64.exe" -OutFile llvm.exe
7z x llvm.exe -o"C:\Program Files\Latest LLVM"
echo "C:\Program Files\Latest LLVM\bin" >> $env:GITHUB_PATH
- name: Install Linux dependencies
if: matrix.config.name == 'Linux'
run: sudo apt-get install -y libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev
- name: Configure CMake
run: cmake -B ${{ github.workspace }}/build ${{ matrix.config.cmake-platform-args }} -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build
run: cmake --build ${{ github.workspace }}/build --config RelWithDebInfo
- name: Upload
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.config.id }}-relwithdebinfo
path: ${{ github.workspace }}/bin/*
win-msi:
name: Build Windows installer
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install WiX toolset
run: |
curl.exe -LO https://github.com/wixtoolset/wix/releases/download/v6.0.1/wix-cli-x64.msi
msiexec /i wix-cli-x64.msi /quiet
- name: Download zip
uses: actions/download-artifact@v4
with:
name: build-win-msvc
path: ${{ github.ref_name }}
- name: Build installer
id: build
run: |
$packageName = "${{ github.ref_name }}"
$version = "1.0.0"
powershell -ExecutionPolicy Bypass -File .\.github\scripts\build-msi.ps1 `
-SourceDir .\$packageName `
-AppName "$packageName" `
-Manufacturer "Johnny Cena" `
-Version "$version" `
-OutputMsi "$packageName-$version.msi"
echo "installer-path=$packageName-$version.msi" >> $env:GITHUB_OUTPUT
- name: Test installer
id: test
run: |
$proc = Start-Process -FilePath msiexec.exe `
-ArgumentList '/i "${{ steps.build.outputs.installer-path }}" /norestart /quiet' `
-PassThru
$proc.WaitForExit(30000)
dir "C:\Program Files\${{ github.ref_name }}"
- name: Upload installer
uses: actions/upload-artifact@v4
with:
path: ${{ steps.build.outputs.installer-path }}
name: Windows installer
linux-deb:
name: Build Debian package
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build output
uses: actions/download-artifact@v4
with:
name: build-linux
path: ${{ github.workspace }}
- name: Build
id: build
run: |
PACKAGE_NAME=${{ github.ref_name }}
chmod +x ./$PACKAGE_NAME
PACKAGE_VERSION=$(./$PACKAGE_NAME --version --minimal-output)
PACKAGE_DESC="$(./$PACKAGE_NAME --desc --minimal-output)"
PACKAGE_DIR="./$PACKAGE_NAME-$PACKAGE_VERSION"
mkdir -p "$PACKAGE_DIR"/usr/bin
mv "./$PACKAGE_NAME" "$PACKAGE_DIR/usr/bin/"
ln -sf libraylib.so.5.5.0 libraylib.so.550
ln -sf libraylib.so.5.5.0 libraylib.so
mkdir -p "$PACKAGE_DIR"/usr/lib/$PACKAGE_NAME
mv ./*.so* "$PACKAGE_DIR/usr/lib/$PACKAGE_NAME/"
mkdir -p "$PACKAGE_DIR/usr/share/$PACKAGE_NAME/"
cp -r ./resources "$PACKAGE_DIR/usr/share/$PACKAGE_NAME/"
ICON_DIR="usr/share/icons"
mkdir -p "$PACKAGE_DIR/$ICON_DIR"
ICON_PATH="$ICON_DIR/$PACKAGE_NAME.png"
cp ./resources/icon.png "$PACKAGE_DIR/$ICON_PATH"
DESKTOP_ICON_LINE="Icon=/$ICON_PATH"
rm -rf resources
mkdir -p "$PACKAGE_DIR/usr/share/applications/"
cat <<EOF > "$PACKAGE_DIR/usr/share/applications/$PACKAGE_NAME.desktop"
[Desktop Entry]
Version=1.0
Name=$PACKAGE_NAME
GenericName=$PACKAGE_NAME
$DESKTOP_ICON_LINE
Comment=$PACKAGE_DESCRIPTION
Exec=/usr/bin/$PACKAGE_NAME
TryExec=/usr/bin/$PACKAGE_NAME
Terminal=false
Type=Application
Categories=Utility;Game;
Keywords=Game;Snake;Raylib;C;CPP;
EOF
mkdir -p $PACKAGE_DIR/DEBIAN
cat <<EOF > "$PACKAGE_DIR/DEBIAN/control"
Package: $PACKAGE_NAME
Version: $PACKAGE_VERSION
Section: utils
Depends: libc6, libopengl0, libglx0, libglu1-mesa, libstdc++6, libgcc-s1, libx11-6, libxcb1
Priority: optional
Architecture: amd64
Maintainer: Johnny Cena <iamahuman1395@gmail.com>
Description: $PACKAGE_DESCRIPTION
EOF
dpkg-deb --build "$PACKAGE_DIR" "$PACKAGE_DIR".deb
echo "package-path=$PACKAGE_DIR.deb" >> $GITHUB_OUTPUT
- name: Test package
run: |
sudo apt-get update && sudo apt-get install -y libopengl0 libglu1-mesa
sudo dpkg -i ${{ steps.build.outputs.package-path }}
- name: Upload
uses: actions/upload-artifact@v4
with:
path: ${{ steps.build.outputs.package-path }}
name: Debian package
cleanup:
name: Cleanup
runs-on: ubuntu-latest
needs: [ linux-deb, win-msi, build-relwithdebinfo ]
permissions:
contents: write
steps:
- name: Download build outputs
uses: actions/download-artifact@v4
- name: Organize
id: organize
run: |
rm -rf "Debian package" "Windows installer"
mv build-win-msvc/resources .
rm -rf */resources
mkdir Release
mkdir RelWithDebInfo
mv build-*-relwithdebinfo RelWithDebInfo/
cd RelWithDebInfo
cd build-win-msvc-relwithdebinfo && zip -r ../Windows-MSVC.zip * && cd ..
cd build-win-llvm-relwithdebinfo && zip -r ../Windows-LLVM.zip * && cd ..
cd build-mac-relwithdebinfo && zip -r ../MacOS.zip * && cd ..
cd build-linux-relwithdebinfo && zip -r ../Linux.zip * && cd ..
cd ..
mv build-* Release
cd Release
cd build-win-msvc && zip -r ../Windows-MSVC.zip * && cd ..
cd build-win-llvm && zip -r ../Windows-LLVM.zip * && cd ..
cd build-mac && zip -r ../MacOS.zip * && cd ..
cd build-linux && zip -r ../Linux.zip * && cd ..
cd ..
- name: Upload Release zip
uses: actions/upload-artifact@v4
with:
path: Release/*.zip
name: Release Builds
- name: Upload RelWithDebInfo zip
uses: actions/upload-artifact@v4
with:
path: RelWithDebInfo/*.zip
name: RelWithDebInfo Builds
- name: Upload resources zip
uses: actions/upload-artifact@v4
with:
path: resources/*
name: resources
- name: Delete old artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: build-*
publish:
name: Publish
permissions:
contents: write
needs: cleanup
runs-on: ubuntu-latest
steps:
- name: Download Windows installer
uses: actions/download-artifact@v4
with:
name: Windows installer
- name: Download Debian package
uses: actions/download-artifact@v4
with:
name: Debian package
- name: Download zips
uses: actions/download-artifact@v4
with:
name: Release Builds
- name: Prepare
run: |
mv Windows-MSVC.zip Windows.zip
rm Windows-LLVM.zip
unzip MacOS.zip -d mac
rm MacOS.zip
cd mac
ln -sf libraylib.dylib.5.5.0 libraylib.550.dylib
ln -sf libraylib.dylib.5.5.0 libraylib.dylib
tar -czvf ../MacOS.tar.gz *
cd ..
unzip Linux.zip -d linux
rm Linux.zip
cd linux
ln -sf libraylib.so.5.5.0 libraylib.so.550
ln -sf libraylib.so.5.5.0 libraylib.so
tar -czvf ../Linux.tar.gz *
- name: Create release
if: github.ref_name != 'Template'
uses: softprops/action-gh-release@v2
with:
tag_name: nightly-${{ github.ref_name }}
name: Development build for ${{ github.ref_name }}
body: |
Build triggered by commit ${{ github.sha }} on branch ${{ github.ref_name }}.
This is a build of the **latest commit**, it is not guaranteed to be stable.
draft: false
prerelease: true
files: |
*.msi
*.deb
*.zip
*.tar.gz