Merge pull request #111 from jetzig-framework/github-actions-upload-artifact-v4

GH actions fixes
This commit is contained in:
bobf 2024-11-14 19:01:24 +00:00 committed by GitHub
commit 7e973bbc3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 18 deletions

View File

@ -28,7 +28,7 @@ jobs:
- name: Setup Zig
# You may pin to the exact commit or the version.
# uses: goto-bus-stop/setup-zig@41ae19e72e21b9a1380e86ff9f058db709fc8fc6
uses: goto-bus-stop/setup-zig@v2.2.0
uses: goto-bus-stop/setup-zig@v2
with:
version: master
cache: true # Let's see how this behaves
@ -40,7 +40,7 @@ jobs:
run: zig build --verbose
- name: Run Tests
run: zig build test
run: zig build test --summary all
- name: Run App Tests
run: |
@ -67,25 +67,25 @@ jobs:
- name: Upload artifacts Target Windows
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-windows
path: artifacts/x86_64-windows
- name: Upload artifacts Target Linux
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-linux
path: artifacts/x86_64-linux
- name: Upload artifacts Target MacOS
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-macos-x86
path: artifacts/x86_64-macos
- name: Upload artifacts Target MacOS 2
if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-macos-aarch64
path: artifacts/aarch64-macos

View File

@ -20,13 +20,8 @@ pub fn build(b: *std.Build) !void {
.jetquery_migrations_path = @as([]const u8, "src/app/database/migrations"),
});
exe.root_module.addImport("jetquery", jetquery_dep.module("jetquery"));
exe.root_module.addImport("jetquery_migrate", jetquery_dep.module("jetquery_migrate"));
exe.root_module.addImport("args", zig_args_dep.module("args"));
exe.root_module.addImport(
"init_data",
try compile.initDataModule(b),
);
exe.root_module.addImport("init_data", try compile.initDataModule(b));
b.installArtifact(exe);

View File

@ -1,8 +1,6 @@
const std = @import("std");
const args = @import("args");
const jetquery = @import("jetquery");
const Migrate = @import("jetquery_migrate");
const util = @import("../util.zig");
const cli = @import("../cli.zig");

View File

@ -17,8 +17,6 @@ resource_id: []const u8,
extension: ?[]const u8,
query: ?[]const u8,
// TODO: Fix edge case `/foo/bar/` <-- strip trailing slash.
const Self = @This();
/// Initialize a new HTTP Path.
@ -92,9 +90,12 @@ fn getBasePath(path: []const u8) []const u8 {
return path[0..query_index];
}
} else if (std.mem.lastIndexOfScalar(u8, path, '.')) |extension_index| {
return if (std.mem.eql(u8, path, "/")) path else std.mem.trimRight(u8, path[0..extension_index], "/");
return if (isRootPath(path[0..extension_index]))
path[0..extension_index]
else
std.mem.trimRight(u8, path[0..extension_index], "/");
} else {
return if (std.mem.eql(u8, path, "/")) path else std.mem.trimRight(u8, path, "/");
return if (isRootPath(path)) path else std.mem.trimRight(u8, path, "/");
}
}
@ -163,6 +164,10 @@ fn getQuery(path: []const u8) ?[]const u8 {
}
}
inline fn isRootPath(path: []const u8) bool {
return std.mem.eql(u8, path, "/");
}
test ".base_path (with extension, with query)" {
const path = Self.init("/foo/bar/baz.html?qux=quux&corge=grault");
@ -193,6 +198,13 @@ test ".base_path (root path)" {
try std.testing.expectEqualStrings("/", path.base_path);
}
test ".base_path (root path with extension)" {
const path = Self.init("/.json");
try std.testing.expectEqualStrings("/", path.base_path);
try std.testing.expectEqualStrings(".json", path.extension.?);
}
test ".directory (with extension, with query)" {
const path = Self.init("/foo/bar/baz.html?qux=quux&corge=grault");