Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: mlugg/setup-zig@v2
with:
version: "0.16.0"

- name: Build
run: zig build

- name: Build examples
run: zig build examples

- name: Build docs
run: zig build docs

- name: Run tests
run: zig build test
20 changes: 11 additions & 9 deletions src/serial.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ extern "kernel32" fn GetCommState(hFile: std.os.windows.HANDLE, lpDCB: *DCB) cal
extern "kernel32" fn SetCommState(hFile: std.os.windows.HANDLE, lpDCB: *DCB) callconv(.winapi) std.os.windows.BOOL;

test "iterate ports" {
var it = try list();
var it = try list(std.testing.io);
while (try it.next()) |port| {
_ = port;
// std.debug.print("{s} (file: {s}, driver: {s})\n", .{ port.display_name, port.file_name, port.driver });
Expand All @@ -1178,10 +1178,11 @@ test "basic configuration test" {
else => unreachable,
}

var threaded = Io.Threaded.init_single_threaded;
const io = threaded.io();
var port = try std.Io.Dir.openFileAbsolute(io, tty, .{ .mode = .read_write });
defer port.close(io);
var port = std.Io.Dir.openFileAbsolute(std.testing.io, tty, .{ .mode = .read_write }) catch |err| switch(err) {
error.FileNotFound => return error.SkipZigTest,
else => |e| return e,
};
defer port.close(std.testing.io);

try configureSerialPort(port, cfg);
}
Expand All @@ -1195,10 +1196,11 @@ test "basic flush test" {
.macos => tty = "/dev/cu.usbmodem101",
else => unreachable,
}
var threaded = Io.Threaded.init_single_threaded;
const io = threaded.io();
var port = try std.Io.Dir.openFileAbsolute(io, tty, .{ .mode = .read_write });
defer port.close(io);
var port = std.Io.Dir.openFileAbsolute(std.testing.io, tty, .{ .mode = .read_write }) catch |err| switch(err) {
error.FileNotFound => return error.SkipZigTest,
else => |e| return e,
};
defer port.close(std.testing.io);

try flushSerialPort(port, .both);
try flushSerialPort(port, .input);
Expand Down
Loading