Skip to content

Commit a501a06

Browse files
committed
fix(ci)!: remove zig 0.14.0 from CI
1 parent 88e10b0 commit a501a06

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
uses: actions/checkout@v3
2626
- name: Setup Pages
2727
uses: actions/configure-pages@v5
28-
- uses: mlugg/setup-zig@v1
28+
- uses: mlugg/setup-zig@v2
2929
with:
30-
version: 0.15.0-dev.1034+bd97b6618
30+
version: master
3131
- run: make docs
3232
- name: Upload artifact
3333
uses: actions/upload-pages-artifact@v3

.github/workflows/tests.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, macos-latest, windows-latest]
14-
zig: ["0.14.0", "0.15.0-dev.1034+bd97b6618"]
1514

1615
runs-on: ${{matrix.os}}
1716

@@ -20,9 +19,9 @@ jobs:
2019
uses: actions/checkout@v3
2120

2221
- name: Setup Zig
23-
uses: mlugg/setup-zig@v1
22+
uses: mlugg/setup-zig@v2
2423
with:
25-
version: ${{ matrix.zig }}
24+
version: master
2625

2726
- name: Run tests
2827
run: make test
@@ -31,7 +30,6 @@ jobs:
3130
strategy:
3231
matrix:
3332
os: [ubuntu-latest, macos-latest, windows-latest]
34-
zig: ["0.14.0", "0.15.0-dev.1034+bd97b6618"]
3533

3634
runs-on: ${{matrix.os}}
3735

@@ -40,9 +38,9 @@ jobs:
4038
uses: actions/checkout@v3
4139

4240
- name: Setup Zig
43-
uses: mlugg/setup-zig@v1
41+
uses: mlugg/setup-zig@v2
4442
with:
45-
version: ${{ matrix.zig }}
43+
version: master
4644

4745
- name: Run tests
4846
run: make test_cross

build/patch.zig

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ pub fn main() !void {
1717
const patch_file = patch_file: {
1818
const patch_file = try std.fs.cwd().openFile(patch_file_path, .{ .mode = .read_only });
1919
defer patch_file.close();
20-
var patch_buf: [4096]u8 = undefined;
21-
var reader = patch_file.reader(&patch_buf);
22-
break :patch_file try reader.interface.allocRemaining(allocator, .unlimited);
20+
break :patch_file try patch_file.readToEndAlloc(allocator, std.math.maxInt(usize));
2321
};
2422
const chunk_details = Chunk.init(allocator, patch_file, 0) orelse @panic("No chunk data found");
2523

@@ -41,35 +39,26 @@ pub fn main() !void {
4139

4240
switch (state) {
4341
.copy => {
44-
_ = try reader.interface.streamDelimiterEnding(&writer.interface, '\n');
45-
_ = reader.interface.takeByte() catch |err| switch (err) {
42+
_ = reader.interface.streamDelimiter(&writer.interface, '\n') catch |err| switch (err) {
4643
error.EndOfStream => {
4744
try writer.end();
4845
return;
4946
},
5047
else => return err,
5148
};
49+
reader.interface.toss(1);
5250
try writer.interface.writeByte('\n');
5351
},
5452
.chunk => {
5553
const chunk = chunk_details.lines[line_number - chunk_details.src];
5654
switch (chunk.action) {
5755
.remove => {
58-
const line = reader.interface.takeDelimiterExclusive('\n') catch |err| switch (err) {
59-
error.EndOfStream => return,
60-
else => return err,
61-
};
56+
const line = try reader.interface.takeDelimiterExclusive('\n');
6257
if (!std.mem.eql(u8, chunk.buf, line)) @panic("Failed to apply patch");
6358
},
6459
.keep => {
65-
const line = reader.interface.takeDelimiterExclusive('\n') catch |err| switch (err) {
66-
error.EndOfStream => return,
67-
else => return err,
68-
};
69-
if (!std.mem.eql(u8, chunk.buf, line)) {
70-
std.debug.print("exp {s}\ngot {s}\n", .{ chunk.buf, line });
71-
@panic("Failed to apply patch");
72-
}
60+
const line = try reader.interface.takeDelimiterExclusive('\n');
61+
if (!std.mem.eql(u8, chunk.buf, line)) @panic("Failed to apply patch");
7362
try writer.interface.writeAll(line);
7463
try writer.interface.writeByte('\n');
7564
},
@@ -85,14 +74,6 @@ pub fn main() !void {
8574
}
8675
}
8776

88-
fn getLine(allocator: Allocator, file: File) ?[]u8 {
89-
var buffer: [4096]u8 = undefined;
90-
return file.reader(&buffer).readUntilDelimiterAlloc(allocator, '\n', std.math.maxInt(usize)) catch |err| switch (err) {
91-
error.EndOfStream => return null,
92-
else => @panic("Error"),
93-
};
94-
}
95-
9677
const State = enum { copy, chunk };
9778

9879
const Chunk = struct {

0 commit comments

Comments
 (0)