fix: Build only Databento.Client project in CI (skip internal projects) #7
Workflow file for this run
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
| # Cross-platform build workflow for databento-dotnet | |
| # Builds native libraries on Windows, Linux, and macOS, then packages into NuGet | |
| name: Build | |
| on: | |
| push: | |
| branches: [master, main, develop] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| inputs: | |
| publish_nuget: | |
| description: 'Publish to NuGet.org' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| jobs: | |
| # ============================================================================ | |
| # Build native libraries on each platform | |
| # ============================================================================ | |
| build-native-windows: | |
| runs-on: windows-latest | |
| env: | |
| VCPKG_DEFAULT_TRIPLET: x64-windows | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies via vcpkg | |
| run: | | |
| # Use pre-installed vcpkg, update to latest | |
| cd $env:VCPKG_INSTALLATION_ROOT | |
| git pull | |
| .\bootstrap-vcpkg.bat | |
| vcpkg install openssl:x64-windows zstd:x64-windows zlib:x64-windows | |
| shell: pwsh | |
| - name: Configure CMake | |
| run: | | |
| cmake -S src/Databento.Native -B build/native ` | |
| -DCMAKE_BUILD_TYPE=Release ` | |
| -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | |
| - name: Build native library | |
| run: cmake --build build/native --config Release | |
| - name: Copy dependencies to runtimes folder | |
| run: | | |
| $runtimeDir = "src/Databento.Interop/runtimes/win-x64/native" | |
| New-Item -ItemType Directory -Force -Path $runtimeDir | |
| # Copy vcpkg dependencies | |
| $vcpkgBin = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin" | |
| Copy-Item "$vcpkgBin/libcrypto-3-x64.dll" $runtimeDir -Force | |
| Copy-Item "$vcpkgBin/libssl-3-x64.dll" $runtimeDir -Force | |
| Copy-Item "$vcpkgBin/zstd.dll" $runtimeDir -Force | |
| Copy-Item "$vcpkgBin/zlib1.dll" $runtimeDir -Force | |
| # List contents | |
| Get-ChildItem $runtimeDir | |
| - name: Upload Windows native artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-win-x64 | |
| path: src/Databento.Interop/runtimes/win-x64/ | |
| retention-days: 1 | |
| build-native-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| cmake \ | |
| build-essential \ | |
| libssl-dev \ | |
| libzstd-dev \ | |
| zlib1g-dev | |
| - name: Configure CMake | |
| run: | | |
| cmake -S src/Databento.Native -B build/native \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| - name: Build native library | |
| run: cmake --build build/native --config Release | |
| - name: Verify native library | |
| run: | | |
| ls -la src/Databento.Interop/runtimes/linux-x64/native/ | |
| ldd src/Databento.Interop/runtimes/linux-x64/native/libdatabento_native.so || true | |
| - name: Upload Linux native artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-linux-x64 | |
| path: src/Databento.Interop/runtimes/linux-x64/ | |
| retention-days: 1 | |
| build-native-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| brew install cmake openssl@3 zstd | |
| - name: Configure CMake | |
| run: | | |
| cmake -S src/Databento.Native -B build/native \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) | |
| - name: Build native library | |
| run: cmake --build build/native --config Release | |
| - name: Determine architecture and verify | |
| run: | | |
| ARCH=$(uname -m) | |
| if [ "$ARCH" = "arm64" ]; then | |
| RID="osx-arm64" | |
| else | |
| RID="osx-x64" | |
| fi | |
| echo "RID=$RID" >> $GITHUB_ENV | |
| ls -la src/Databento.Interop/runtimes/$RID/native/ | |
| - name: Upload macOS native artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-${{ env.RID }} | |
| path: src/Databento.Interop/runtimes/${{ env.RID }}/ | |
| retention-days: 1 | |
| # ============================================================================ | |
| # Build .NET solution with all native libraries | |
| # ============================================================================ | |
| build-dotnet: | |
| needs: [build-native-windows, build-native-linux, build-native-macos] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| - name: Download Windows native artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-win-x64 | |
| path: src/Databento.Interop/runtimes/win-x64/ | |
| - name: Download Linux native artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-linux-x64 | |
| path: src/Databento.Interop/runtimes/linux-x64/ | |
| - name: Download macOS native artifacts (try arm64 first, then x64) | |
| continue-on-error: true | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-osx-arm64 | |
| path: src/Databento.Interop/runtimes/osx-arm64/ | |
| - name: Download macOS x64 native artifacts (fallback) | |
| continue-on-error: true | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-osx-x64 | |
| path: src/Databento.Interop/runtimes/osx-x64/ | |
| - name: List all native libraries | |
| run: | | |
| echo "=== Native libraries ===" | |
| find src/Databento.Interop/runtimes -type f | head -50 | |
| - name: Restore dependencies | |
| run: dotnet restore src/Databento.Client/Databento.Client.csproj | |
| - name: Build solution | |
| run: dotnet build src/Databento.Client/Databento.Client.csproj -c Release --no-restore | |
| - name: Pack NuGet package | |
| run: dotnet pack src/Databento.Client/Databento.Client.csproj -c Release --no-build -o ./nupkg | |
| - name: List package contents | |
| run: | | |
| echo "=== NuGet package contents ===" | |
| unzip -l ./nupkg/*.nupkg | grep -E "runtimes|\.dll|\.so|\.dylib" | head -30 | |
| - name: Upload NuGet package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ./nupkg/*.nupkg | |
| retention-days: 30 | |
| - name: Upload symbols package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-symbols | |
| path: ./nupkg/*.snupkg | |
| retention-days: 30 | |
| # ============================================================================ | |
| # Publish to NuGet (manual trigger or tag push) | |
| # ============================================================================ | |
| publish-nuget: | |
| needs: build-dotnet | |
| runs-on: ubuntu-latest | |
| if: | | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || | |
| (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_nuget == 'true') | |
| steps: | |
| - name: Download NuGet package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ./nupkg | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Publish to NuGet.org | |
| run: | | |
| dotnet nuget push ./nupkg/*.nupkg \ | |
| --api-key ${{ secrets.NUGET_API_KEY }} \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| # ============================================================================ | |
| # Create GitHub Release (on tag push) | |
| # ============================================================================ | |
| create-release: | |
| needs: build-dotnet | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download NuGet package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ./nupkg | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ./nupkg/*.nupkg | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') }} |