fork/rust-sdks

git clone https://git.julia.blue/fork/rust-sdks

Mathew Kamkarupdate more gh runner images (#579)e41cced

livekit/livekit-ffi@0.13.0
5.6 KiB181 linesraw
1# Copyright 2023 LiveKit, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15name: WebRTC builds
16on:
17  push:
18    tags:
19      - "webrtc-*"
20  workflow_dispatch:
21
22jobs:
23  build:
24    strategy:
25      fail-fast: false
26      matrix:
27        target:
28          - name: win
29            os: windows-latest
30            cmd: .\build_windows.cmd
31            arch: x64
32
33          - name: win
34            os: windows-latest
35            cmd: .\build_windows.cmd
36            arch: arm64
37
38          - name: mac
39            os: macos-latest
40            cmd: ./build_macos.sh
41            arch: x64
42
43          - name: mac
44            os: macos-latest
45            cmd: ./build_macos.sh
46            arch: arm64
47
48          - name: linux
49            os: ubuntu-latest
50            cmd: ./build_linux.sh
51            arch: x64
52
53          - name: linux
54            os: ubuntu-24.04-arm
55            cmd: ./build_linux.sh
56            arch: arm64
57
58          - name: android
59            os: ubuntu-24.04-arm
60            cmd: ./build_android.sh
61            arch: arm64
62
63          - name: android
64            os: ubuntu-24.04-arm
65            cmd: ./build_android.sh
66            arch: arm
67
68          - name: android
69            os: ubuntu-latest
70            cmd: ./build_android.sh
71            arch: x64
72
73          - name: ios
74            out: ios-device-arm64
75            os: macos-latest
76            cmd: ./build_ios.sh
77            arch: arm64
78
79          - name: ios
80            out: ios-simulator-arm64
81            os: macos-latest
82            cmd: ./build_ios.sh
83            arch: arm64
84            buildargs: --environment simulator
85        profile:
86          - release
87    #          - debug
88
89    name: Build webrtc (${{ matrix.target.name }}-${{ matrix.target.arch }}-${{ matrix.profile }}) ${{ matrix.target.buildargs }}
90    runs-on: ${{ matrix.target.os }}
91    steps:
92      - name: Setup variables
93        id: setup
94        run: |
95          DEFAULT_OUT=${{ matrix.target.name }}-${{ matrix.target.arch }}
96          OUT=${{ matrix.target.out == '' && '$DEFAULT_OUT' || matrix.target.out }}-${{ matrix.profile }}
97          echo OUT=$OUT >> $GITHUB_OUTPUT
98          echo ZIP=webrtc-$OUT.zip >> $GITHUB_OUTPUT
99        shell: bash
100
101      # Print some debug infos to be sure everything is ok before doing really long tasks..
102      - name: Info
103        run: |
104          echo "OutName: ${{ steps.setup.outputs.OUT }}"
105          echo "OutZip: ${{ steps.setup.outputs.ZIP }}"
106
107      - uses: actions/checkout@v4
108        with:
109          submodules: true
110
111      - uses: actions/setup-python@v4
112      - run: pip3 install setuptools # pkg_resources is sometimes not found?
113
114      - name: Install linux dependencies
115        if: ${{ matrix.target.os == 'ubuntu-latest' }}
116        run: |
117          sudo apt update -y
118          sudo apt install -y ninja-build pkg-config openjdk-11-jdk
119
120      - name: Install macos dependencies
121        if: ${{ matrix.target.os == 'macos-latest' }}
122        run: brew install ninja
123
124      - name: Install windows dependencies
125        if: ${{ matrix.target.os == 'windows-latest' }}
126        run: |
127          Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/latest/download/ninja-win.zip" -OutFile ninja.zip
128          Expand-Archive -Path ninja.zip -DestinationPath ${{ github.workspace }}\ninja
129          echo "${{ github.workspace }}\ninja" | Out-File -Append -Encoding utf8 -FilePath $Env:GITHUB_PATH
130
131      - name: Print ninja version
132        run: ninja --version
133
134      - name: Target OS
135        run: echo -e "\ntarget_os = [\"${{ matrix.target.name }}\"]" >> .gclient
136        shell: bash
137        working-directory: webrtc-sys/libwebrtc
138
139      - name: Build WebRTC
140        run: ${{ matrix.target.cmd }} --arch ${{ matrix.target.arch }} --profile ${{ matrix.profile }} ${{ matrix.target.buildargs }}
141        working-directory: webrtc-sys/libwebrtc
142
143      - name: Zip artifact (Unix)
144        if: ${{ matrix.target.os != 'windows-latest' }}
145        run: |
146          cd webrtc-sys/libwebrtc
147          zip ${{ github.workspace }}/${{ steps.setup.outputs.ZIP }} ${{ steps.setup.outputs.OUT }} -r
148
149      - name: Zip artifact (Windows)
150        if: ${{ matrix.target.os == 'windows-latest' }}
151        run: Compress-Archive -Path .\webrtc-sys\libwebrtc\${{ steps.setup.outputs.OUT }} -DestinationPath ${{ steps.setup.outputs.ZIP }}
152
153      - name: Upload artifacts
154        uses: actions/upload-artifact@v4
155        with:
156          name: webrtc-builds-${{ steps.setup.outputs.OUT }}
157          path: ${{ steps.setup.outputs.ZIP }}
158
159  release:
160    name: Release to GH (Draft)
161    runs-on: ubuntu-latest
162    needs: build
163    permissions:
164      contents: write
165    if: startsWith(github.ref, 'refs/tags/webrtc-')
166    env:
167      GH_TOKEN: ${{ github.token }}
168    steps:
169      - uses: actions/checkout@v4
170
171      - name: Download artifacts
172        uses: actions/download-artifact@v4
173        with:
174          pattern: webrtc-builds-*
175          merge-multiple: true
176          path: ${{ github.workspace }}/webrtc-builds
177
178      - name: Create draft release
179        run: |
180          gh release create ${{ github.ref_name }} --draft --title "${{ github.ref_name }}"
181          gh release upload ${{ github.ref_name }} ${{ github.workspace }}/webrtc-builds/*