Skip to content

Commit 4fb932e

Browse files
authored
Merge pull request #7 from noprd/staging
Staging ---> Main
2 parents eb2d14d + 2e7e414 commit 4fb932e

File tree

5 files changed

+57
-14
lines changed

5 files changed

+57
-14
lines changed

.github/workflows/auto.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ on:
77
- dev
88
- develop
99
- staging
10+
1011
paths:
11-
- examples/**
12-
- src/**
13-
- tests/**
12+
- '**/*'
13+
1414
# see <https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#discussion>
1515
types:
1616
- opened
@@ -27,10 +27,8 @@ permissions:
2727
jobs:
2828
qa:
2929
name: QA
30-
# runs-on: [self-hosted, "${{ github.event.inputs.os }}", x64, gpu]
31-
runs-on: ${{ github.event.inputs.docker-image }}
32-
33-
environment: "${{ github.event.inputs.environment }}"
30+
runs-on: ubuntu-latest
31+
environment: "local"
3432
env: {}
3533

3634
steps:
@@ -44,7 +42,7 @@ jobs:
4442
- name: Action - install zig
4543
uses: goto-bus-stop/[email protected]
4644
with:
47-
version: "0.7.0"
45+
version: "0.12.0"
4846

4947
- name: Setup - ping basic tools and perform pre-installation
5048
shell: bash
@@ -76,4 +74,5 @@ jobs:
7674
- name: STEP 4 - run as an example
7775
shell: bash
7876
run: |-
79-
just run-exe
77+
just run-exe "James"
78+
just run-exe "Julia"

.github/workflows/manual.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Action - install zig
5656
uses: goto-bus-stop/[email protected]
5757
with:
58-
version: "0.7.0"
58+
version: "0.12.0"
5959

6060
- name: Setup - ping basic tools and perform pre-installation
6161
shell: bash
@@ -87,7 +87,8 @@ jobs:
8787
- name: STEP 4 - run as an example
8888
shell: bash
8989
run: |-
90-
just run-exe
90+
just run-exe "James"
91+
just run-exe "Julia"
9192
9293
# only performed if qa passes and option set
9394
deploy:
@@ -111,7 +112,7 @@ jobs:
111112
- name: Action - install zig
112113
uses: goto-bus-stop/[email protected]
113114
with:
114-
version: "0.7.0"
115+
version: "0.12.0"
115116

116117
- name: Setup - ping basic tools and perform pre-installation
117118
shell: bash

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ build:
139139
# --------------------------------
140140

141141
run *args:
142-
@zig run src/main.zig
142+
@zig run src/main.zig -- {{args}}
143143

144144
run-exe *args:
145145
@./dist/${ARTEFACT}-v$(cat dist/VERSION){{EXE}} {{args}}

src/main.zig

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
// --------------------------------
2+
// IMPORTS
3+
// --------------------------------
4+
15
const std = @import("std");
6+
const users = @import("models/users.zig");
7+
8+
// --------------------------------
9+
// MAIN
10+
// --------------------------------
211

312
pub fn main() !void {
4-
std.debug.print("Hello World!\n", .{});
13+
const allocator = std.heap.page_allocator;
14+
var args = try std.process.ArgIterator.initWithAllocator(allocator);
15+
defer args.deinit();
16+
17+
// ignore first argument
18+
_ = args.next();
19+
20+
// get second argument
21+
if (args.next()) |name| {
22+
const user = users.User{ .name = name };
23+
user.greet();
24+
} else {
25+
std.debug.print("Hello, World! There is nobody to greet!\n", .{});
26+
}
527
}

src/models/users.zig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// --------------------------------
2+
// IMPORTS
3+
// --------------------------------
4+
5+
const std = @import("std");
6+
7+
// --------------------------------
8+
// CLASSES
9+
// --------------------------------
10+
11+
pub const User = struct {
12+
name: []const u8,
13+
14+
pub fn init() User {
15+
return User{ .name = undefined };
16+
}
17+
18+
pub fn greet(self: User) void {
19+
std.debug.print("Hello {s}!\n", .{self.name});
20+
}
21+
};

0 commit comments

Comments
 (0)