Skip to content

Update Zig Workflow. #12

Update Zig Workflow.

Update Zig Workflow. #12

Workflow file for this run

name: Zig Test
on:
workflow_dispatch:
push:
paths:
- zig/**
env:
ZIG_VERSION: 0.13.0
ZIG_PATH: ~/sdk/zig
GODOT_VERSION: 4.3
GODOT_PATH: ~/sdk/godot
jobs:
godot_zig:
strategy:
matrix:
os: [ubuntu-latest] #, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
lfs: true
# Cache Godot Imports
- name: Cache import assets
uses: actions/cache@v3
id: cache-import
with:
path: |
godot/.godot/imported/
key: import-assets-${{ runner.os }}-${{ github.sha }}
# Cache Zig
- name: Cache Zig
uses: actions/cache@v3
id: cache-zig
with:
path: |
${{env.ZIG_PATH}}
key: zig-${{ runner.os }}-${{ github.sha }}
# Cache Godot
- name: Cache Godot
uses: actions/cache@v3
id: cache-godot
with:
path: |
${{env.GODOT_PATH}}
key: godot-${{ runner.os }}-${{ github.sha }}
- name: Install Zig
if: steps.cache-zig.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install xz-utils -y
sudo mkdir -p ~/sdk/zig
sudo mkdir -p /home/downloads
sudo wget https://ziglang.org/download/${{env.ZIG_VERSION}}/zig-linux-x86_64-${{env.ZIG_VERSION}}.tar.xz -O /home/downloads/zig-linux-x86_64-${{env.ZIG_VERSION}}.tar.xz
sudo tar -xf /home/downloads/zig-linux-x86_64-${{env.ZIG_VERSION}}.tar.xz -C ~/sdk/zig
sudo cp -r ~/sdk/zig/zig-linux-x86_64-${{env.ZIG_VERSION}}/* ~/sdk/zig
sudo rm -rf ~/sdk/zig/zig-linux-x86_64-${{env.ZIG_VERSION}}
- name: Add Zig to PATH
run: echo ${{env.ZIG_PATH}} >> $GITHUB_PATH
- name: Install Godot
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
sudo mkdir -p ~/sdk/godot
sudo mkdir -p /home/downloads
sudo wget https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_linux.x86_64.zip -O /home/downloads/Godot_v4.3-stable_linux.x86_64.zip
sudo unzip /home/downloads/Godot_v4.3-stable_linux.x86_64.zip -d ~/sdk/godot
sudo mv ~/sdk/godot/Godot_v4.3-stable_linux.x86_64 ~/sdk/godot/godot
- name: Add Godot to PATH
run: echo ${{env.GODOT_PATH}} >> $GITHUB_PATH
- name: Generate Godot Project
if: steps.cache-import.outputs.cache-hit != 'true'
run: godot --headless --verbose --editor --quit --rendering-driver opengl3 -e ../godot
working-directory: ./zig
- name: Generate Zig Bindings
working-directory: ./zig
run: zig build bind
- name: Test
working-directory: ./zig
run: zig build test
- name: Lint
working-directory: ./zig
run: zig fmt --check ./src
- name: Build
working-directory: ./zig
run: zig build