Skip to content

Commit

Permalink
Merge branch 'improve-test-targets'
Browse files Browse the repository at this point in the history
  • Loading branch information
vrischmann committed Apr 16, 2024
2 parents 94572e7 + 31ecdc8 commit f411f37
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 124 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Setup zig
uses: goto-bus-stop/setup-zig@v2
Expand All @@ -60,14 +58,21 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
run: zig build test -Dci=true -Din_memory=true --summary all -fqemu -fwine
- name: Run Tests in memory
if: ${{ matrix.os == 'macos-latest' }}
run: zig build test -Dci=true -Din_memory=true --summary all -frosetta
- name: Run Tests in memory
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.os != 'ubuntu-latest' }}
run: zig build test -Dci=true -Din_memory=true --summary all

test-loadable-extension:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup zig
uses: goto-bus-stop/setup-zig@v2
with:
version: master

- name: Build the example zigcrypto loadable extension
run: zig build zigcrypto
- name: Test the zigcrypto loadable extension
if: ${{ matrix.os != 'windows-latest' }}
run: ./zig-out/bin/zigcrypto-test
143 changes: 26 additions & 117 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ci_targets = switch (builtin.target.cpu.arch) {
TestTarget{ .query = .{ .cpu_arch = .x86, .abi = .gnu }, .bundled = true },
},
.macos => [_]TestTarget{
TestTarget{ .query = .{ .cpu_arch = .aarch64 }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .x86_64 }, .bundled = true },
},
else => unreachable,
},
Expand All @@ -54,134 +54,43 @@ const ci_targets = switch (builtin.target.cpu.arch) {
const all_test_targets = switch (builtin.target.cpu.arch) {
.x86_64 => switch (builtin.target.os.tag) {
.linux => [_]TestTarget{
// Targets linux but other CPU archs.
TestTarget{
.query = .{},
.bundled = false,
},
TestTarget{
.query = .{
.cpu_arch = .x86_64,
.abi = .musl,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .x86,
.abi = .musl,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .aarch64,
.abi = .musl,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .riscv64,
.abi = .musl,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .mips,
.abi = .musl,
},
.bundled = true,
},
// TODO(vincent): failing for some time for unknown reasons
// TestTarget{
// .query =.{
// .cpu_arch = .arm,
// .abi = .musleabihf,
// },
// .bundled = true,
// },
// Targets windows
TestTarget{
.query = .{
.cpu_arch = .x86_64,
.os_tag = .windows,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .x86,
.os_tag = .windows,
},
.bundled = true,
},
// Targets macOS
TestTarget{
.query = .{
.cpu_arch = .x86_64,
.os_tag = .macos,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .aarch64,
.os_tag = .macos,
},
.bundled = true,
},
TestTarget{ .query = .{}, .bundled = false },
TestTarget{ .query = .{ .cpu_arch = .x86_64, .abi = .musl }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .x86, .abi = .musl }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .aarch64, .abi = .musl }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .riscv64, .abi = .musl }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .mips, .abi = .musl }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .x86_64, .os_tag = .windows }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .x86, .os_tag = .windows }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .x86_64, .os_tag = .macos }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .aarch64, .os_tag = .macos }, .bundled = true },
},
.windows => [_]TestTarget{
TestTarget{
.query = .{
.cpu_arch = .x86_64,
.abi = .gnu,
},
.bundled = true,
},
TestTarget{
.query = .{
.cpu_arch = .x86,
.abi = .gnu,
},
.bundled = true,
},
TestTarget{ .query = .{ .cpu_arch = .x86_64, .abi = .gnu }, .bundled = true },
TestTarget{ .query = .{ .cpu_arch = .x86, .abi = .gnu }, .bundled = true },
},
.freebsd => [_]TestTarget{
TestTarget{
.query = .{},
.bundled = false,
},
TestTarget{
.query = .{
.cpu_arch = .x86_64,
},
.bundled = true,
},
TestTarget{ .query = .{}, .bundled = false },
TestTarget{ .query = .{ .cpu_arch = .x86_64 }, .bundled = true },
},
.macos => [_]TestTarget{
TestTarget{
.query = .{
.cpu_arch = .x86_64,
},
.bundled = true,
},
TestTarget{ .query = .{ .cpu_arch = .x86_64 }, .bundled = true },
},
else => [_]TestTarget{
TestTarget{
.query = .{},
.bundled = false,
},
TestTarget{ .query = .{}, .bundled = false },
},
},
else => [_]TestTarget{
TestTarget{
.query = .{},
.bundled = false,
.aarch64 => switch (builtin.target.os.tag) {
.linux, .windows, .freebsd, .macos => [_]TestTarget{
TestTarget{ .query = .{}, .bundled = true },
},
else => [_]TestTarget{
TestTarget{ .query = .{}, .bundled = false },
},
},
else => [_]TestTarget{
TestTarget{ .query = .{}, .bundled = false },
},
};

fn computeTestTargets(isNative: bool, ci: ?bool) ?[]const TestTarget {
Expand Down

0 comments on commit f411f37

Please sign in to comment.