Update the Github Workfllow. #10
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: 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: | | |
apt-get update | |
apt-get upgrade -y | |
apt-get install xz-utils -y | |
mkdir -p ~/sdk/zig | |
mkdir -p /home/downloads | |
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 | |
tar -xf /home/downloads/zig-linux-x86_64-${{env.ZIG_VERSION}}.tar.xz -C ~/sdk/zig | |
cp -r ~/sdk/zig/zig-linux-x86_64-${{env.ZIG_VERSION}}/* ~/sdk/zig | |
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: | | |
mkdir -p ~/sdk/godot | |
mkdir -p /home/downloads | |
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 | |
unzip /home/downloads/Godot_v4.3-stable_linux.x86_64.zip -d ~/sdk/godot | |
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 |