Initial commit #9
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| test: | |
| name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| ruby: | |
| - '3.1' | |
| - '3.2' | |
| - '3.3' | |
| - '3.4' | |
| - '4.0' | |
| - 'head' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| - name: Install dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake libssl-dev | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install cmake openssl | |
| - name: Clone libdatachannel | |
| run: | | |
| git clone --depth 1 --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git vendor/libdatachannel | |
| - name: Build libdatachannel | |
| run: | | |
| cd vendor/libdatachannel | |
| mkdir -p build && cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release -DNO_EXAMPLES=ON -DNO_TESTS=ON | |
| cmake --build . --config Release | |
| - name: Build native extension | |
| run: | | |
| cd ext/webrtc_ruby | |
| mkdir -p build && cd build | |
| cmake .. | |
| cmake --build . | |
| - name: Copy libdatachannel to build directory (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cp vendor/libdatachannel/build/libdatachannel.so ext/webrtc_ruby/build/ || true | |
| cp vendor/libdatachannel/build/libdatachannel.so.* ext/webrtc_ruby/build/ || true | |
| - name: Copy libdatachannel to build directory (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| cp vendor/libdatachannel/build/libdatachannel.dylib ext/webrtc_ruby/build/ || true | |
| cp vendor/libdatachannel/build/libdatachannel.*.dylib ext/webrtc_ruby/build/ || true | |
| - name: Run tests (Linux) | |
| if: runner.os == 'Linux' | |
| env: | |
| LD_LIBRARY_PATH: ${{ github.workspace }}/ext/webrtc_ruby/build:${{ github.workspace }}/vendor/libdatachannel/build | |
| run: bundle exec rspec | |
| - name: Run tests (macOS) | |
| if: runner.os == 'macOS' | |
| env: | |
| DYLD_LIBRARY_PATH: ${{ github.workspace }}/ext/webrtc_ruby/build:${{ github.workspace }}/vendor/libdatachannel/build | |
| run: bundle exec rspec |