Skip to content

Commit

Permalink
Merge pull request #13 from Ashet-Technologies/init_ci
Browse files Browse the repository at this point in the history
First draft of CI workflow
  • Loading branch information
ikskuh authored Oct 11, 2024
2 parents 7b138e9 + 00ff391 commit bf27e70
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 20 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

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

jobs:
build:
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, windows-latest]
platform: [pc-bios, qemu-virt-rv32, qemu-virt-arm, hosted-x86-linux]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Build ${{ matrix.platform }}
run: |
zig build ${{ matrix.platform }}
- name: Upload disk image
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: zig-out/${{ matrix.platform }}
if-no-files-found: warn
retention-days: 7
4 changes: 2 additions & 2 deletions src/kernel/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
.hash = "1220ac855930db0699253dc81d3153c11b0d077e3ebe7a97b7986bea71db166eb76b",
},
.zfat = .{
.url = "https://github.com/ZigEmbeddedGroup/zfat/archive/6c9fcecd0326c8f3bf3353afbee6b3f5987d49ca.tar.gz",
.hash = "122064858e32ce4448b7c02813379658a74ebf85f026f9936fa627b1a40c3bb9cc39",
.url = "https://github.com/ZigEmbeddedGroup/zfat/archive/9644549c78d90f98b3921c12d760b0eaaaf219da.tar.gz",
.hash = "1220cca763cc3867e8b9fa2d1b0ff62236341698e37dd527f3815455429fc624e7e6",
},
.turtlefont = .{
.url = "https://github.com/ikskuh/turtlefont/archive/9d7d3879cda0fcbdbbf1574129aec75e2627429f.tar.gz",
Expand Down
4 changes: 2 additions & 2 deletions vendor/syslinux/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
.dependencies = .{
.zfat = .{
.url = "https://github.com/ZigEmbeddedGroup/zfat/archive/68dbbe19258b174fe4f374a91b4cc939019d9fe7.tar.gz",
.hash = "1220963601b9bc8dacc422d098368567e5c7b84d21f9ae73067fe3eb9c566aea02fd",
.url = "https://github.com/ZigEmbeddedGroup/zfat/archive/9644549c78d90f98b3921c12d760b0eaaaf219da.tar.gz",
.hash = "1220cca763cc3867e8b9fa2d1b0ff62236341698e37dd527f3815455429fc624e7e6",
},
},
}
31 changes: 15 additions & 16 deletions vendor/syslinux/fork/mtools_replacement.zig
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,18 @@ fn assert_path(disk_path: []const u8) void {
});
}

// From fatfs.h, should be moved to zfat module!
const AM_RDO: u8 = 0x01; // Read only
const AM_HID: u8 = 0x02; // Hidden
const AM_SYS: u8 = 0x04; // System
const AM_DIR: u8 = 0x10; // Directory
const AM_ARC: u8 = 0x20; // Archive

pub export fn mtools_flags_clear(maybe_disk_path: ?[*:0]const u8) bool {
const disk_path = get_string(maybe_disk_path);

if (!setup())
return false;
defer teardown();

std.log.warn("mtools_flags_clear('{}')", .{std.zig.fmtEscapes(disk_path)});
std.log.debug("mtools_flags_clear('{}')", .{std.zig.fmtEscapes(disk_path)});

assert_path(disk_path);

fatfs.chmod(disk_path[3..], 0x00, AM_RDO | AM_HID | AM_SYS) catch |err| {
fatfs.chmod(disk_path[3..], .{ .read_only = false, .hidden = false, .system = false }) catch |err| {
std.log.err("failed to clear flags for '{s}': {s}", .{ disk_path, @errorName(err) });
return false;
};
Expand All @@ -104,11 +97,11 @@ pub export fn mtools_flags_set(maybe_disk_path: ?[*:0]const u8) bool {
return false;
defer teardown();

std.log.warn("mtools_flags_set('{}')", .{std.zig.fmtEscapes(disk_path)});
std.log.debug("mtools_flags_set('{}')", .{std.zig.fmtEscapes(disk_path)});

assert_path(disk_path);

fatfs.chmod(disk_path[3..], AM_RDO | AM_HID | AM_SYS, AM_RDO | AM_HID | AM_SYS) catch |err| {
fatfs.chmod(disk_path[3..], .{ .read_only = true, .hidden = true, .system = true }) catch |err| {
std.log.err("failed to set flags for '{s}': {s}", .{ disk_path, @errorName(err) });
return false;
};
Expand All @@ -131,7 +124,7 @@ pub export fn mtools_create_file(
return false;
defer teardown();

std.log.warn("mtools_copy_file('{}', '{}', '{}')", .{
std.log.debug("mtools_copy_file('{}', '{}', '{}')", .{
std.zig.fmtEscapes(disk_path),
std.fmt.fmtSliceHexLower(data1),
std.fmt.fmtSliceHexLower(data2),
Expand Down Expand Up @@ -165,15 +158,21 @@ pub export fn mtools_move_file(maybe_disk_path_old: ?[*:0]const u8, maybe_disk_p
return false;
defer teardown();

assert_path(disk_path_old);
assert_path(disk_path_new);

std.log.warn("mtools_move_file('{}', '{}')", .{
std.log.debug("mtools_move_file('{}', '{}')", .{
std.zig.fmtEscapes(disk_path_old),
std.zig.fmtEscapes(disk_path_new),
});

return false;
assert_path(disk_path_old);
assert_path(disk_path_new);

fatfs.rename(disk_path_old, disk_path_new) catch |err| {
std.log.err("failed to move file from '{s}' to '{s}': {s}", .{ disk_path_old, disk_path_new, @errorName(err) });
return false;
};

return true ;
}

fn disk_getStatus(intf: *fatfs.Disk) fatfs.Disk.Status {
Expand Down

0 comments on commit bf27e70

Please sign in to comment.