Compare commits

..

6 Commits

Author SHA1 Message Date
ffbbf21303
upgrade to zig 0.13.0
All checks were successful
AWS-Zig Build / build-zig-amd64-host (push) Successful in 3m38s
2024-06-07 08:26:56 -07:00
a659c99350
re-enable windows test for 0.13/LLVM 18, update README
All checks were successful
aws-zig mach nominated build / build-zig-nominated-mach-latest (push) Successful in 3m5s
aws-zig nightly build / build-zig-nightly (push) Successful in 3m32s
2024-06-04 17:34:33 -07:00
981d5579f1
update to compatible package version
All checks were successful
aws-zig mach nominated build / build-zig-nominated-mach-latest (push) Successful in 3m5s
aws-zig nightly build / build-zig-nightly (push) Successful in 3m1s
2024-06-04 17:04:11 -07:00
3307eb6b8f
update mach/nightly jobs to disambiguate package versions
Some checks failed
aws-zig mach nominated build / build-zig-nominated-mach-latest (push) Failing after 2m49s
aws-zig nightly build / build-zig-nightly (push) Failing after 2m45s
2024-06-04 16:58:28 -07:00
332aa1a855
update example to zig 0.13-dev.365 (zig nominated build 2024.05)
Some checks failed
aws-zig mach nominated build / build-zig-nominated-mach-latest (push) Failing after 45s
aws-zig nightly build / build-zig-nightly (push) Failing after 2m47s
2024-06-04 16:35:52 -07:00
7d80f42a3e
update to zig 0.13-dev.365 (zig nominated build 2024.05)
Some checks failed
aws-zig mach nominated build / build-zig-nominated-mach-latest (push) Failing after 1m57s
aws-zig nightly build / build-zig-nightly (push) Failing after 3m49s
2024-06-04 14:53:09 -07:00
12 changed files with 49 additions and 50 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Setup Zig - name: Setup Zig
uses: https://git.lerch.org/lobo/setup-zig@v3 uses: https://git.lerch.org/lobo/setup-zig@v3
with: with:
version: 0.12.0 version: 0.13.0
- name: Run tests - name: Run tests
run: zig build test --verbose run: zig build test --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,

View File

@ -7,8 +7,7 @@ on:
branches: branches:
- 'zig-develop*' - 'zig-develop*'
env: env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} PKG_PREFIX: nominated-zig
ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
jobs: jobs:
build-zig-nominated-mach-latest: build-zig-nominated-mach-latest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -25,6 +24,8 @@ jobs:
uses: https://git.lerch.org/lobo/setup-zig@v3 uses: https://git.lerch.org/lobo/setup-zig@v3
with: with:
version: mach-latest version: mach-latest
- name: Run tests
run: zig build test --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
@ -34,7 +35,7 @@ jobs:
# should be using git archive, but we need our generated code to be part of it # should be using git archive, but we need our generated code to be part of it
- name: Package source code with generated models - name: Package source code with generated models
run: | run: |
tar -czf ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \ tar -czf ${{ runner.temp }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz \
--format ustar \ --format ustar \
--exclude 'zig-*' \ --exclude 'zig-*' \
--transform 's,^,${{ github.sha }}/,' * --transform 's,^,${{ github.sha }}/,' *
@ -58,8 +59,8 @@ jobs:
- name: Publish source code with generated models - name: Publish source code with generated models
run: | run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}-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 }}-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
run: ( cd example && zig build ) # Make sure example builds run: ( cd example && zig build ) # Make sure example builds
- name: Notify - name: Notify

View File

@ -7,8 +7,7 @@ on:
branches: branches:
- 'zig-develop*' - 'zig-develop*'
env: env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} PKG_PREFIX: nightly-zig
ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
jobs: jobs:
build-zig-nightly: build-zig-nightly:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -36,7 +35,7 @@ jobs:
# should be using git archive, but we need our generated code to be part of it # should be using git archive, but we need our generated code to be part of it
- name: Package source code with generated models - name: Package source code with generated models
run: | run: |
tar -czf ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \ tar -czf ${{ runner.temp }}/${{ github.sha }}${{ env.PKG_PREFIX }}-with-models.tar.gz \
--format ustar \ --format ustar \
--exclude 'zig-*' \ --exclude 'zig-*' \
--transform 's,^,${{ github.sha }}/,' * --transform 's,^,${{ github.sha }}/,' *
@ -60,8 +59,8 @@ jobs:
- name: Publish source code with generated models - name: Publish source code with generated models
run: | run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}-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 }}-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
run: ( cd example && zig build ) # Make sure example builds run: ( cd example && zig build ) # Make sure example builds
- name: Notify - name: Notify

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ libs/
src/git_version.zig src/git_version.zig
zig-out zig-out
core core
.zig-cache

View File

@ -1,9 +1,9 @@
AWS SDK for Zig AWS SDK for Zig
=============== ===============
[Zig 0.12](https://ziglang.org/download/#release-0.12.0): [Zig 0.13](https://ziglang.org/download/#release-0.13.0):
[![Build Status: Zig 0.12.0](https://git.lerch.org/lobo/aws-sdk-for-zig/actions/workflows/build.yaml/badge.svg)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=build.yaml&state=closed) [![Build Status: Zig 0.13.0](https://git.lerch.org/lobo/aws-sdk-for-zig/actions/workflows/build.yaml/badge.svg)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=build.yaml&state=closed)
[Last Mach Nominated Zig Version](https://machengine.org/about/nominated-zig/): [Last Mach Nominated Zig Version](https://machengine.org/about/nominated-zig/):
@ -19,27 +19,24 @@ in x86_linux, and will vary based on services used. Tested targets:
* x86_64-linux * x86_64-linux
* riscv64-linux\* * riscv64-linux\*
* aarch64-linux * aarch64-linux
* x86_64-windows\*\* * x86_64-windows
* arm-linux * arm-linux
* aarch64-macos * aarch64-macos
* x86_64-macos * x86_64-macos
Tested targets are built, but not continuously tested, by CI. Tested targets are built, but not continuously tested, by CI.
\* On Zig 0.12, riscv64-linux tests take a significant time to compile (each aws.zig test takes approximately 1min, 45 seconds to compile on Intel i9 10th gen) \* On Zig 0.12/0.13, riscv64-linux disabled due to [LLLM's O(N^2) codegen](https://github.com/ziglang/zig/issues/18872)
\*\* On Zig 0.12, x86_64-windows tests have one test skipped as LLVM consumes all available RAM on the system
Zig-Develop Branch Zig-Develop Branch
------------------ ------------------
This branch is intended for use with the in-development version of Zig. This This branch is intended for use with the in-development version of Zig. This
starts with 0.12.0-dev.3180+83e578a18. I will try to keep this branch up to date starts with 0.12.0-dev.3180+83e578a18. This is aligned with [Mach Engine's Nominated
with latest, but with a special eye towards aligning with [Mach Engine's Nominated Zig Versions](https://machengine.org/about/nominated-zig/). Nightly zig versions
Zig Versions](https://machengine.org/about/nominated-zig/). As nightly zig versions are difficult to keep up with and there is no special effort made there, build
disappear off the downloads page (and back end server), we can use the mirroring status is FYI (and used as a canary for nominated zig versions).
that the Mach Engine participates in to pull these versions.
Building Building
-------- --------
@ -52,7 +49,7 @@ project with the generated code. Testing can be done with `zig test`.
Using Using
----- -----
This is designed for use with the Zig 0.11 package manager, and exposes a module This is designed for use with the Zig package manager, and exposes a module
called "aws". Set up `build.zig.zon` and add the dependency/module to your project called "aws". Set up `build.zig.zon` and add the dependency/module to your project
as normal and the package manager should do its thing. A full example can be found as normal and the package manager should do its thing. A full example can be found
in [/example](example/README.md). in [/example](example/README.md).
@ -90,7 +87,7 @@ Services without TLS 1.3 support
All AWS services should support TLS 1.3 at this point, but there are many regions All AWS services should support TLS 1.3 at this point, but there are many regions
and several partitions, and not all of them have been tested, so your mileage and several partitions, and not all of them have been tested, so your mileage
may vary. may vary. If something doesn't work, please submit an issue to let others know.
Dependency tree Dependency tree
--------------- ---------------
@ -100,7 +97,6 @@ No dependencies:
* aws_http_base: contains basic structures for http requests/results * aws_http_base: contains basic structures for http requests/results
* case: provides functions to change casing * case: provides functions to change casing
* date: provides limited date manipulation functions * date: provides limited date manipulation functions
* http_client_17015_issue: zig 0.11 http client, with changes
* json: custom version of earlier stdlib json parser * json: custom version of earlier stdlib json parser
* xml: custom xml parser library * xml: custom xml parser library
* url: custom url encoding * url: custom url encoding
@ -109,7 +105,6 @@ aws_credentials: Allows credential handling
aws_authentication aws_authentication
aws_http: aws_http:
http_client_17015_issue
aws_http_base aws_http_base
aws_signing aws_signing

View File

@ -14,8 +14,10 @@ const test_targets = [_]std.zig.CrossTarget{
.cpu_arch = .aarch64, .cpu_arch = .aarch64,
.os_tag = .linux, .os_tag = .linux,
}, },
// // The test executable just spins forever in LLVM using nominated zig 0.12 March 2024 // The test executable linking process just spins forever in LLVM using nominated zig 0.13 May 2024
// // This is likely a LLVM problem unlikely to be fixed in zig 0.12 // This is likely a LLVM problem unlikely to be fixed in zig 0.13
// Potentially this issue: https://github.com/llvm/llvm-project/issues/81440
// Zig tracker: https://github.com/ziglang/zig/issues/18872
// .{ // .{
// .cpu_arch = .riscv64, // .cpu_arch = .riscv64,
// .os_tag = .linux, // .os_tag = .linux,
@ -72,7 +74,7 @@ pub fn build(b: *Builder) !void {
// It relies on code gen and is all fouled up when getting imported // It relies on code gen and is all fouled up when getting imported
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "demo", .name = "demo",
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -86,13 +88,13 @@ pub fn build(b: *Builder) !void {
// Expose module to others // Expose module to others
_ = b.addModule("aws", .{ _ = b.addModule("aws", .{
.root_source_file = .{ .path = "src/aws.zig" }, .root_source_file = b.path("src/aws.zig"),
.imports = &.{.{ .name = "smithy", .module = smithy_module }}, .imports = &.{.{ .name = "smithy", .module = smithy_module }},
}); });
// Expose module to others // Expose module to others
_ = b.addModule("aws-signing", .{ _ = b.addModule("aws-signing", .{
.root_source_file = .{ .path = "src/aws_signing.zig" }, .root_source_file = b.path("src/aws_signing.zig"),
.imports = &.{.{ .name = "smithy", .module = smithy_module }}, .imports = &.{.{ .name = "smithy", .module = smithy_module }},
}); });
// TODO: This does not work correctly due to https://github.com/ziglang/zig/issues/16354 // TODO: This does not work correctly due to https://github.com/ziglang/zig/issues/16354
@ -122,7 +124,7 @@ pub fn build(b: *Builder) !void {
const cg_exe = b.addExecutable(.{ const cg_exe = b.addExecutable(.{
.name = "codegen", .name = "codegen",
.root_source_file = .{ .path = "codegen/src/main.zig" }, .root_source_file = b.path("codegen/src/main.zig"),
// We need this generated for the host, not the real target // We need this generated for the host, not the real target
.target = b.host, .target = b.host,
.optimize = if (b.verbose) .Debug else .ReleaseSafe, .optimize = if (b.verbose) .Debug else .ReleaseSafe,
@ -197,7 +199,7 @@ pub fn build(b: *Builder) !void {
// Creates a step for unit testing. This only builds the test executable // Creates a step for unit testing. This only builds the test executable
// but does not run it. // but does not run it.
const unit_tests = b.addTest(.{ const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/aws.zig" }, .root_source_file = b.path("src/aws.zig"),
.target = b.resolveTargetQuery(t), .target = b.resolveTargetQuery(t),
.optimize = optimize, .optimize = optimize,
}); });

View File

@ -2,15 +2,17 @@
.name = "aws", .name = "aws",
.version = "0.0.1", .version = "0.0.1",
.paths = .{ .paths = .{
"build.zig", "build.zig",
"build.zig.zon", "build.zig.zon",
"src", "src",
"README.md",
"LICENSE.md",
}, },
.dependencies = .{ .dependencies = .{
.smithy = .{ .smithy = .{
.url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz", .url = "https://git.lerch.org/lobo/smithy/archive/6083ceefe262bb016033a7dfbd995968c86b48b2.tar.gz",
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad", .hash = "122036fbf9a1aae606de5e1a622d7dbbc37338d0fad7a4a018920c1365a1c49ba497",
}, },
.models = .{ .models = .{
.url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz", .url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz",

View File

@ -34,7 +34,7 @@ pub fn main() anyerror!void {
models_dir = try std.fs.cwd().openDir(args[i + 1], .{ .iterate = true }); models_dir = try std.fs.cwd().openDir(args[i + 1], .{ .iterate = true });
} }
// TODO: Seems like we should remove this in favor of a package // TODO: Seems like we should remove this in favor of a package
try output_dir.writeFile("json.zig", json_zig); try output_dir.writeFile(.{ .sub_path = "json.zig", .data = json_zig });
// TODO: We need a different way to handle this file... // TODO: We need a different way to handle this file...
const manifest_file_started = false; const manifest_file_started = false;
@ -123,11 +123,11 @@ fn processDirectories(models_dir: std.fs.Dir, output_dir: std.fs.Dir) !void {
// re-calculate so we can store the manifest // re-calculate so we can store the manifest
model_digest = calculated_manifest.model_dir_hash_digest; model_digest = calculated_manifest.model_dir_hash_digest;
calculated_manifest = try calculateDigests(models_dir, output_dir, &thread_pool); calculated_manifest = try calculateDigests(models_dir, output_dir, &thread_pool);
try output_dir.writeFile("output_manifest.json", try std.json.stringifyAlloc( try output_dir.writeFile(.{ .sub_path = "output_manifest.json", .data = try std.json.stringifyAlloc(
allocator, allocator,
calculated_manifest, calculated_manifest,
.{ .whitespace = .indent_2 }, .{ .whitespace = .indent_2 },
)); ) });
} }
var model_digest: ?[Hasher.hex_multihash_len]u8 = null; var model_digest: ?[Hasher.hex_multihash_len]u8 = null;

View File

@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void {
.name = "tmp", .name = "tmp",
// In this case the main source file is merely a path, however, in more // In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file. // complicated build scripts, this could be a generated file.
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -68,7 +68,7 @@ pub fn build(b: *std.Build) void {
// Creates a step for unit testing. This only builds the test executable // Creates a step for unit testing. This only builds the test executable
// but does not run it. // but does not run it.
const unit_tests = b.addTest(.{ const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });

View File

@ -5,12 +5,12 @@
.dependencies = .{ .dependencies = .{
.smithy = .{ .smithy = .{
.url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz", .url = "https://git.lerch.org/lobo/smithy/archive/6083ceefe262bb016033a7dfbd995968c86b48b2.tar.gz",
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad", .hash = "122036fbf9a1aae606de5e1a622d7dbbc37338d0fad7a4a018920c1365a1c49ba497",
}, },
.@"aws-zig" = .{ .@"aws-zig" = .{
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/a0773971f2f52182c8a5235582500d36afda2e81/a0773971f2f52182c8a5235582500d36afda2e81-with-models.tar.gz", .url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/3307eb6b8f04659c37df90162094427f15698161/3307eb6b8f04659c37df90162094427f15698161nominated-zig-with-models.tar.gz",
.hash = "1220198f7b734c1cc6a683ad13246439a59be934156a2df3a734bcaf15433b33eead", .hash = "122077dfab147124a5ddae1981a787a72bd5f823d30826e2d2147cf321a799feedf7",
}, },
}, },
} }

View File

@ -1904,7 +1904,6 @@ test "ec2_query_no_input: EC2 describe regions" {
// riscv64-linux also seems to have another problem with LLVM basically infinitely // riscv64-linux also seems to have another problem with LLVM basically infinitely
// doing something. My guess is the @embedFile is freaking out LLVM // doing something. My guess is the @embedFile is freaking out LLVM
test "ec2_query_with_input: EC2 describe instances" { test "ec2_query_with_input: EC2 describe instances" {
if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .windows) return error.SkipZigTest;
if (builtin.cpu.arch == .riscv64 and builtin.os.tag == .linux) return error.SkipZigTest; if (builtin.cpu.arch == .riscv64 and builtin.os.tag == .linux) return error.SkipZigTest;
const allocator = std.testing.allocator; const allocator = std.testing.allocator;
var test_harness = TestSetup.init(.{ var test_harness = TestSetup.init(.{

View File

@ -32,8 +32,8 @@ pub fn log(
const prefix = "[" ++ @tagName(level) ++ "] " ++ scope_prefix; const prefix = "[" ++ @tagName(level) ++ "] " ++ scope_prefix;
// Print the message to stderr, silently ignoring any errors // Print the message to stderr, silently ignoring any errors
std.debug.getStderrMutex().lock(); std.debug.lockStdErr();
defer std.debug.getStderrMutex().unlock(); defer std.debug.unlockStdErr();
const stderr = std.io.getStdErr().writer(); const stderr = std.io.getStdErr().writer();
nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return; nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return;
} }