Skip to content

Commit

Permalink
Merge pull request #52 from washingtonpost/develop
Browse files Browse the repository at this point in the history
v0.1.9
  • Loading branch information
freedmand authored Oct 14, 2022
2 parents 01b4473 + 18d32eb commit a0399db
Show file tree
Hide file tree
Showing 10 changed files with 534 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_python-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
os: [linux, macos, windows]
os: [linux-gnu, macos, windows]
architecture: [x86_64, aarch64]
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
os: [linux, macos, windows]
os: [linux-gnu, macos, windows]
architecture: [x86_64, aarch64]
include:
- os: wasm
Expand All @@ -33,7 +33,7 @@ jobs:
key: "${{ matrix.os }}"
map: |
{
"linux": {
"linux-gnu": {
"libExt": "so",
"libName": "libfastfec",
"exeExt": ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Test
on: [push]
on: [push, pull_request]
jobs:
test-c:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.6
0.1.9
30 changes: 18 additions & 12 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ const std = @import("std");
const builtin = @import("builtin");
const CrossTarget = std.zig.CrossTarget;

pub fn linkPcre(vendored_pcre: bool, libExe: *std.build.LibExeObjStep) void {
if (vendored_pcre) {
libExe.addCSourceFiles(&pcreSources, &buildOptions);
} else {
if (builtin.os.tag == .windows) {
libExe.linkSystemLibrary("pcre");
} else {
libExe.linkSystemLibrary("libpcre");
}
}
}

pub fn build(b: *std.build.Builder) !void {
b.setPreferredReleaseMode(.ReleaseFast);
const target = b.standardTargetOptions(.{});
Expand All @@ -10,6 +22,7 @@ pub fn build(b: *std.build.Builder) !void {
const lib_only: bool = b.option(bool, "lib-only", "Only compile the library") orelse false;
const skip_lib: bool = b.option(bool, "skip-lib", "Skip compiling the library") orelse false;
const wasm: bool = b.option(bool, "wasm", "Compile the wasm library") orelse false;
const vendored_pcre: bool = b.option(bool, "vendored-pcre", "Use vendored pcre") orelse true;

// Main build step
if (!lib_only and !wasm) {
Expand All @@ -21,7 +34,7 @@ pub fn build(b: *std.build.Builder) !void {
fastfec_cli.linkLibC();

fastfec_cli.addCSourceFiles(&libSources, &buildOptions);
fastfec_cli.addCSourceFiles(&pcreSources, &buildOptions);
linkPcre(vendored_pcre, fastfec_cli);
fastfec_cli.addCSourceFiles(&.{
"src/cli.c",
"src/main.c",
Expand All @@ -36,7 +49,7 @@ pub fn build(b: *std.build.Builder) !void {
fastfec_lib.install();
fastfec_lib.linkLibC();
fastfec_lib.addCSourceFiles(&libSources, &buildOptions);
fastfec_lib.addCSourceFiles(&pcreSources, &buildOptions);
linkPcre(vendored_pcre, fastfec_lib);
} else if (wasm) {
// Wasm library build step
const fastfec_wasm = b.addSharedLibrary("fastfec", null, .unversioned);
Expand All @@ -46,7 +59,7 @@ pub fn build(b: *std.build.Builder) !void {
fastfec_wasm.install();
fastfec_wasm.linkLibC();
fastfec_wasm.addCSourceFiles(&libSources, &buildOptions);
fastfec_wasm.addCSourceFiles(&pcreSources, &buildOptions);
linkPcre(vendored_pcre, fastfec_wasm);
fastfec_wasm.addCSourceFile("src/wasm.c", &buildOptions);
}

Expand All @@ -57,7 +70,7 @@ pub fn build(b: *std.build.Builder) !void {
const subtest_exe = b.addExecutable(base_file, null);
subtest_exe.linkLibC();
subtest_exe.addCSourceFiles(&testIncludes, &buildOptions);
subtest_exe.addCSourceFiles(&pcreSources, &buildOptions);
linkPcre(vendored_pcre, subtest_exe);
subtest_exe.addCSourceFile(test_file, &buildOptions);
const subtest_cmd = subtest_exe.run();
if (prev_test_step != null) {
Expand Down Expand Up @@ -102,14 +115,7 @@ const pcreSources = [_][]const u8{
"src/pcre/pcre_xclass.c",
};
const tests = [_][]const u8{ "src/buffer_test.c", "src/csv_test.c", "src/writer_test.c", "src/cli_test.c" };
const testIncludes = [_][]const u8{
"src/buffer.c",
"src/memory.c",
"src/encoding.c",
"src/csv.c",
"src/writer.c",
"src/cli.c"
};
const testIncludes = [_][]const u8{ "src/buffer.c", "src/memory.c", "src/encoding.c", "src/csv.c", "src/writer.c", "src/cli.c" };
const buildOptions = [_][]const u8{
"-std=c11",
"-pedantic",
Expand Down
4 changes: 2 additions & 2 deletions python/make_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

matrix = [
# (platform, Zig target, wheel)
("Linux", "x86_64-linux", "manylinux1_x86_64"),
("Linux", "aarch64-linux", "manylinux2014_aarch64"),
("Linux", "x86_64-linux-gnu", "manylinux1_x86_64"),
("Linux", "aarch64-linux-gnu", "manylinux2014_aarch64"),
("Darwin", "x86_64-macos", "macosx_10_9_x86_64"),
("Darwin", "aarch64-macos", "macosx_11_0_arm64"),
("Windows", "x86_64-windows", "win_amd64"),
Expand Down
7 changes: 7 additions & 0 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ def filing_1606847(get_fixture):
Returns the file path for 1606847.fec
"""
return get_fixture("1606847.fec")

@pytest.fixture
def filing_invalid_version(get_fixture):
"""
Returns the file path for filing_invalid_version.fec
"""
return get_fixture("filing_invalid_version.fec")
Loading

0 comments on commit a0399db

Please sign in to comment.