Skip to content

Commit

Permalink
Add library version and check for consistency in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Jul 23, 2024
1 parent a90c731 commit 0afad8e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Zig
uses: goto-bus-stop/setup-zig@d866436887ad1b24590684f9d00480376663dd36
uses: goto-bus-stop/setup-zig@2a9625d550eefc3a9b1a43d342ad655f563f8241

- name: Unit tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/version_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: version check

on:
push:
tags:
- '**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Version check
run: |
grep -E 'const version =' build.zig | grep -E '"${{ github.ref_name }}"' || exit 78
echo "Version check passed."
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
const version = std.SemanticVersion.parse("0.1.24") catch unreachable;

const lib = b.addStaticLibrary(.{
.name = "aegis",
.target = target,
.optimize = optimize,
.strip = true,
.version = version,
});

lib.linkLibC();
Expand Down

0 comments on commit 0afad8e

Please sign in to comment.