-
Notifications
You must be signed in to change notification settings - Fork 11
add windows support and sdk distribution support #21
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
xianshijing-lk
wants to merge
2
commits into
main
Choose a base branch
from
sxian/CLT-2385/CLT-2386/add_windows_support_and_sdk_dist
base: main
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 all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,134 @@ | ||
| name: C++ SDK | ||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| tags: | ||
| - "cpp-sdks/livekit-cpp@*" | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| inputs: | ||
| tag: | ||
| required: false | ||
| type: string | ||
|
|
||
| env: | ||
| BUILD_TYPE: Release | ||
| TAG_NAME: ${{ inputs.tag || github.ref_name }} | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| name: linux-x86_64 | ||
| generator: Ninja | ||
| - os: windows-latest | ||
| name: windows-x86_64 | ||
| generator: "Visual Studio 17 2022" | ||
| - os: macos-latest | ||
| name: macos-arm64 | ||
| generator: Ninja | ||
| macos_arch: "arm64" | ||
| # optionally add x86_64 mac build if you need it: | ||
| # - os: macos-latest | ||
| # name: macos-x86_64 | ||
| # generator: Ninja | ||
| # macos_arch: "x86_64" | ||
|
|
||
| name: Build (${{ matrix.name }}) | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Install Protoc | ||
| uses: arduino/setup-protoc@v2 | ||
| with: | ||
| version: "25.2" | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Install deps (Ubuntu) | ||
| if: startsWith(matrix.os, 'ubuntu') | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y ninja-build cmake pkg-config libprotobuf-dev libssl-dev | ||
|
|
||
| - name: Install deps (macOS) | ||
| if: startsWith(matrix.os, 'macos') | ||
| run: | | ||
| brew update | ||
| brew install ninja cmake protobuf openssl abseil | ||
|
|
||
| - name: Install deps (Windows) | ||
| if: startsWith(matrix.os, 'windows') | ||
| shell: pwsh | ||
| run: | | ||
| choco install ninja cmake -y | ||
|
|
||
| - name: Build + bundle | ||
| shell: bash | ||
| run: | | ||
| chmod +x ./build.sh | ||
| args=(release -G "${{ matrix.generator }}" \ | ||
| --version "${{ steps.ver.outputs.version }}" \ | ||
| --bundle --prefix "sdk-out/livekit-sdk-${{ matrix.name }}") | ||
| if [[ "${{ runner.os }}" == "macOS" && -n "${{ matrix.macos_arch }}" ]]; then | ||
| args+=(--macos-arch "${{ matrix.macos_arch }}") | ||
| fi | ||
| ./build.sh "${args[@]}" | ||
|
|
||
| - name: Archive (Unix) | ||
| if: ${{ !startsWith(matrix.os, 'windows') }} | ||
| shell: bash | ||
| run: | | ||
| tar -czf "livekit-sdk-${{ matrix.name }}.tar.gz" -C sdk-out "livekit-sdk-${{ matrix.name }}" | ||
|
|
||
| - name: Archive (Windows) | ||
| if: startsWith(matrix.os, 'windows') | ||
| shell: pwsh | ||
| run: | | ||
| Compress-Archive -Path "sdk-out/livekit-sdk-${{ matrix.name }}/*" -DestinationPath "livekit-sdk-${{ matrix.name }}.zip" | ||
|
|
||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: sdk-builds-${{ matrix.name }} | ||
| path: | | ||
| livekit-sdk-${{ matrix.name }}.tar.gz | ||
| livekit-sdk-${{ matrix.name }}.zip | ||
|
|
||
| release: | ||
| name: Release to GH (Draft) | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| permissions: | ||
| contents: write | ||
| if: startsWith(inputs.tag || github.ref_name, 'cpp-sdks/livekit-cpp@') | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: sdk-builds-* | ||
| merge-multiple: true | ||
| path: ${{ github.workspace }}/sdk-builds | ||
|
|
||
| - name: Create draft release (idempotent) | ||
| run: | | ||
| gh release view "${{ env.TAG_NAME }}" >/dev/null 2>&1 || \ | ||
| gh release create "${{ env.TAG_NAME }}" --draft --title "${{ env.TAG_NAME }}" --generate-notes | ||
|
|
||
| - name: Upload assets | ||
| run: | | ||
| gh release upload "${{ env.TAG_NAME }}" ${{ github.workspace }}/sdk-builds/*.zip ${{ github.workspace }}/sdk-builds/*.tar.gz | ||
|
|
||
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.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 3 days ago
In general, the problem is fixed by explicitly defining a
permissions:block so that theGITHUB_TOKENis granted only the scopes needed by the workflow/job. For this workflow, thebuildjob needs only read access to the repository contents (foractions/checkoutand any token-based access used by other actions), while thereleasejob already declarescontents: writebecause it creates and uploads a GitHub Release.The least intrusive fix that preserves existing behavior is to add a top-level
permissions:block after theon:section, settingcontents: read. This establishes a minimal default for all jobs. Thereleasejob already overrides this with its ownpermissions:block, so it will remain unchanged. No other functionality, steps, or actions need to be modified.Concretely:
.github/workflows/make-release.yml.on:block (after line 13 in the snippet), add:releasejob’s existingpermissions:block as-is, since it correctly grantscontents: writefor release creation and uploading assets.No new imports, methods, or additional definitions are required.