feat(ci): update ci

This commit is contained in:
Rekai Nyangadzayi Musuka 2024-03-06 18:36:34 -06:00
parent 114eb69e35
commit d71a07733d
2 changed files with 17 additions and 19 deletions

View File

@ -4,7 +4,8 @@ on:
push:
paths:
- "**.zig"
- "**.zig.zon"
- "dl_sdl2.ps1"
- "build.zig.zon"
branches:
- main
schedule:
@ -20,7 +21,12 @@ jobs:
steps:
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
version: 0.12.0-dev.2063+804cee3b9
- run: |
git config --global core.autocrlf false
- uses: actions/checkout@v3
with:
submodules: recursive
- name: prepare-linux
if: runner.os == 'Linux'
run: |
@ -29,26 +35,19 @@ jobs:
- name: prepare-windows
if: runner.os == 'Windows'
run: |
vcpkg integrate install
vcpkg install sdl2:x64-windows
git config --global core.autocrlf false
.\dl_sdl2.ps1
- name: prepare-macos
if: runner.os == 'macOS'
run: |
brew install sdl2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: build
run: zig build -Doptimize=ReleaseSafe -Dcpu=baseline
- name: prepare-executable
run: |
mv zig-out/lib/* zig-out/bin
- name: upload
uses: actions/upload-artifact@v3
with:
name: zba-${{matrix.os}}
path: zig-out/bin
path: zig-out
lint:
runs-on: ubuntu-latest
steps:
@ -57,6 +56,5 @@ jobs:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0-dev.3395+1e7dcaa3a
- run: zig fmt src/**/*.zig
version: 0.12.0-dev.2063+804cee3b9
- run: zig fmt --check {src,lib}/**/*.zig build.zig build.zig.zon

View File

@ -36,14 +36,14 @@ pub fn build(b: *std.Build) void {
// https://github.com/MasterQ32/SDL.zig
const sdk = Sdk.init(b, null);
sdk.link(exe, .static);
exe.root_module.addImport("sdl2", sdk.getNativeModule());
sdk.link(exe, .dynamic);
// https://git.musuka.dev/paoda/zgui
const zgui_pkg = zgui.package(b, target, optimize, .{ .options = .{ .backend = .sdl2_opengl3 } });
sdk.link(zgui_pkg.zgui_c_cpp, .dynamic);
exe.root_module.addImport("sdl2", sdk.getNativeModule());
zgui_pkg.link(exe);
sdk.link(zgui_pkg.zgui_c_cpp, .static);
// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default