reasoning: per-profile level, :reasoning command, restore glm/qwen kn… #56
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['[0-9]+.[0-9]+.[0-9]+'] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| artifact: 3code-linux-amd64 | |
| ext: tar.gz | |
| - os: ubuntu-22.04-arm | |
| artifact: 3code-linux-arm64 | |
| ext: tar.gz | |
| - os: macos-latest | |
| artifact: 3code-macos-universal | |
| ext: tar.gz | |
| - os: windows-latest | |
| artifact: 3code-windows-amd64 | |
| ext: zip | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jiro4989/setup-nim-action@v2 | |
| with: | |
| nim-version: stable | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: | | |
| nimble install -y --depsOnly | |
| nimble setup -y | |
| echo '--path:"src"' >> nimble.paths | |
| - name: Build | |
| run: nimble build -y -d:release -d:autoUpdate | |
| - name: Build x86_64 and create universal binary (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| mv 3code 3code-arm64 | |
| rm -rf ~/.cache/nim/threecode_r | |
| nim c -d:release -d:autoUpdate --passC:"-arch x86_64" --passL:"-arch x86_64" --cpu:amd64 -o:3code-x86_64 src/threecode.nim | |
| lipo -create 3code-arm64 3code-x86_64 -output 3code | |
| file 3code | |
| - name: Run tests | |
| run: nimble test | |
| - name: Package (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| mkdir -p ${{ matrix.artifact }} | |
| cp 3code ${{ matrix.artifact }}/ | |
| cp README.md LICENSE ${{ matrix.artifact }}/ | |
| tar czf ${{ matrix.artifact }}.${{ matrix.ext }} ${{ matrix.artifact }} | |
| - name: Package (macOS) — bundle OpenSSL dylibs alongside binary | |
| if: runner.os == 'macOS' | |
| run: | | |
| mkdir -p ${{ matrix.artifact }} | |
| cp 3code ${{ matrix.artifact }}/ | |
| cp README.md LICENSE ${{ matrix.artifact }}/ | |
| # Stock macOS ships LibreSSL at /usr/lib/libssl.dylib which trips | |
| # TLS handshakes against most modern endpoints. Bundle Homebrew | |
| # OpenSSL 3 dylibs and rewrite install names so they're loaded | |
| # via @loader_path. Main binary picks them up via DYLD_LIBRARY_PATH | |
| # set in main() before any TLS use. | |
| OPENSSL_PREFIX="$(brew --prefix openssl@3)" | |
| cp "${OPENSSL_PREFIX}/lib/libssl.3.dylib" ${{ matrix.artifact }}/ | |
| cp "${OPENSSL_PREFIX}/lib/libcrypto.3.dylib" ${{ matrix.artifact }}/ | |
| chmod +w ${{ matrix.artifact }}/libssl.3.dylib ${{ matrix.artifact }}/libcrypto.3.dylib | |
| install_name_tool -id @loader_path/libcrypto.3.dylib ${{ matrix.artifact }}/libcrypto.3.dylib | |
| install_name_tool -id @loader_path/libssl.3.dylib ${{ matrix.artifact }}/libssl.3.dylib | |
| install_name_tool -change "${OPENSSL_PREFIX}/lib/libcrypto.3.dylib" \ | |
| @loader_path/libcrypto.3.dylib ${{ matrix.artifact }}/libssl.3.dylib | |
| # Aliases so dlopen("libssl.dylib") / dlopen("libcrypto.dylib") hit too | |
| ln -sf libssl.3.dylib ${{ matrix.artifact }}/libssl.dylib | |
| ln -sf libcrypto.3.dylib ${{ matrix.artifact }}/libcrypto.dylib | |
| # CA bundle: Homebrew's OpenSSL has its OPENSSLDIR baked to a | |
| # build-time path that won't exist on user systems. Ship the | |
| # Mozilla bundle (canonical curl.se source) and point | |
| # SSL_CERT_FILE at it from main(). | |
| curl -fsSL https://curl.se/ca/cacert.pem -o ${{ matrix.artifact }}/cacert.pem | |
| tar czf ${{ matrix.artifact }}.${{ matrix.ext }} ${{ matrix.artifact }} | |
| - name: Package (Windows) — bundle OpenSSL DLLs alongside .exe | |
| if: matrix.ext == 'zip' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path ${{ matrix.artifact }} | Out-Null | |
| Copy-Item 3code.exe ${{ matrix.artifact }}/ | |
| Copy-Item README.md, LICENSE ${{ matrix.artifact }}/ | |
| # Stock Windows ships no OpenSSL. Nim's std/net dlopens libssl / | |
| # libcrypto by hardcoded names; without these DLLs alongside | |
| # 3code.exe, any TLS code path dies with | |
| # could not load: (libcrypto-1_1-x64|libeay64).dll | |
| # Use the canonical Nim Windows DLL bundle from nim-lang.org; | |
| # it also ships a cacert.pem that we point SSL_CERT_FILE at. | |
| Invoke-WebRequest -Uri https://nim-lang.org/download/dlls.zip -OutFile dlls.zip | |
| Expand-Archive -Path dlls.zip -DestinationPath dlls | |
| Copy-Item dlls/libssl-1_1-x64.dll, dlls/libcrypto-1_1-x64.dll, dlls/cacert.pem ${{ matrix.artifact }}/ | |
| Compress-Archive -Path ${{ matrix.artifact }} -DestinationPath ${{ matrix.artifact }}.${{ matrix.ext }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.artifact }}.${{ matrix.ext }} | |
| pages: | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: 3code-* | |
| path: dl | |
| merge-multiple: true | |
| - name: Assemble site | |
| run: | | |
| mkdir -p site/main | |
| cp dl/3code-linux-amd64.tar.gz site/main/ | |
| cp dl/3code-linux-arm64.tar.gz site/main/ | |
| cp dl/3code-macos-universal.tar.gz site/main/ | |
| cp dl/3code-windows-amd64.zip site/main/ | |
| cat > site/index.html <<EOF | |
| <!doctype html><meta charset=utf-8><title>3code main builds</title> | |
| <h1>3code main builds</h1> | |
| <p>Per-commit builds from <code>main</code> (commit ${GITHUB_SHA}).</p> | |
| <ul> | |
| <li><a href="main/3code-linux-amd64.tar.gz">3code-linux-amd64.tar.gz</a></li> | |
| <li><a href="main/3code-linux-arm64.tar.gz">3code-linux-arm64.tar.gz</a></li> | |
| <li><a href="main/3code-macos-universal.tar.gz">3code-macos-universal.tar.gz</a></li> | |
| <li><a href="main/3code-windows-amd64.zip">3code-windows-amd64.zip</a></li> | |
| </ul> | |
| EOF | |
| - uses: actions/configure-pages@v5 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| - id: deploy | |
| uses: actions/deploy-pages@v4 | |
| release: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create ${{ github.ref_name }} \ | |
| --repo ${{ github.repository }} \ | |
| --title "${{ github.ref_name }}" \ | |
| --generate-notes \ | |
| 3code-linux-amd64.tar.gz \ | |
| 3code-linux-arm64.tar.gz \ | |
| 3code-macos-universal.tar.gz \ | |
| 3code-windows-amd64.zip |