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: push:
paths: paths:
- "**.zig" - "**.zig"
- "**.zig.zon" - "dl_sdl2.ps1"
- "build.zig.zon"
branches: branches:
- main - main
schedule: schedule:
@ -20,7 +21,12 @@ jobs:
steps: steps:
- uses: goto-bus-stop/setup-zig@v2 - uses: goto-bus-stop/setup-zig@v2
with: 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 - name: prepare-linux
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
@ -29,26 +35,19 @@ jobs:
- name: prepare-windows - name: prepare-windows
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: | run: |
vcpkg integrate install .\dl_sdl2.ps1
vcpkg install sdl2:x64-windows
git config --global core.autocrlf false
- name: prepare-macos - name: prepare-macos
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: | run: |
brew install sdl2 brew install sdl2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: build - name: build
run: zig build -Doptimize=ReleaseSafe -Dcpu=baseline run: zig build -Doptimize=ReleaseSafe -Dcpu=baseline
- name: prepare-executable
run: |
mv zig-out/lib/* zig-out/bin
- name: upload - name: upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: zba-${{matrix.os}} name: zba-${{matrix.os}}
path: zig-out/bin path: zig-out
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -57,6 +56,5 @@ jobs:
submodules: recursive submodules: recursive
- uses: goto-bus-stop/setup-zig@v2 - uses: goto-bus-stop/setup-zig@v2
with: with:
version: 0.11.0-dev.3395+1e7dcaa3a version: 0.12.0-dev.2063+804cee3b9
- run: zig fmt src/**/*.zig - 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 // https://github.com/MasterQ32/SDL.zig
const sdk = Sdk.init(b, null); const sdk = Sdk.init(b, null);
sdk.link(exe, .static); sdk.link(exe, .dynamic);
exe.root_module.addImport("sdl2", sdk.getNativeModule());
// https://git.musuka.dev/paoda/zgui // https://git.musuka.dev/paoda/zgui
const zgui_pkg = zgui.package(b, target, optimize, .{ .options = .{ .backend = .sdl2_opengl3 } }); 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); zgui_pkg.link(exe);
sdk.link(zgui_pkg.zgui_c_cpp, .static);
// This declares intent for the executable to be installed into the // This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default // standard location when the user invokes the "install" step (the default