Repository navigation
Fix exact Codex package launch checks #60
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
| name: CI | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| env: | |
| DOTNET_VERSION: '10.0.x' | |
| NODE_VERSION: '22' | |
| jobs: | |
| build-test: | |
| name: Build and Codex CLI Smoke (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install Codex CLI | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| target_version="$(sed -nE 's/^[[:space:]]*public const string TargetVersion = "([0-9]+\.[0-9]+\.[0-9]+)";$/\1/p' CodexSharpSDK/Models/CodexCliCompatibility.cs)" | |
| [[ -n "$target_version" && "$target_version" != *$'\n'* ]] || { echo "Expected exactly one three-part Codex CLI TargetVersion."; exit 1; } | |
| npm install --no-save "@openai/codex@$target_version" | |
| export PATH="$GITHUB_WORKSPACE/node_modules/.bin:$PATH" | |
| [[ -f node_modules/@openai/codex/package.json && -f node_modules/@openai/codex/bin/codex.js ]] || { echo "The pinned Codex npm package is missing its manifest or CLI entry point."; exit 1; } | |
| package_version="$(node -p 'require("./node_modules/@openai/codex/package.json").version')" | |
| [[ "$package_version" == "$target_version" ]] || { echo "The installed Codex npm package version does not match TargetVersion."; exit 1; } | |
| version="$(node node_modules/@openai/codex/bin/codex.js --version)" | |
| printf '%s\n' "$version" | |
| actual_version="$(printf '%s\n' "$version" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | sed -n '1p')" | |
| printf 'Installed Codex CLI version: %s\n' "$actual_version" | |
| [[ "$actual_version" == "$target_version" ]] | |
| echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH" | |
| - name: Restore | |
| run: dotnet restore ManagedCode.CodexSharpSDK.slnx | |
| - name: Build | |
| run: dotnet build ManagedCode.CodexSharpSDK.slnx -c Release -warnaserror --no-restore | |
| - name: Test (full solution) | |
| run: dotnet test --solution ManagedCode.CodexSharpSDK.slnx -c Release --no-build -- --treenode-filter "/*/*/*/*[RequiresCodexAuth!=true]" | |
| - name: Smoke tests (Codex CLI discover + invoke) | |
| run: dotnet test --project CodexSharpSDK.Tests/CodexSharpSDK.Tests.csproj -c Release --no-build -- --treenode-filter "/*/*/*/CodexCli_Smoke_*" |