From 6a7b59bbe8e72b5b4d8fb13b9d58ccc28c89800b Mon Sep 17 00:00:00 2001 From: Will Medrano Date: Wed, 11 Sep 2024 07:42:54 -0700 Subject: [PATCH 1/4] Add unit tests to CI. --- .github/workflows/site.yml | 9 +++------ .github/workflows/test.yml | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 514465e..09589ed 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -2,7 +2,7 @@ name: publish_site on: push: - branches: ["main"] + tags: ['v*.*.*'] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -23,8 +23,7 @@ concurrency: cancel-in-progress: false jobs: - # Build job - build: + build-site: runs-on: ubuntu-latest steps: - name: Checkout @@ -49,9 +48,7 @@ jobs: uses: actions/upload-pages-artifact@v3 with: path: ./site/_site - - # Deployment job - deploy: + deploy-site: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b537134 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: test +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: goto-bus-stop/setup-zig@v2 + - run: zig build test + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: goto-bus-stop/setup-zig@v2 + - run: zig fmt --check . From c8167011329c34a00c4233b08fd3aa0182befe2b Mon Sep 17 00:00:00 2001 From: Will Medrano Date: Wed, 11 Sep 2024 07:51:24 -0700 Subject: [PATCH 2/4] Pin to zig version 0.13.0. --- .github/workflows/test.yml | 14 +++++++------- src/Vm.zig | 2 -- src/datastructures/ErrorCollector.zig | 6 ------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b537134..948d260 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,10 +11,10 @@ jobs: steps: - uses: actions/checkout@v2 - uses: goto-bus-stop/setup-zig@v2 - - run: zig build test - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: goto-bus-stop/setup-zig@v2 - - run: zig fmt --check . + with: + zig-version: 0.13.0 + - name: test + run: zig build test + - name: lint + run: zig fmt --check . + if: always() diff --git a/src/Vm.zig b/src/Vm.zig index 0cbab9f..ec63b32 100644 --- a/src/Vm.zig +++ b/src/Vm.zig @@ -287,7 +287,6 @@ pub fn evalNoReset(self: *Vm, func: Val, args: []const Val) Error!Val { self.env.stack.items = self.env.stack.items[0..stack_start]; return ret; } else { - @setCold(true); return .none; } }, @@ -406,7 +405,6 @@ fn executeDefine(self: *Vm, symbol: Symbol) Error!void { } fn errSymbolNotFound(self: *Vm, sym: Symbol) Error { - @setCold(true); const name = self.env.memory_manager.symbols.getName(sym) orelse "*unknown-symbol*"; try self.env.errors.addError( "Symbol {s} (id={d}) not found in global values", diff --git a/src/datastructures/ErrorCollector.zig b/src/datastructures/ErrorCollector.zig index 4e3c4ad..ae5c207 100644 --- a/src/datastructures/ErrorCollector.zig +++ b/src/datastructures/ErrorCollector.zig @@ -4,25 +4,21 @@ const std = @import("std"); errors: std.ArrayList([]const u8), pub fn init(alloc: std.mem.Allocator) ErrorCollector { - @setCold(true); return .{ .errors = std.ArrayList([]const u8).init(alloc), }; } pub fn deinit(self: *ErrorCollector) void { - @setCold(true); self.clear(); self.errors.deinit(); } pub fn allocator(self: *ErrorCollector) std.mem.Allocator { - @setCold(true); return self.errors.allocator; } pub fn clear(self: *ErrorCollector) void { - @setCold(true); for (self.errors.items) |msg| { self.errors.allocator.free(msg); } @@ -30,13 +26,11 @@ pub fn clear(self: *ErrorCollector) void { } pub fn addError(self: *ErrorCollector, comptime fmt: []const u8, args: anytype) !void { - @setCold(true); const msg = try std.fmt.allocPrint(self.allocator(), fmt, args); try self.errors.append(msg); } pub fn format(self: *const ErrorCollector, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { - @setCold(true); for (self.errors.items) |err| { try writer.print("{s}\n", .{err}); } From 326243d11608b527e75333ac4ff720cbd9fb5458 Mon Sep 17 00:00:00 2001 From: Will Medrano Date: Wed, 11 Sep 2024 07:53:46 -0700 Subject: [PATCH 3/4] Fix yml --- .github/workflows/test.yml | 2 +- site/index.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 948d260..ba2f079 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 - uses: goto-bus-stop/setup-zig@v2 with: - zig-version: 0.13.0 + version: 0.13.0 - name: test run: zig build test - name: lint diff --git a/site/index.md b/site/index.md index 4c2aad8..e7bc49c 100644 --- a/site/index.md +++ b/site/index.md @@ -10,6 +10,9 @@ nav_order: 0 Fizz is a **simple** interpretted programming language meant for **embedding in Zig**. +{: .warning} +> Requires Zig 0.13.0 + {: .warning} > Fizz is not yet in a stable state. If you have a use case that you would like > handled, file an [🪲 issue](https://github.com/wmedrano/fizz/issues). From 299d2a12c0cdce4a3142455ea2afe0819b35929d Mon Sep 17 00:00:00 2001 From: Will Medrano Date: Wed, 11 Sep 2024 08:00:24 -0700 Subject: [PATCH 4/4] Fix website deploy. --- .github/workflows/site.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 09589ed..1d6e4a9 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -53,7 +53,7 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - needs: build + needs: build-site steps: - name: Deploy to GitHub Pages id: deployment