Skip to content

chore: add ci and fix some trivial problem - #3

Open
jeffoodchain wants to merge 1 commit into
mainfrom
chore/add-ci
Open

chore: add ci and fix some trivial problem#3
jeffoodchain wants to merge 1 commit into
mainfrom
chore/add-ci

Conversation

@jeffoodchain

@jeffoodchain jeffoodchain commented Aug 3, 2025

Copy link
Copy Markdown

This pull request introduces a new CI workflow for building and testing the project, along with updates to the build system to include a new zlib dependency. Below are the most important changes:

close #2

CI Workflow Setup:

  • Added a new GitHub Actions workflow in .github/workflows/ci.yml to automate builds for macOS and Linux, targeting both aarch64 and x86_64 architectures. It includes steps for setting up Zig, caching dependencies, formatting checks, and building the project. Unit testing is currently commented out as a placeholder for future implementation.

Build System Updates:

  • Updated the build.zig file to include zlib as a dependency, specifying its target and optimization settings.
  • Modified the build script to link the zlib library and include its source path in the build configuration.

Codebase Simplification:

  • Removed the unused file lsquic_global.c from the lsquic_files array in build.zig.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @FoodChain1028, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've introduced a new CI workflow using GitHub Actions to automate builds for macOS and Linux, targeting both aarch64 and x86_64 architectures. This PR also updates the build system to incorporate zlib as a new dependency and cleans up the codebase by removing an unused source file.

Highlights

  • CI Workflow Setup: A new GitHub Actions workflow (.github/workflows/ci.yml) has been added to automate builds for macOS and Linux across aarch64 and x86_64 architectures. It includes steps for Zig setup, dependency caching, formatting checks, and project building. Unit testing is currently a placeholder.
  • Build System Updates: The build.zig file has been updated to include zlib as a dependency, specifying its target and optimization settings. The build script now links the zlib library and adds its source path to the build configuration.
  • Codebase Simplification: The unused file lsquic_global.c has been removed from the lsquic_files array in build.zig, streamlining the build process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a CI workflow and adds zlib as a dependency. The changes to the build system are mostly correct, but there is a critical issue with the include path for the new zlib dependency which will prevent the project from building. I've provided a suggestion to fix this. The removal of the unused lsquic_global.c file is a good cleanup.

Comment thread build.zig
lib.linkLibrary(ssl);
lib.linkLibrary(crypto);
lib.linkLibrary(zlib.artifact("z"));
lib.addIncludePath(zlib.path("src"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The include path for zlib appears to be incorrect. The specified zlib dependency (allyourcodebase/zlib) has its header files (zlib.h, zconf.h) at the root of the project, not within a src/ directory. This will likely cause the build to fail when it cannot locate the headers.

To fix this, you should point to the root of the dependency.

lib.addIncludePath(zlib.path(""));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this, since if there's no these lines in build.zig, the local container building would fail. @GrapeBaBa @spiral-ladder

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean lib.addIncludePath(zlib.path("src")); this line?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am not sure about this, since if there's no these lines in build.zig, the local container building would fail

What is the error message?

Comment thread .github/workflows/ci.yml
# run: zig build test -Dtarget=${{matrix.target}} --summary all

- name: Building
run: zig build -Dtarget=${{matrix.target}} -Doptimize=ReleaseFast --summary all

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: zig build -Dtarget=${{matrix.target}} -Doptimize=ReleaseFast --summary all
run: zig build -Dtarget=${{matrix.target}} -Doptimize=ReleaseSafe --summary all

Let's try to default to ReleaseSafe rather than ReleaseFast

Comment thread .github/workflows/ci.yml
Comment on lines +56 to +58
# TODO: uncomment when tests are implemented
# - name: Unit testing
# run: zig build test -Dtarget=${{matrix.target}} --summary all

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: uncomment when tests are implemented
# - name: Unit testing
# run: zig build test -Dtarget=${{matrix.target}} --summary all

I think we can do without these if it's going to be commented out anyway.

Comment thread .github/workflows/ci.yml
Comment on lines +37 to +51
- name: Cache Zig installation
uses: actions/cache@v3
with:
path: ${{ steps.setup-zig.outputs.install-path }}
key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}

- name: Cache Zig build artifacts
uses: actions/cache@v3
with:
path: |
zig-cache
~/.cache/zig
key: ${{ runner.os }}-${{ matrix.target }}-zig-build-${{ hashFiles('build.zig', 'build.zig.zon') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-zig-build-

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Cache Zig installation
uses: actions/cache@v3
with:
path: ${{ steps.setup-zig.outputs.install-path }}
key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}
- name: Cache Zig build artifacts
uses: actions/cache@v3
with:
path: |
zig-cache
~/.cache/zig
key: ${{ runner.os }}-${{ matrix.target }}-zig-build-${{ hashFiles('build.zig', 'build.zig.zon') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-zig-build-

I think for such a small build, we don't really need to cache these.

Comment thread .github/workflows/ci.yml
- os: ubuntu-latest
target: aarch64-linux-gnu
- os: ubuntu-latest
target: x86_64-linux-gnu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we try to add a windows target to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add CI

3 participants