clean up build (includes two fixes for arm 32 bit)
All checks were successful
AWS-Zig Build / build-zig-0.11.0-amd64-host (push) Successful in 5m38s
All checks were successful
AWS-Zig Build / build-zig-0.11.0-amd64-host (push) Successful in 5m38s
This commit is contained in:
parent
90e690ffc2
commit
14666da73f
|
@ -22,24 +22,28 @@ jobs:
|
||||||
#
|
#
|
||||||
# However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
|
# However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
|
||||||
# TODO: https://github.com/ziglang/zig/issues/2443
|
# TODO: https://github.com/ziglang/zig/issues/2443
|
||||||
- run: wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
- name: Install zig
|
||||||
- run: tar x -C /usr/local -f zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
run: |
|
||||||
- run: ln -s /usr/local/zig-linux-${ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig
|
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
||||||
- run: zig build test --verbose
|
tar x -C /usr/local -f zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
||||||
- run: zig build --verbose -Dtarget=arm-linux
|
ln -s /usr/local/zig-linux-${ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig
|
||||||
- run: zig build -Dtarget=x86_64-windows
|
- name: Run tests
|
||||||
- run: zig build -Dtarget=aarch64-linux
|
run: zig build test --verbose
|
||||||
- run: zig build -Dtarget=riscv64-linux
|
- name: Build example
|
||||||
- run: zig build -Dtarget=x86_64-macos
|
run: ( cd example && zig build ) # Make sure example builds
|
||||||
- run: zig build -Dtarget=aarch64-macos
|
|
||||||
- run: ( cd example && zig build ) # Make sure example builds
|
|
||||||
# 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
|
||||||
#
|
#
|
||||||
# Also, zig tar process doesn't handle gnu format for long names, nor does it seam to
|
# Also, zig tar process doesn't handle gnu format for long names, nor does it seam to
|
||||||
# handle posix long name semantics cleanly either. Let's try ustar
|
# handle posix long name semantics cleanly either. ustar works. This
|
||||||
- run: tar -czf ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz --format ustar --exclude 'zig-*' --transform 's,^,${{ github.sha }}/,' *
|
# 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 \
|
||||||
|
--format ustar \
|
||||||
|
--exclude 'zig-*' \
|
||||||
|
--transform 's,^,${{ github.sha }}/,' *
|
||||||
# - name: Sign
|
# - name: Sign
|
||||||
# id: sign
|
# id: sign
|
||||||
# uses: https://git.lerch.org/lobo/action-hsm-sign@v1
|
# uses: https://git.lerch.org/lobo/action-hsm-sign@v1
|
||||||
|
@ -57,13 +61,11 @@ jobs:
|
||||||
# - run: |
|
# - run: |
|
||||||
# echo "Signature 1 should be ./foo.sig: ${{ steps.sign.outputs.SIG_1 }}"
|
# echo "Signature 1 should be ./foo.sig: ${{ steps.sign.outputs.SIG_1 }}"
|
||||||
# - 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: Upload
|
- name: Publish source code with generated models
|
||||||
uses: actions/upload-artifact@v3
|
run: |
|
||||||
with:
|
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
|
||||||
name: ${{ github.sha }}-with-models.tar.gz
|
--upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \
|
||||||
path: '${{ 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
|
||||||
- name: Publish
|
|
||||||
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'
|
|
||||||
- name: Notify
|
- name: Notify
|
||||||
uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
|
uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
|
||||||
if: always()
|
if: always()
|
||||||
|
|
83
build.zig
83
build.zig
|
@ -8,6 +8,42 @@ const models_hash: ?[]const u8 = "1220a414719bff14c9362fb1c695e3346fa12ec2e728ba
|
||||||
const models_subdir = "codegen/sdk-codegen/aws-models/"; // note will probably not work on windows
|
const models_subdir = "codegen/sdk-codegen/aws-models/"; // note will probably not work on windows
|
||||||
const models_dir = "p" ++ std.fs.path.sep_str ++ (models_hash orelse "") ++ std.fs.path.sep_str ++ models_subdir;
|
const models_dir = "p" ++ std.fs.path.sep_str ++ (models_hash orelse "") ++ std.fs.path.sep_str ++ models_subdir;
|
||||||
|
|
||||||
|
const test_targets = [_]std.zig.CrossTarget{
|
||||||
|
.{}, // native
|
||||||
|
.{
|
||||||
|
.cpu_arch = .x86_64,
|
||||||
|
.os_tag = .linux,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.cpu_arch = .aarch64,
|
||||||
|
.os_tag = .linux,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.cpu_arch = .riscv64,
|
||||||
|
.os_tag = .linux,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.cpu_arch = .arm,
|
||||||
|
.os_tag = .linux,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.cpu_arch = .x86_64,
|
||||||
|
.os_tag = .windows,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.cpu_arch = .aarch64,
|
||||||
|
.os_tag = .macos,
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.cpu_arch = .x86_64,
|
||||||
|
.os_tag = .macos,
|
||||||
|
},
|
||||||
|
// .{
|
||||||
|
// .cpu_arch = .wasm32,
|
||||||
|
// .os_tag = .wasi,
|
||||||
|
// },
|
||||||
|
};
|
||||||
|
|
||||||
pub fn build(b: *Builder) !void {
|
pub fn build(b: *Builder) !void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// what target to build for. Here we do not override the defaults, which
|
||||||
|
@ -82,27 +118,10 @@ pub fn build(b: *Builder) !void {
|
||||||
const run_step = b.step("run", "Run the app");
|
const run_step = b.step("run", "Run the app");
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
|
|
||||||
// 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" },
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
unit_tests.addModule("smithy", smithy_dep.module("smithy"));
|
|
||||||
|
|
||||||
const run_unit_tests = b.addRunArtifact(unit_tests);
|
|
||||||
|
|
||||||
// Similar to creating the run step earlier, this exposes a `test` step to
|
|
||||||
// the `zig build --help` menu, providing a way for the user to request
|
|
||||||
// running the unit tests.
|
|
||||||
const test_step = b.step("test", "Run unit tests");
|
|
||||||
test_step.dependOn(&run_unit_tests.step);
|
|
||||||
|
|
||||||
const fm = b.step("fetch", "Fetch model files");
|
const fm = b.step("fetch", "Fetch model files");
|
||||||
var fetch_step = FetchStep.create(b, models_url, models_hash);
|
var fetch_step = FetchStep.create(b, models_url, models_hash);
|
||||||
fm.dependOn(&fetch_step.step);
|
fm.dependOn(&fetch_step.step);
|
||||||
{
|
const gen_step = blk: {
|
||||||
const cg = b.step("gen", "Generate zig service code from smithy models");
|
const cg = b.step("gen", "Generate zig service code from smithy models");
|
||||||
|
|
||||||
const cg_exe = b.addExecutable(.{
|
const cg_exe = b.addExecutable(.{
|
||||||
|
@ -139,10 +158,32 @@ pub fn build(b: *Builder) !void {
|
||||||
// later about warning on manual changes...
|
// later about warning on manual changes...
|
||||||
|
|
||||||
cg.dependOn(&cg_cmd.step);
|
cg.dependOn(&cg_cmd.step);
|
||||||
exe.step.dependOn(cg);
|
break :blk cg;
|
||||||
unit_tests.step.dependOn(cg);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
exe.step.dependOn(gen_step);
|
||||||
|
|
||||||
|
// Similar to creating the run step earlier, this exposes a `test` step to
|
||||||
|
// the `zig build --help` menu, providing a way for the user to request
|
||||||
|
// running the unit tests.
|
||||||
|
const test_step = b.step("test", "Run unit tests");
|
||||||
|
|
||||||
|
for (test_targets) |t| {
|
||||||
|
// 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" },
|
||||||
|
.target = t,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
unit_tests.addModule("smithy", smithy_dep.module("smithy"));
|
||||||
|
unit_tests.step.dependOn(gen_step);
|
||||||
|
|
||||||
|
const run_unit_tests = b.addRunArtifact(unit_tests);
|
||||||
|
run_unit_tests.skip_foreign_checks = true;
|
||||||
|
|
||||||
|
test_step.dependOn(&run_unit_tests.step);
|
||||||
|
}
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
}
|
}
|
||||||
const FetchStep = struct {
|
const FetchStep = struct {
|
||||||
|
|
|
@ -1433,7 +1433,7 @@ fn processRequest(options: *TestOptions, server: *std.http.Server) !void {
|
||||||
|
|
||||||
options.requests_processed += 1;
|
options.requests_processed += 1;
|
||||||
if (res.request.content_length) |l|
|
if (res.request.content_length) |l|
|
||||||
options.request_body = try res.reader().readAllAlloc(options.allocator, @as(usize, l))
|
options.request_body = try res.reader().readAllAlloc(options.allocator, @as(usize, @intCast(l)))
|
||||||
else
|
else
|
||||||
options.request_body = try options.allocator.dupe(u8, "");
|
options.request_body = try options.allocator.dupe(u8, "");
|
||||||
options.request_method = res.request.method;
|
options.request_method = res.request.method;
|
||||||
|
|
|
@ -367,7 +367,7 @@ pub fn fuzzyEqual(a: []const u8, b: []const u8, options: xml.PredicateOptions) !
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalize(val: []u8) []u8 {
|
fn normalize(val: []u8) []u8 {
|
||||||
var underscores: u64 = 0;
|
var underscores: usize = 0;
|
||||||
for (val, 0..) |ch, i| {
|
for (val, 0..) |ch, i| {
|
||||||
if (ch == '_') {
|
if (ch == '_') {
|
||||||
underscores = underscores + 1;
|
underscores = underscores + 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user