Skip to content
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
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [main, master, fixrace]
branches: [main, master, fixrace, fixconflict]
pull_request:
branches: [main, master]

Expand Down Expand Up @@ -42,6 +42,46 @@ jobs:
- name: Run unit tests
run: zig build test

integration-tests:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4

- name: Cache Zig
uses: actions/cache@v4
with:
path: ~/zig
key: zig-${{ env.ZIG_VERSION }}

- name: Install Zig
run: |
if [ ! -d ~/zig ]; then
mkdir -p ~/zig
curl -L ${{ env.ZIG_URL }} | tar -xJ -C ~/zig --strip-components=1
fi
echo "$HOME/zig" >> $GITHUB_PATH

- name: Patch ecdsa.zig for API compatibility
run: sed -i 's/mem\.trimLeft/mem.trimStart/g' ~/zig/lib/std/crypto/ecdsa.zig

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

- name: Install Python dependencies for HTTP/2 tests
run: |
python -m venv tests/.venv
source tests/.venv/bin/activate
pip install hypercorn

- name: Build all binaries
run: zig build build-all

- name: Run integration tests
run: zig build test-integration

release-build:
runs-on: ubuntu-latest
if: github.event_name == 'push'
Expand Down
19 changes: 9 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,18 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
.link_libc = true,
});
integration_tests_mod.addImport("zzz", zzz_module);
integration_tests_mod.addImport("tls", tls_module);
const integration_tests = b.addTest(.{

// Add integration test as executable (for better output)
const integration_exe = b.addExecutable(.{
.name = "integration_tests",
.root_module = integration_tests_mod,
});
const run_integration_tests = b.addRunArtifact(integration_tests);
// Integration tests need the binaries built first
run_integration_tests.step.dependOn(&build_test_backend_echo.step);
run_integration_tests.step.dependOn(&build_load_balancer.step);
const run_integration_exe = b.addRunArtifact(integration_exe);
run_integration_exe.step.dependOn(&build_test_backend_echo.step);
run_integration_exe.step.dependOn(&build_load_balancer.step);

const integration_test_step = b.step("test-integration", "Run integration tests");
integration_test_step.dependOn(&run_integration_exe.step);

// Steps
const build_all = b.step("build-all", "Build backends and load balancer");
Expand All @@ -136,9 +138,6 @@ pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);

const integration_test_step = b.step("test-integration", "Run integration tests");
integration_test_step.dependOn(&run_integration_tests.step);

const run_lb_step = b.step("run", "Run load balancer (use --mode mp|sp)");
run_lb_step.dependOn(&run_load_balancer_cmd.step);

Expand Down
Loading