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
uses: https://git.lerch.org/lobo/setup-zig@v3
with:
version: 0.12.0
version: 0.13.0
- name: Run tests
run: zig build test --verbose
# Zig package manager expects everything to be inside a directory in the archive,

View File

@ -7,8 +7,7 @@ on:
branches:
- 'zig-develop*'
env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
PKG_PREFIX: nominated-zig
jobs:
build-zig-nominated-mach-latest:
runs-on: ubuntu-latest
@ -25,6 +24,8 @@ jobs:
uses: https://git.lerch.org/lobo/setup-zig@v3
with:
version: mach-latest
- name: Run tests
run: zig build test --verbose
# 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
# 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
- name: Package source code with generated models
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 \
--exclude 'zig-*' \
--transform 's,^,${{ github.sha }}/,' *
@ -58,8 +59,8 @@ jobs:
- name: Publish source code with generated models
run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--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
--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
- name: Build example
run: ( cd example && zig build ) # Make sure example builds
- name: Notify

View File

@ -7,8 +7,7 @@ on:
branches:
- 'zig-develop*'
env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
PKG_PREFIX: nightly-zig
jobs:
build-zig-nightly:
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
- name: Package source code with generated models
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 \
--exclude 'zig-*' \
--transform 's,^,${{ github.sha }}/,' *
@ -60,8 +59,8 @@ jobs:
- name: Publish source code with generated models
run: |
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--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
--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
- name: Build example
run: ( cd example && zig build ) # Make sure example builds
- name: Notify

1
.gitignore vendored
View File

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

View File

@ -1,9 +1,9 @@
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/):
@ -19,27 +19,24 @@ in x86_linux, and will vary based on services used. Tested targets:
* x86_64-linux
* riscv64-linux\*
* aarch64-linux
* x86_64-windows\*\*
* x86_64-windows
* arm-linux
* aarch64-macos
* x86_64-macos
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, x86_64-windows tests have one test skipped as LLVM consumes all available RAM on the system
\* On Zig 0.12/0.13, riscv64-linux disabled due to [LLLM's O(N^2) codegen](https://github.com/ziglang/zig/issues/18872)
Zig-Develop Branch
------------------
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
with latest, but with a special eye towards aligning with [Mach Engine's Nominated
Zig Versions](https://machengine.org/about/nominated-zig/). As nightly zig versions
disappear off the downloads page (and back end server), we can use the mirroring
that the Mach Engine participates in to pull these versions.
starts with 0.12.0-dev.3180+83e578a18. This is aligned with [Mach Engine's Nominated
Zig Versions](https://machengine.org/about/nominated-zig/). Nightly zig versions
are difficult to keep up with and there is no special effort made there, build
status is FYI (and used as a canary for nominated zig versions).
Building
--------
@ -52,7 +49,7 @@ project with the generated code. Testing can be done with `zig test`.
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
as normal and the package manager should do its thing. A full example can be found
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
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
---------------
@ -100,7 +97,6 @@ No dependencies:
* aws_http_base: contains basic structures for http requests/results
* case: provides functions to change casing
* 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
* xml: custom xml parser library
* url: custom url encoding
@ -109,7 +105,6 @@ aws_credentials: Allows credential handling
aws_authentication
aws_http:
http_client_17015_issue
aws_http_base
aws_signing

View File

@ -14,8 +14,10 @@ const test_targets = [_]std.zig.CrossTarget{
.cpu_arch = .aarch64,
.os_tag = .linux,
},
// // The test executable just spins forever in LLVM using nominated zig 0.12 March 2024
// // This is likely a LLVM problem unlikely to be fixed in zig 0.12
// 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.13
// Potentially this issue: https://github.com/llvm/llvm-project/issues/81440
// Zig tracker: https://github.com/ziglang/zig/issues/18872
// .{
// .cpu_arch = .riscv64,
// .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
const exe = b.addExecutable(.{
.name = "demo",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
@ -86,13 +88,13 @@ pub fn build(b: *Builder) !void {
// Expose module to others
_ = b.addModule("aws", .{
.root_source_file = .{ .path = "src/aws.zig" },
.root_source_file = b.path("src/aws.zig"),
.imports = &.{.{ .name = "smithy", .module = smithy_module }},
});
// Expose module to others
_ = 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 }},
});
// 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(.{
.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
.target = b.host,
.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
// but does not run it.
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/aws.zig" },
.root_source_file = b.path("src/aws.zig"),
.target = b.resolveTargetQuery(t),
.optimize = optimize,
});

View File

@ -5,12 +5,14 @@
"build.zig",
"build.zig.zon",
"src",
"README.md",
"LICENSE.md",
},
.dependencies = .{
.smithy = .{
.url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz",
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
.url = "https://git.lerch.org/lobo/smithy/archive/6083ceefe262bb016033a7dfbd995968c86b48b2.tar.gz",
.hash = "122036fbf9a1aae606de5e1a622d7dbbc37338d0fad7a4a018920c1365a1c49ba497",
},
.models = .{
.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 });
}
// 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...
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
model_digest = calculated_manifest.model_dir_hash_digest;
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,
calculated_manifest,
.{ .whitespace = .indent_2 },
));
) });
}
var model_digest: ?[Hasher.hex_multihash_len]u8 = null;

View File

@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void {
.name = "tmp",
// In this case the main source file is merely a path, however, in more
// 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,
.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
// but does not run it.
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});

View File

@ -5,12 +5,12 @@
.dependencies = .{
.smithy = .{
.url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz",
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
.url = "https://git.lerch.org/lobo/smithy/archive/6083ceefe262bb016033a7dfbd995968c86b48b2.tar.gz",
.hash = "122036fbf9a1aae606de5e1a622d7dbbc37338d0fad7a4a018920c1365a1c49ba497",
},
.@"aws-zig" = .{
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/a0773971f2f52182c8a5235582500d36afda2e81/a0773971f2f52182c8a5235582500d36afda2e81-with-models.tar.gz",
.hash = "1220198f7b734c1cc6a683ad13246439a59be934156a2df3a734bcaf15433b33eead",
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/3307eb6b8f04659c37df90162094427f15698161/3307eb6b8f04659c37df90162094427f15698161nominated-zig-with-models.tar.gz",
.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
// doing something. My guess is the @embedFile is freaking out LLVM
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;
const allocator = std.testing.allocator;
var test_harness = TestSetup.init(.{

View File

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