build script changes #52
This file contains 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
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: goto-bus-stop/setup-zig@v2 | |
with: | |
version: 0.12.0 | |
- run: zig fmt --check . | |
build: | |
permissions: write-all | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-linux | |
- os: macos-latest | |
target: aarch64-macos-none | |
- os: windows-latest | |
target: x86_64-windows | |
runs-on: ${{ matrix.os }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.number }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "🏷️ Push tag" | |
uses: EndBug/latest-tag@latest | |
with: | |
# You can change the name of the tag with this input. | |
# Default: 'latest' | |
ref: ${{env.PR_NUMBER}} | |
- uses: goto-bus-stop/setup-zig@v2 | |
name: Setup zig | |
with: | |
version: 0.12.0 | |
- name: Install dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libx11-dev libgtk-4-dev build-essential | |
- name: Set SDKROOT (macOS) | |
if: matrix.os == 'macos-latest' | |
run: echo "export SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV | |
- name: Get universal dependencies | |
run: zig fetch --save https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz | |
- name: Build binary | |
run: zig build -Doptimize=ReleaseSafe | |
- name: Rename binary (MacOS, Ubuntu) | |
if: matrix.os != 'windows-latest' | |
run: | | |
mv zig-out/bin/mach-mess zig-out/bin/diab-concept_${{ matrix.os }}-${{ matrix.target }} | |
chmod +x zig-out/bin/diab-concept_${{ matrix.os }}-${{ matrix.target }} | |
- name: Rename binary (Windows) | |
if: matrix.os == 'windows-latest' | |
run: ren zig-out\bin\mach-mess zig-out\bin\diab-concept_${{ matrix.os }}-${{ matrix.target }}.exe | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
# if: github.ref == 'refs/heads/main' | |
with: | |
tag_name: 'latest' | |
files: | | |
zig-out/bin/* |