Add GitHub Actions release workflow for Windows, macOS, and Linux #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitHub Actions CI Workflow for gleditor | |
| # Runs on every push and pull request to ensure builds work | |
| name: CI | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| pull_request: | |
| branches: [main, master, develop] | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| # ============================================================================ | |
| # Linux Build & Test | |
| # ============================================================================ | |
| build-linux: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| build-system: [cmake, make] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| pkg-config \ | |
| cmake \ | |
| libgtk-3-dev \ | |
| libgtksourceview-4-dev \ | |
| libegl1-mesa-dev \ | |
| libgles2-mesa-dev | |
| - name: Build with CMake | |
| if: matrix.build-system == 'cmake' | |
| run: | | |
| mkdir build && cd build | |
| cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} .. | |
| cmake --build . --config ${{ env.BUILD_TYPE }} -j$(nproc) | |
| - name: Build with Make | |
| if: matrix.build-system == 'make' | |
| run: | | |
| make -j$(nproc) | |
| - name: Verify binary exists | |
| run: | | |
| if [ "${{ matrix.build-system }}" = "cmake" ]; then | |
| test -f build/gleditor && echo "✓ Binary built successfully" | |
| else | |
| test -f bin/gleditor && echo "✓ Binary built successfully" | |
| fi | |
| # ============================================================================ | |
| # macOS Build | |
| # ============================================================================ | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| brew install gtk+3 gtksourceview4 pkg-config cmake | |
| - name: Build with CMake | |
| run: | | |
| mkdir build && cd build | |
| cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} .. | |
| cmake --build . --config ${{ env.BUILD_TYPE }} -j$(sysctl -n hw.ncpu) | |
| - name: Verify binary exists | |
| run: | | |
| test -f build/gleditor || test -d build/gleditor.app && echo "✓ Binary built successfully" | |
| # ============================================================================ | |
| # Windows Build | |
| # ============================================================================ | |
| build-windows: | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup MSYS2 | |
| 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-cmake | |
| mingw-w64-x86_64-pkg-config | |
| mingw-w64-x86_64-gtk3 | |
| mingw-w64-x86_64-gtksourceview4 | |
| mingw-w64-x86_64-libepoxy | |
| - name: Build with CMake | |
| run: | | |
| mkdir build && cd build | |
| cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} .. | |
| cmake --build . --config ${{ env.BUILD_TYPE }} -j$(nproc) | |
| - name: Verify binary exists | |
| run: | | |
| test -f build/gleditor.exe && echo "✓ Binary built successfully" |