Merge branch 'master' into zig-develop

This commit is contained in:
Emil Lerch 2025-04-16 19:06:00 -07:00
commit 2a61160ef8
Signed by: lobo
GPG key ID: A7B62D657EF764F8
10 changed files with 53 additions and 110 deletions

View file

@ -1,5 +1,6 @@
name: AWS-Zig Build name: AWS-Zig Build
on: on:
workflow_dispatch:
push: push:
branches: branches:
- 'master' - 'master'
@ -17,11 +18,17 @@ jobs:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Zig - name: Setup Zig
uses: mlugg/setup-zig@v1.2.1 uses: https://github.com/mlugg/setup-zig@v1.2.1
with: with:
version: 0.14.0 version: 0.14.0
- name: Restore Zig caches
uses: https://github.com/Hanaasagi/zig-action-cache@3954aae427f8b05914e08dfd79f15e1f2e435929
- name: Run smoke test
run: zig build smoke-test --verbose
- name: Run tests - name: Run tests
run: zig build test --verbose run: zig build test --verbose --summary all
- name: Run tests (release mode)
run: zig build test -Doptimize=ReleaseSafe --verbose
# Zig build scripts don't have the ability to import depenedencies directly # Zig build scripts don't have the ability to import depenedencies directly
# (https://github.com/ziglang/zig/issues/18164). We can allow downstream # (https://github.com/ziglang/zig/issues/18164). We can allow downstream
# build scripts to import aws with a few tweaks, but we can't @import("src/aws.zig") # build scripts to import aws with a few tweaks, but we can't @import("src/aws.zig")
@ -66,7 +73,7 @@ jobs:
# - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}" # - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}"
- name: Publish source code with generated models - name: Publish source code with generated models
run: | run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl -s --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \ --upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \
https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}-with-models.tar.gz https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}-with-models.tar.gz
- name: Build example - name: Build example

View file

@ -26,15 +26,19 @@ jobs:
with: with:
ref: zig-mach ref: zig-mach
- name: Setup Zig - name: Setup Zig
uses: mlugg/setup-zig@v1.2.1 uses: https://github.com/mlugg/setup-zig@v1.2.1
with: with:
version: mach-latest version: mach-latest
- name: Restore Zig caches
uses: https://github.com/Hanaasagi/zig-action-cache@3954aae427f8b05914e08dfd79f15e1f2e435929
- name: Run gen - name: Run gen
run: zig build gen --verbose run: zig build gen --verbose
- name: Run smoke test - name: Run smoke test
run: zig build smoke-test --verbose run: zig build smoke-test --verbose
- name: Run full tests - name: Run full tests
run: zig build test --verbose run: zig build test --verbose --summary all
- name: Run tests (release mode)
run: zig build test -Doptimize=ReleaseSafe --verbose
# Zig package manager expects everything to be inside a directory in the archive, # Zig package manager expects everything to be inside a directory in the archive,
# which it then strips out on download. So we need to shove everything inside a directory # which it then strips out on download. So we need to shove everything inside a directory
# the way GitHub/Gitea does for repo archives # the way GitHub/Gitea does for repo archives
@ -67,7 +71,7 @@ jobs:
# - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}" # - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}"
- name: Publish source code with generated models - name: Publish source code with generated models
run: | run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl -s --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz \ --upload-file ${{ runner.temp }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz \
https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz
- name: Build example - name: Build example

View file

@ -26,11 +26,17 @@ jobs:
with: with:
ref: zig-develop ref: zig-develop
- name: Setup Zig - name: Setup Zig
uses: mlugg/setup-zig@v1.2.1 uses: https://github.com/mlugg/setup-zig@v1.2.1
with: with:
version: master version: master
- name: Run tests - name: Restore Zig caches
run: zig build test --verbose uses: https://github.com/Hanaasagi/zig-action-cache@3954aae427f8b05914e08dfd79f15e1f2e435929
- name: Run smoke test
run: zig build smoke-test --verbose
- name: Run full tests
run: zig build test --verbose --summary all
- name: Run tests (release mode)
run: zig build test -Doptimize=ReleaseSafe --verbose
# Zig package manager expects everything to be inside a directory in the archive, # Zig package manager expects everything to be inside a directory in the archive,
# which it then strips out on download. So we need to shove everything inside a directory # which it then strips out on download. So we need to shove everything inside a directory
# the way GitHub/Gitea does for repo archives # the way GitHub/Gitea does for repo archives
@ -63,7 +69,7 @@ jobs:
# - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}" # - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}"
- name: Publish source code with generated models - name: Publish source code with generated models
run: | run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl -s --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz \ --upload-file ${{ runner.temp }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz \
https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz
- name: Build example - name: Build example

View file

@ -20,11 +20,18 @@ jobs:
with: with:
ref: zig-0.13 ref: zig-0.13
- name: Setup Zig - name: Setup Zig
uses: mlugg/setup-zig@v1.2.1 uses: https://github.com/mlugg/setup-zig@v1.2.1
with: with:
version: 0.13.0 version: 0.13.0
- name: Run tests - name: Restore Zig caches
run: zig build test --verbose uses: https://github.com/Hanaasagi/zig-action-cache@3954aae427f8b05914e08dfd79f15e1f2e435929
- name: Run smoke test
run: zig build smoke-test --verbose
- name: Run full tests
run: zig build test --verbose --summary all
# Release mode fix not backported to 0.13.0 code
#- name: Run tests (release mode)
# run: zig build test -Doptimize=ReleaseSafe --verbose
# Zig build scripts don't have the ability to import depenedencies directly # Zig build scripts don't have the ability to import depenedencies directly
# (https://github.com/ziglang/zig/issues/18164). We can allow downstream # (https://github.com/ziglang/zig/issues/18164). We can allow downstream
# build scripts to import aws with a few tweaks, but we can't @import("src/aws.zig") # build scripts to import aws with a few tweaks, but we can't @import("src/aws.zig")
@ -69,7 +76,7 @@ jobs:
# - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}" # - run: echo "URL of foo (1) is ${{ steps.sign.outputs.URL_1 }}"
- name: Publish source code with generated models - name: Publish source code with generated models
run: | run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl -s --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \ --upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \
https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}-with-models.tar.gz https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}-with-models.tar.gz
- name: Build example - name: Build example

View file

@ -1,20 +0,0 @@
name: Current zig version build
on:
push:
branches:
- 'master'
jobs:
build-amd64:
runs-on: ubuntu-latest
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1.2.1
with:
version: 0.14.0
- name: Run tests
run: zig build test -Dbroken-windows --verbose # Github runners try to run the windows tests despite disabling foreign checks
- name: Build example
run: ( cd example && zig build ) # Make sure example builds

View file

@ -1,20 +0,0 @@
name: Latest mach nominated zig version build
on:
push:
branches:
- 'zig-mach*'
jobs:
build-zig-mach-latest:
runs-on: ubuntu-latest
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1.2.1
with:
version: mach-latest
- name: Run tests
run: zig build test -Dbroken-windows --verbose
- name: Build example
run: ( cd example && zig build ) # Make sure example builds

View file

@ -1,20 +0,0 @@
name: Nightly zig version Build
on:
push:
branches:
- 'zig-develop*'
jobs:
build-zig-nightly:
runs-on: ubuntu-latest
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1.2.1
with:
version: master
- name: Run tests
run: zig build test -Dbroken-windows --verbose
- name: Build example
run: ( cd example && zig build ) # Make sure example builds

View file

@ -1,20 +0,0 @@
name: Previous zig version Build
on:
push:
branches:
- 'zig-0.13'
jobs:
build-amd64:
runs-on: ubuntu-latest
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1.2.1
with:
version: 0.13.0
- name: Run tests
run: zig build test -Dbroken-windows --verbose # Github runners try to run the windows tests despite disabling foreign checks
- name: Build example
run: ( cd example && zig build ) # Make sure example builds

View file

@ -6,8 +6,8 @@
.dependencies = .{ .dependencies = .{
.aws = .{ .aws = .{
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/8ac7aa47f728b8ab4bb857d2ec016fe362e3f3c3/8ac7aa47f728b8ab4bb857d2ec016fe362e3f3c3nightly-zig-with-models.tar.gz", .url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/7a6086447c1249b0e5b5b5f3873d2f7932bea56d/7a6086447c1249b0e5b5b5f3873d2f7932bea56d-with-models.tar.gz",
.hash = "aws-0.0.1-SbsFcJ6ACQBrABo_x6CvbSEdieo2TXPnDlANQLAkDfdD", .hash = "aws-0.0.1-SbsFcGN_CQCBjurpc2GEMw4c_qAkGu6KpuVnLBLY4L4q",
}, },
}, },
} }

View file

@ -688,7 +688,6 @@ pub fn Request(comptime request_action: anytype) type {
fn ParsedJsonData(comptime T: type) type { fn ParsedJsonData(comptime T: type) type {
return struct { return struct {
raw_response_parsed: bool,
parsed_response_ptr: *T, parsed_response_ptr: *T,
allocator: std.mem.Allocator, allocator: std.mem.Allocator,
@ -697,7 +696,6 @@ pub fn Request(comptime request_action: anytype) type {
pub fn deinit(self: MySelf) void { pub fn deinit(self: MySelf) void {
// This feels like it should result in a use after free, but it // This feels like it should result in a use after free, but it
// seems to be working? // seems to be working?
if (self.raw_response_parsed)
self.allocator.destroy(self.parsed_response_ptr); self.allocator.destroy(self.parsed_response_ptr);
} }
}; };
@ -713,11 +711,13 @@ pub fn Request(comptime request_action: anytype) type {
std.mem.eql(u8, key, action.action_name ++ "Response") or std.mem.eql(u8, key, action.action_name ++ "Response") or
std.mem.eql(u8, key, action.action_name ++ "Result") or std.mem.eql(u8, key, action.action_name ++ "Result") or
isOtherNormalResponse(response_types.NormalResponse, key); isOtherNormalResponse(response_types.NormalResponse, key);
var raw_response_parsed = false;
var stream = json.TokenStream.init(data); var stream = json.TokenStream.init(data);
const parsed_response_ptr = blk: { const parsed_response_ptr = blk: {
if (!response_types.isRawPossible or found_normal_json_response) const ptr = try options.client.allocator.create(response_types.NormalResponse);
break :blk &(json.parse(response_types.NormalResponse, &stream, parser_options) catch |e| { errdefer options.client.allocator.destroy(ptr);
if (!response_types.isRawPossible or found_normal_json_response) {
ptr.* = (json.parse(response_types.NormalResponse, &stream, parser_options) catch |e| {
log.err( log.err(
\\Call successful, but unexpected response from service. \\Call successful, but unexpected response from service.
\\This could be the result of a bug or a stale set of code generated \\This could be the result of a bug or a stale set of code generated
@ -733,10 +733,10 @@ pub fn Request(comptime request_action: anytype) type {
return e; return e;
}); });
break :blk ptr;
}
log.debug("Appears server has provided a raw response", .{}); log.debug("Appears server has provided a raw response", .{});
raw_response_parsed = true;
const ptr = try options.client.allocator.create(response_types.NormalResponse);
errdefer options.client.allocator.destroy(ptr);
@field(ptr.*, std.meta.fields(action.Response)[0].name) = @field(ptr.*, std.meta.fields(action.Response)[0].name) =
json.parse(response_types.RawResponse, &stream, parser_options) catch |e| { json.parse(response_types.RawResponse, &stream, parser_options) catch |e| {
log.err( log.err(
@ -756,8 +756,7 @@ pub fn Request(comptime request_action: anytype) type {
break :blk ptr; break :blk ptr;
}; };
return ParsedJsonData(response_types.NormalResponse){ return ParsedJsonData(response_types.NormalResponse){
.raw_response_parsed = raw_response_parsed, .parsed_response_ptr = parsed_response_ptr,
.parsed_response_ptr = @constCast(parsed_response_ptr), //TODO: why doesn't changing const->var above fix this?
.allocator = options.client.allocator, .allocator = options.client.allocator,
}; };
} }
@ -1702,7 +1701,7 @@ const TestSetup = struct {
request_options: TestOptions, request_options: TestOptions,
server_thread: std.Thread = undefined, server_thread: std.Thread = undefined,
creds: aws_auth.Credentials = undefined, creds: aws_auth.Credentials = undefined,
client: *Client = undefined, client: Client = undefined,
started: bool = false, started: bool = false,
const Self = @This(); const Self = @This();
@ -1738,8 +1737,8 @@ const TestSetup = struct {
null, null,
); );
aws_creds.static_credentials = self.creds; aws_creds.static_credentials = self.creds;
var client = Client.init(self.allocator, .{}); const client = Client.init(self.allocator, .{});
self.client = &client; self.client = client;
return .{ return .{
.region = "us-west-2", .region = "us-west-2",
.client = client, .client = client,