-
Notifications
You must be signed in to change notification settings - Fork 0
Support TLS socket, enhance utilities #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikecovlee
wants to merge
30
commits into
master
Choose a base branch
from
tls_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
1066854
feat: Implement OpenAI API compatible client and enhance network func…
mikecovlee be26591
Add test suite for CovScript Network Extension
mikecovlee bd40c05
Add argparse package for command-line argument parsing
mikecovlee 48e97ac
Update CI script
mikecovlee 8dccbf4
Update CI script
mikecovlee 4cf1002
Fix CI script
mikecovlee f15b67a
Update CI os image
mikecovlee e5cf99f
Fix CI script
mikecovlee 01e7a7b
Fix fix fix...
mikecovlee 3b12a6e
fix fix fix...
mikecovlee 057ddc1
shoud be done
mikecovlee db70a43
fix on windows
mikecovlee d8e6ad1
fix ci
mikecovlee 79ec4c8
fix fix fix...
mikecovlee b62eede
optimize ci
mikecovlee 7ac43e7
fix again
mikecovlee 1e620f9
fix
mikecovlee 03b237e
update ci
mikecovlee 0fa58b7
update ci
mikecovlee 069460e
fix ci
mikecovlee 759d729
try with msys2
mikecovlee 8679cd2
try fix ci
mikecovlee d520a27
try fix ci
mikecovlee de09048
Add comprehensive tests for TCP, UDP, and TLS functionalities
mikecovlee 73cf286
Enhance CNI API and network module with various improvements
mikecovlee 3bdc034
Fix tests
mikecovlee 54fa378
Fix shutdown
mikecovlee b8b0d49
feat: Add async architecture documentation for CovScript Network Exte…
mikecovlee 8c1e34c
Update netutils and network modules for improved functionality and er…
mikecovlee a2a8323
Fix bugs
mikecovlee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| # CI for covscript-network extension. | ||
| # | ||
| # Matrix: 3 platforms x 2 covscript channels (release + nightly) = 6 jobs. | ||
| # | ||
| # Each job: | ||
| # 1. Checks out this extension repo. | ||
| # 2. Determines the covscript ref (tag from covscript/csbuild/release.txt, or master HEAD). | ||
| # 3. Builds covscript from source (SDK ends up in covscript/csdev/). | ||
| # 4. Builds the network extension against that SDK. | ||
| # 5. Runs unit tests (no network required). | ||
| # 6. Runs integration tests (TLS trust check against public servers). | ||
| # 7. Runs DeepSeek test (only when DEEPSEEK_API_KEY secret is set). | ||
|
|
||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: "${{ matrix.os }} / ${{ matrix.cs-channel }}" | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-22.04, macos-14, windows-2022] | ||
| cs-channel: [release, nightly] | ||
|
|
||
| steps: | ||
| # ------------------------------------------------------------------ # | ||
| # 1. Check out this extension repo # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Checkout extension | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 2. Determine covscript checkout ref # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Determine covscript ref | ||
| id: cs-ref | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ matrix.cs-channel }}" = "release" ]; then | ||
| tag=$(curl -fsSL https://raw.githubusercontent.com/covscript/covscript/master/csbuild/release.txt | tr -d '[:space:]') | ||
| echo "ref=$tag" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "ref=master" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 3. Check out covscript at the resolved ref # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Checkout covscript (${{ steps.cs-ref.outputs.ref }}) | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: covscript/covscript | ||
| ref: ${{ steps.cs-ref.outputs.ref }} | ||
| path: covscript | ||
| submodules: recursive | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 4a. Add MinGW-w64 to PATH (Windows only) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Add MinGW to PATH | ||
| if: runner.os == 'Windows' | ||
| shell: bash | ||
| run: echo "C:/mingw64/bin" >> "$GITHUB_PATH" | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 4b. Build covscript (Linux / macOS) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Build covscript | ||
| if: runner.os != 'Windows' | ||
| working-directory: covscript | ||
| shell: bash | ||
| run: bash csbuild/make.sh | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 4c. Build covscript (Windows / MinGW) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Build covscript (Windows) | ||
| if: runner.os == 'Windows' | ||
| working-directory: covscript | ||
| shell: cmd | ||
| run: csbuild\make.bat | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 5a. Build extension (Linux / macOS) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Build extension | ||
| if: runner.os != 'Windows' | ||
| shell: bash | ||
| env: | ||
| CS_DEV_PATH: ${{ github.workspace }}/covscript/csdev | ||
| run: | | ||
| cmake -G "Unix Makefiles" -S . -B build -DCMAKE_BUILD_TYPE=Release | ||
| cmake --build build --parallel 4 | ||
| mkdir -p build/imports | ||
| cp build/*.cse build/imports/ | ||
| cp netutils.csp netutils.csym build/imports/ 2>/dev/null || true | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 5b. Build extension (Windows / MinGW) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Build extension (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: cmd | ||
| run: | | ||
| set CS_DEV_PATH=${{ github.workspace }}\covscript\csdev | ||
| if not exist build mkdir build | ||
| cd build | ||
| cmake -G "MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release | ||
| cmake --build . --parallel 4 | ||
| cd .. | ||
| if not exist build\imports mkdir build\imports | ||
| copy build\*.cse build\imports\ | ||
| if exist netutils.csp copy netutils.csp build\imports\ | ||
| if exist netutils.csym copy netutils.csym build\imports\ | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 6a. Run unit tests (Linux / macOS) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run unit tests | ||
| if: runner.os != 'Windows' | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| CS="${{ github.workspace }}/covscript/build/bin/cs" | ||
| export PATH="${{ github.workspace }}/covscript/build/bin:$PATH" | ||
| "$CS" -i build/imports tests/test_url_parse.csc | ||
| "$CS" -i build/imports tests/test_header_parser.csc | ||
| "$CS" -i build/imports tests/test_openai_client.csc | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 6b. Run unit tests (Windows) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run unit tests (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| $cs = "${{ github.workspace }}\covscript\build\bin\cs.exe" | ||
| $env:Path = "${{ github.workspace }}\covscript\build\bin;$env:Path" | ||
| & $cs -i build\imports tests\test_url_parse.csc | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
| & $cs -i build\imports tests\test_header_parser.csc | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
| & $cs -i build\imports tests\test_openai_client.csc | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 7a. Run async TCP test (Linux / macOS) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run async TCP test | ||
| if: runner.os != 'Windows' | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| CS="${{ github.workspace }}/covscript/build/bin/cs" | ||
| export PATH="${{ github.workspace }}/covscript/build/bin:$PATH" | ||
| "$CS" -i build/imports tests/test_async_tcp.csc | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 7b. Run async TCP test (Windows) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run async TCP test (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| $cs = "${{ github.workspace }}\covscript\build\bin\cs.exe" | ||
| $env:Path = "${{ github.workspace }}\covscript\build\bin;$env:Path" | ||
| & $cs -i build\imports tests\test_async_tcp.csc | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 8a. Run integration tests (Linux / macOS) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run integration tests | ||
| if: runner.os != 'Windows' | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| CS="${{ github.workspace }}/covscript/build/bin/cs" | ||
| export PATH="${{ github.workspace }}/covscript/build/bin:$PATH" | ||
| "$CS" -i build/imports tests/test_tls_trust.csc | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 8b. Run integration tests (Windows) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run integration tests (Windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| $cs = "${{ github.workspace }}\covscript\build\bin\cs.exe" | ||
| $env:Path = "${{ github.workspace }}\covscript\build\bin;$env:Path" | ||
| & $cs -i build\imports tests\test_tls_trust.csc | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 9a. Run DeepSeek test (only when API key is available) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run DeepSeek test | ||
| if: runner.os != 'Windows' && env.DEEPSEEK_API_KEY != '' | ||
| shell: bash | ||
| env: | ||
| DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} | ||
| run: | | ||
| set -e | ||
| CS="${{ github.workspace }}/covscript/build/bin/cs" | ||
| export PATH="${{ github.workspace }}/covscript/build/bin:$PATH" | ||
| "$CS" -i build/imports tests/test_deepseek.csc | ||
|
|
||
| # ------------------------------------------------------------------ # | ||
| # 9b. Run DeepSeek test (Windows, only when API key is available) # | ||
| # ------------------------------------------------------------------ # | ||
| - name: Run DeepSeek test (Windows) | ||
| if: runner.os == 'Windows' && env.DEEPSEEK_API_KEY != '' | ||
|
mikecovlee marked this conversation as resolved.
Outdated
|
||
| shell: pwsh | ||
| env: | ||
| DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} | ||
| run: | | ||
| $cs = "${{ github.workspace }}\covscript\build\bin\cs.exe" | ||
| $env:Path = "${{ github.workspace }}\covscript\build\bin;$env:Path" | ||
| & $cs -i build\imports tests\test_deepseek.csc | ||
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,3 +56,6 @@ examples/*.csc | |
| *.log | ||
| *.db | ||
| authorized_keys | ||
|
|
||
| # Compiled CovScript output | ||
| test_call_deepseek.csc | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.