Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: compact zig 0.13.0 #4

Merged
merged 1 commit into from
Dec 5, 2024
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
14 changes: 4 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches: ["master"]
pull_request:
branches: ["master"]
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
Expand All @@ -16,24 +14,20 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v2
# - uses: Hanaasagi/[email protected]
# with:
# cache-on-failure: false
with:
version: 0.13.0
- run: zig version
- run: zig env
- run: ls
- run: ls zig-cache || echo 'no zig-cache'
- run: rm -rf zig-cache/o/*/test
- name: Build
run: zig build --verbose
- name: Run Tests
run: zig build test
- name: Install kcov
run: sudo apt-get install -y kcov
- name: Generate coverage
run: kcov $PWD/kcov-out ./zig-cache/o/*/test
run: kcov $PWD/kcov-out ./.zig-cache/o/*/test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./kcov-out/test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/zig-out/
**/zig-cache/
**/kcov-out/
.zig-cache/
47 changes: 1 addition & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![codecov](https://codecov.io/gh/Hanaasagi/struct-env/branch/master/graph/badge.svg?token=DQQZETSCW3)](https://codecov.io/gh/Hanaasagi/struct-env)
![](https://img.shields.io/badge/language-zig-%23ec915c)

**NOTE: Minimum Supported Zig Version is 0.12.0-dev.2058+04ac028a2**
**NOTE: Supported Zig Version is 0.13.0**

## What is `struct-env`

Expand Down Expand Up @@ -88,51 +88,6 @@ defer struct_env.free(allocator, env);
- Optional types, such as `?u32`
- Slice types, such as `[][]const u8`

## Installation

Add `struct-env` as dependency in `build.zig.zon`:

```
.{
.name = "my-project",
.version = "0.1.0",
.dependencies = .{
.struct_env= .{
.url = "https://github.com/Hanaasagi/struct-env/archive/refs/tags/v0.2.0.tar.gz",
.hash = "1220224c50ca0178c6061fb96721fc331ed1136641ebb8a86cff55cc74481d66a4b9",
},
},
}
```

Expose `struct-env` as a module in `build.zig`:

```diff
diff --git a/build.zig b/build.zig
index 60fb4c2..0255ef3 100644
--- a/build.zig
+++ b/build.zig
@@ -15,6 +15,9 @@ pub fn build(b: *std.Build) void {
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});

+ const opts = .{ .target = target, .optimize = optimize };
+ const struct_env_module = b.dependency("struct_env", opts).module("struct-env");
+
const exe = b.addExecutable(.{
.name = "m",
// In this case the main source file is merely a path, however, in more
@@ -23,6 +26,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
+ exe.addModule("struct-env", struct_env_module);

// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default

```

## License

MIT
Expand Down
4 changes: 2 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void {
_ = dep_opts;

_ = b.addModule("struct-env", .{
.root_source_file = .{ .path = "src/lib.zig" },
.root_source_file = b.path("src/lib.zig"),
.imports = &.{},
});

Expand All @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void {
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_tests = b.addTest(.{
.root_source_file = .{ .path = "src/lib.zig" },
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "struct-env",
.version = "0.1.0",
.version = "0.1.1",
.dependencies = .{},
.paths = .{""},
}
Loading